ImportError - no module named...

1,193 views
Skip to first unread message

Chris Hepworth

unread,
Feb 11, 2014, 3:09:32 PM2/11/14
to web...@googlegroups.com

I recently had to set up a new environment (my desktop running Ubuntu is dead) on my Windows laptop. I have a module called qrcode that worked fine in my old environment and hasn't had an issue on pythonanywhere. After I cloned the application, however, I received this error. Is there something special about Windows? I am working on replacing my desktop, but in the meantime I would love to get this working. Any help would be much appreciated!

<type 'exceptions.ImportError'> No module named mqr.modules


Version

 
 
web2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07
PythonPython 2.7.5: C:\web2py\web2py.exe (prefix: C:\Python27)


Traceback


1.
2.
3.
4.
5.
6.
7.
Traceback (most recent call last):
 
File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 217, in restricted
  File
"C:/web2py/applications/mqr/controllers/cms.py", line 105, in <module>
   
import qrcode
  File
"/home/mdipierro/make_web2py/web2py/gluon/custom_import.py", line 76, in custom_importer
ImportError
: No module named

Niphlod

unread,
Feb 11, 2014, 3:15:35 PM2/11/14
to web...@googlegroups.com
are all the dependencies of that module satisfied on the windows environment ?
for imported modules, if some of the libraries it depends on are missing, the error that web2py can show is that it's unable to import the module (meaning, it can't load it because there is some error in it vs - what you're probably guessing - its a non-existant module )

Chris Hepworth

unread,
Feb 11, 2014, 3:27:23 PM2/11/14
to web...@googlegroups.com
Considering I had another import failure for PIL (which I thought I had but didn't) that wouldn't be surprising. The Windows Python 2.7 install sure doesn't seem to include much. I'll take a look at the module's dependencies and post again if that fixes it. Thank you!

Chris Hepworth

unread,
Feb 11, 2014, 4:12:42 PM2/11/14
to web...@googlegroups.com
There is an import for pymaging, which must have already been installed on my Ubuntu machine. Installing it on Windows seems to be more trouble than its worth, so I'll just wait to get my Ubuntu environment set up on another machine. Thanks for the suggestion though!


On Tuesday, February 11, 2014 1:15:35 PM UTC-7, Niphlod wrote:

Chris Hepworth

unread,
Feb 11, 2014, 6:21:54 PM2/11/14
to web...@googlegroups.com
Just to test I set up a VM running Ubuntu. I installed all relevant packages and I am still receiving the same error. Any suggestions?

Chris Hepworth

unread,
Feb 11, 2014, 6:33:41 PM2/11/14
to web...@googlegroups.com
https://groups.google.com/forum/#!searchin/web2py/importerror/web2py/FEYjCpBPpWU/9OfvXCeyPMoJ

I found this thread as I searched for a solution. I can confirm that in my app, there is an __init__.py in modules. It is blank (as it has been since I created the app), but it is there. Could this have something to do with the issue?

Cliff Kachinske

unread,
Feb 11, 2014, 11:20:55 PM2/11/14
to web...@googlegroups.com
The __init__.py file tells Python that the directory is a package.

You can also put code in __init__.py. The code will execute when you import the package.

Leave it in there. You need it.

Mirek Zvolský

unread,
Jun 8, 2014, 1:24:32 PM6/8/14
to web...@googlegroups.com
I had very similar problem (Windows, too) and the reason was that in applications/myapp was no __init__.py.
Web2py special importer converts the import to something like:   import applications.mqr.modules.qrcode
and this fails without applications\mqr\__init__.py.
After adding __init__.py into current application root all works well.

Mirek




Dne úterý, 11. února 2014 21:09:32 UTC+1 Chris Hepworth napsal(a):
Reply all
Reply to author
Forward
0 new messages