posted: 18 Sep 2013
Had a strange one today trying to start one of my Django sites after manually (i.e. not using manage.py) adding a new app. I had added the views.py and the urls.py but forgot the __init__.py. Trying to start that on Django under Python 3, I got this rather obscure (at least to me) error
AttributeError: 'module' object has no attribute '__file__'
Now that had me a little confused, until I tried running the exact same application using Python 2.7 and the error came back
ImportError: No module named tricurve
tricurve, being the name of the application I'd added was a great big clue here. I realized that I had simply not indicated that I wanted Python to consider tricurve as a module, which is done by creating a __init__.py file. After doing that, it started fine under Python 2.7 and then, after switching back to Python 3, it started fine too.
HTML
There are currently no comments...
September | ||||||
« | 2013 | » | ||||
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |