-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import Error, AttributeError: 'module' object has no attribute 'init' #19
Comments
Sorry. I cannot know the reason. Could you rebuild all after removing 'build' directory? |
Rebuilt serval times, still having the same problem |
Could you share Makefile and build process? |
Attached my Makefile and build logs. Not sure what I added in the last couple hours but the error actually changed to However, I believe I have the correct path to the file,
Another changes I just made is But the .so was placed in Although both inside or outside the directory points to the same PATH 1 & 2 only I have tried to cp the .so and egg-info to PATH 1 & 2, however, due to the error switched to |
You should use absolute path when you run outside of pyyolo directory. |
You mean I need the absolute path for the coco.data? Here is part of the code I use to select the path for the files. Just for testing with two cmd(inside and outside the directory). But I doubt this part is affecting coco.names?
|
Solution #21 |
I was trying to import the pyyolo wrapper from a parent directory.
However, I encounter this error
File ".../pyyolo/body_detector.py", line 18, in __init__ pyyolo.init(datacfg, cfgfile, weightfile)
AttributeError: 'module' object has no attribute 'init'
I am aware that some path was set by the setup.py, which causing the "pyyolo" module can only be import properly within the directory.
I also used the "imp" module and found that the module outside the directory looks like
>>> imp.find_module('pyyolo') (None, 'pyyolo', ('', '', 5))
While inside the directory look like
(<open file '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyyolo.so', mode 'rb' at 0x1005d4a50>, '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyyolo.so', ('.so', 'rb', 3))
However, even I tried to use the "imp" module to import it with the path above still nth happens. Its there any other way I can use/import the wrapper from parent directory????
Thanks a lot!!!
The text was updated successfully, but these errors were encountered: