[web2py] Help with python module import error
I'm having trouble on Webfaction with web2py not finding the pytz module, even though it is found fine in my local environment. I've already installed the module using easy_install at myname/lib/python2.7 (as per Webfaction instructions), and I've confirmed that I can import it from the python prompt (in an ssh session). I've also confirmed that web2py is running on python2.7. But I'm still getting an import error. Any ideas? I thought I might try putting the package in my site-packages directory, but I'm not exactly sure what to put there. Would I use easy_install or do I need to put some files there manually? Thanks, Ian --
Re: [web2py] Help with python module import error
if the package is in your Python wen2py have to see this.. you can try inside web2py code (i.e models) import sys sys.path.append("/path/to/installed/package") Have you restarted web2py since you installed the module? On Mon, Sep 10, 2012 at 4:52 PM, monotasker wrote: > > I'm having trouble on Webfaction with web2py not finding the pytz module, > even though it is found fine in my local environment. I've > already installed the module using easy_install at myname/lib/python2.7 (as > per Webfaction instructions), and I've confirmed that I can import it from > the python prompt (in an ssh session). I've also confirmed that web2py is > running on python2.7. But I'm still getting an import error. Any ideas? > > I thought I might try putting the package in my site-packages directory, > but I'm not exactly sure what to put there. Would I use easy_install or do > I need to put some files there manually? > > Thanks, > > Ian > > > -- > > > > --
Re: [web2py] Help with python module import error
Hi Bruno, No, I haven't restarted. Somehow I thought that hitting "reload routes" would accomplish the same thing, but now that I think about it that wouldn't make sense. So now my really dumb question. Is restarting web2py on the server (Linux) just a matter of doing this? $killall web2py $python2.7 path_to_install/web2py.py Or will that start the rocket server? (I'm running Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.7.3) I know, this is something I should know by now, but somehow it has never come up! The installation was done for me by Webfaction (and before that by a Fluxflex script). Ian On Monday, September 10, 2012 4:03:05 PM UTC-4, rochacbruno wrote: > > > if the package is in your Python wen2py have to see this.. > > you can try inside web2py code (i.e models) > > import sys > sys.path.append("/path/to/installed/package") > > Have you restarted web2py since you installed the module? > > On Mon, Sep 10, 2012 at 4:52 PM, monotasker > > wrote: > >> >> I'm having trouble on Webfaction with web2py not finding the pytz module, >> even though it is found fine in my local environment. I've >> already installed the module using easy_install at myname/lib/python2.7 (as >> per Webfaction instructions), and I've confirmed that I can import it from >> the python prompt (in an ssh session). I've also confirmed that web2py is >> running on python2.7. But I'm still getting an import error. Any ideas? >> >> I thought I might try putting the package in my site-packages directory, >> but I'm not exactly sure what to put there. Would I use easy_install or do >> I need to put some files there manually? >> >> Thanks, >> >> Ian >> >> >> -- >> >> >> >> > > > --
Re: [web2py] Help with python module import error
If you are running on webfaction, maybe it is under apache and mod_wsgi, so you need to restart Apache to reload the mod_wsgi. $service apache2 restart or $/etc/init.d/apache2 restart (but you need to check if it is running apache, nginx or other) --
Re: [web2py] Help with python module import error
Aha! That did it. For the record, on Webfaction an application server is restarted with $HOME/webapps/app_name/apache2/bin/restart Thanks for pointing me in the right direction. I'm obviously going to have to learn a lot more about the server end of things :) But I really appreciate the help. Ian On Monday, September 10, 2012 4:26:59 PM UTC-4, rochacbruno wrote: > > If you are running on webfaction, maybe it is under apache and mod_wsgi, > so you need to restart Apache to reload the mod_wsgi. > > $service apache2 restart > > or > > $/etc/init.d/apache2 restart > > (but you need to check if it is running apache, nginx or other) > --