genicam / harvesters_gui

Harvester-based GUI
Apache License 2.0
56 stars 22 forks source link

ImportError #19

Open jvieira88 opened 4 years ago

jvieira88 commented 4 years ago

Hi,

I'm following the example to launch the GUI but I'm getting an import error:

from harvesters_gui.frontend.pyqt5 import Harvester
ImportError: cannot import name 'Harvester' from 'harvesters_gui.frontend.pyqt5' (C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\harvesters_gui\frontend\pyqt5.py)

By opening pyqt5.py i can see the Harvester class is defined so python should be able to find, but it looks like it can't. Any thoughts?

Thanks in advance.

jvieira88 commented 4 years ago

The complete error message: PS C:\Users\jv\source\repos\P1108_Rosalind\Rosalind\Camera> python .\harvesters.py Traceback (most recent call last): File ".\harvesters.py", line 3, in <module> from harvesters_gui.frontend.pyqt5 import Harvester File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\harvesters_gui\frontend\pyqt5.py", line 39, in <module> from harvesters.core import Harvester as HarvesterCore File "C:\Users\jv\source\repos\P1108_Rosalind\Rosalind\Camera\harvesters.py", line 3, in <module> from harvesters_gui.frontend.pyqt5 import Harvester ImportError: cannot import name 'Harvester' from 'harvesters_gui.frontend.pyqt5' (C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\harvesters_gui\frontend\pyqt5.py)

kazunarikudo commented 4 years ago

@jvieira88 Hi. Thank you for trying out Harvester. (1) Could you show me the content of your harvesters.py, please? By the way, it looks like you are trying to run the script with the interpreter installed in Visual Studio under the program files directory. Have you ever tried to install Python by yourself using an installer that the Python Software Foundation is distributing? I would like to konw what would happen if your script is ran with the interpreter installed by the official installer; I assume the interpreter is installed in your %APPDATA% directory. You can download an installer of Python 3.7 from the following URL:

https://www.python.org/downloads/release/python-377/

Thanks, /Kazunari.

jvieira88 commented 4 years ago

Hi @kazunarikudo , Thanks for your comments, I've attached my harvesters.py as requested.

I managed to run it by starting it from the package installation directory. cd "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Lib\site-packages\harvesters_gui" python .\frontend\pyqt5.py

I'm ok with this workaround, it works for me.

Thanks, Joao

harvesters.zip