Ultimaker / libArcus

Communication library between internal components for Ultimaker software
GNU Lesser General Public License v3.0
72 stars 81 forks source link

AttributeError: module 'Arcus' has no attribute 'SocketListener' on windows #50

Open hebaoxing opened 7 years ago

hebaoxing commented 7 years ago

@Ghostkeeper @daid @fabianrodrigo

i'am also encountering the issue "No attribute SocketListener". and commands:

python3.5
import Arcus
print(Arcus.__file__)

get: somethingsomething/python3.5/lib/site-packages/Arcus/init.py

the big trouble for me is: i don't know how to build the libArcus on the windows, so the file Arcus.pyd can't be generated out. when i follows the build guidelines about Arcus on the webpage, also guideline about protobuf, they are no effective when i try to compile or install, every compile path is full of errors.

Could you point me out more detailed compile or install procedures? many thanks!

Ghostkeeper commented 7 years ago

Calling on @awhiemstra also... I have no clue about this.

daid commented 7 years ago

I've seen this when mixing wrong (old) versions of Arcus with newer Cura versions. Where older Arcus was wrongly in my path.

hebaoxing commented 7 years ago

thanks for the replies! @Ghostkeeper @daid

@daid Is there something i can do to build Cura smoothly with Arcus? or the newer version Arcus is a must? and where i can get the newer version Arcus? thanks!

daid commented 7 years ago

The newer version of Arcus is here in this repo, but if you installed an older version in your python installation, then the newer version does not properly override this.

hebaoxing commented 7 years ago

@daid
based this repo, the newer version Arcus, now i can get Arcus.pyd built by VS2015. i copy the file Arcus.pyd and Arcus folder(including init.py, *.sip files) to the python folder ..\Lib\site-packages, then do 1) python; 2)import Arcus; 3)print(Arcus.file); get: ..\Lib\site-packages\Arcus__init__.py.

is there something wrong about what i do ? install Arcus means what operations? thanks!

awhiemstra commented 7 years ago

You only need the .pyd file. The other files are leftovers that should have been removed a long time ago. I just removed them.

The .pyd should be placed somewhere where your Python can find it, either by setting PYTHONPATH or by manually copying the file.

hebaoxing commented 7 years ago

@awhiemstra @daid

i copy the .pyd file to the python folder ..\Lib\site-packages, and set PYTHONPATH to ..\Lib\site-packages, but when i build the cura project, the error"AttributeError: module 'Arcus' has no attribute 'SocketListener'" still appears, how can i solve this error? thanks!

awhiemstra commented 7 years ago

Make sure there is no "Arcus" directory in any of the PYTHONPATH directories. Python will try and load that directory before loading the .pyd file and then fail because the old Python implementation does not match the newer API.

hebaoxing commented 7 years ago

@awhiemstra

Arcus is not in any of the PYTHONPATH directories, just copy the .pyd file to the python folder.

I put the UM and Arcus folder in the cura project, if not, the compile will not find module Arcus and UM. but still can't avoid the error "AttributeError: module 'Arcus' has no attribute 'SocketListener'". it seems the compiler is not easy to find the SocketListener in every kind of try.

awhiemstra commented 7 years ago

In that case, it is finding the Arcus folder in the Cura folder. You need to remove that one and make sure the only Arcus thing Python can find is Arcus.pyd.

hebaoxing commented 7 years ago

i remove the Arcus folder, but the UM can't find it.

SingalSocket.py in the UM folder import Arcus

errors: ... cura.CrashHandler.show [35]: "../CuraMaster\UM\Backend\SignalSocket.py", line 4, in cura.CrashHandler.show [35]: import Arcus cura.CrashHandler.show [35]: ImportError: DLL load failed:

awhiemstra commented 7 years ago

The "DLL load failed" is the relevant message here. For some reason, the .pyd fails to load. Please post the entire stack trace.

hebaoxing commented 7 years ago

"C:\Python 3.5\python.exe" "C:\Program Files (x86)\JetBrains\PyCharm 2016.3\helpers\pydev\pydevd.py" --multiproc --qt-support --client 127.0.0.1 --port 7256 --file D:/XProject/Cura/20170102/CuraMaster/cura_app.py pydev debugger: process 1052 is connecting

Connected to pydev debugger (build 163.8233.8) cura.CrashHandler.show [32]: An uncaught exception has occurred! cura.CrashHandler.show [35]: Traceback (most recent call last): cura.CrashHandler.show [35]: File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3\helpers\pydev\pydevd.py", line 1596, in cura.CrashHandler.show [35]: globals = debugger.run(setup['file'], None, None, is_module) cura.CrashHandler.show [35]: File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3\helpers\pydev\pydevd.py", line 974, in run cura.CrashHandler.show [35]: pydev_imports.execfile(file, globals, locals) # execute the script cura.CrashHandler.show [35]: File "C:\Program Files (x86)\JetBrains\PyCharm 2016.3\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile cura.CrashHandler.show [35]: exec(compile(contents+"\n", file, 'exec'), glob, loc) cura.CrashHandler.show [35]: File "D:/XProject/Cura/20170102/CuraMaster/cura_app.py", line 49, in cura.CrashHandler.show [35]: import cura.CuraApplication cura.CrashHandler.show [35]: File "D:/XProject/Cura/20170102/CuraMaster\cura\CuraApplication.py", line 4, in cura.CrashHandler.show [35]: from UM.Qt.QtApplication import QtApplication cura.CrashHandler.show [35]: File "C:\Python 3.5\lib\site-packages\UM\Qt\QtApplication.py", line 17, in cura.CrashHandler.show [35]: from UM.Qt.Bindings.Bindings import Bindings cura.CrashHandler.show [35]: File "C:\Python 3.5\lib\site-packages\UM\Qt\Bindings\Bindings.py", line 13, in cura.CrashHandler.show [35]: from . import BackendProxy cura.CrashHandler.show [35]: File "C:\Python 3.5\lib\site-packages\UM\Qt\Bindings\BackendProxy.py", line 9, in cura.CrashHandler.show [35]: from UM.Backend.Backend import BackendState cura.CrashHandler.show [35]: File "C:\Python 3.5\lib\site-packages\UM\Backend\Backend.py", line 6, in cura.CrashHandler.show [35]: from UM.Backend.SignalSocket import SignalSocket cura.CrashHandler.show [35]: File "C:\Python 3.5\lib\site-packages\UM\Backend\SignalSocket.py", line 4, in cura.CrashHandler.show [35]: import Arcus cura.CrashHandler.show [35]: ImportError: DLL load failed: The specified module could not be found。

Process finished with exit code 1

hebaoxing commented 7 years ago

@awhiemstra is there some idea about entire stack? i can't still find some solution about this issue.

Ghostkeeper commented 7 years ago

The module is not in the .pyd file or something? :confused:

hebaoxing commented 7 years ago

@Ghostkeeper thanks! the Arcus.pyd file is successfully compiled out. i copy the .pyd file to the python folder ..\Lib\site-packages, the Arcus module should be in the *.pyd file, but i have no tool to check. i think it seems Cura can't find the .pyd file.

if there is a fool-style way for the cura to link Arcus, the third party developer don't need to care the setting or install, it will be better.

akshayams94 commented 1 year ago

print(Arcus.file)

We need arcus file. Dont delete it