peasauce icon indicating copy to clipboard operation
peasauce copied to clipboard

ImportError: attempted relative import with no known parent package

Open mwenge opened this issue 3 years ago • 3 comments

Hi there,

Getting the following error. Any suggestions?

[robert@mwenge-desktop python (master)]$ pwd
/home/robert/Dev/peasauce/python
robert@mwenge-desktop python (master)]$ python3 --version
Python 3.8.5
[robert@mwenge-desktop python (master)]$ python3 qtui.py 
Traceback (most recent call last):
  File "qtui.py", line 41, in <module>
    from . import disassemblylib
ImportError: attempted relative import with no known parent package

mwenge avatar Apr 07 '21 12:04 mwenge

Run it from the directory up a level. So you are doing python3 python\qtui.py should work I think.

On Thu, 8 Apr 2021 at 00:30, Rob Hogan @.***> wrote:

Hi there,

Getting the following error. Any suggestions?

@.*** python (master)]$ pwd /home/robert/Dev/peasauce/python @.*** python (master)]$ python3 --version Python 3.8.5 @.*** python (master)]$ python3 qtui.py Traceback (most recent call last): File "qtui.py", line 41, in from . import disassemblylib ImportError: attempted relative import with no known parent package

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rmtew/peasauce/issues/11, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAICGZRVZKORFCLL74A4MRDTHRF6VANCNFSM42QWJLQQ .

rmtew avatar Apr 08 '21 02:04 rmtew

I have the exact same issue (as of 30 May 2021) under Win10.

NOTE; tried to install python and Qt libraries under Ubuntu Linux and gave up in frustration. Win10 install was much easier.

I installed Python 3.9.5

BTW the instruction "pip install pyqt" (under the "Installation" section ) gave a very unhelpful error message in red. Wow must be serious! Hope my computer wasn't damaged :-)

I googled and tried instead "pip install PyQt5" which installed this library painlessly. The command "pip install QT.py" appeared to work.

Tried running from within the python directory and also (as suggested above) from the folder above. Same error each time.

Just as a rant, python is supposed to be some great language, especially for noobs to learn (such as me!), but when it goes wrong, the error messages might as well be printed in Klingon. I can see that this is a complicated and sophisticated project with lots of source files and other stuff. Does it really have to be this complicated, or should we (noobs) leave python only to the rocket scientist experts???

UPDATE: [5 minutes later...] So I executed the batch file "run.bat" and the GUI appears. So the instruction for "Method 1" might need to be amended, but it does say "any platform" and comes first which I why I tried this first!

migry avatar May 30 '21 14:05 migry

Same problem as of December 2023. This may help others.

I managed to execute it with...

python3 -m python.qtui

...from the peasauce root directory and not in the python subdirectory.

MrMisanthrope avatar Dec 15 '23 03:12 MrMisanthrope