On Nov 3, 2010, at 10:34 PM, Jonathan Lundell wrote:
> 
> On Nov 3, 2010, at 8:45 PM, Leo wrote:
>> 
>> I am running web2py 1.88.2.
>> 
>> I have some modules I import that are not under the application's
>> directory. These are moduled developed for other projects.
>> 
>> Accessing the modules works fine within the app itself, since they are
>> on the PYTHONPATH. However, running the following cron command:
>> 
>> @reboot username **default/function
>> 
>> I get an ImportError:
>> 
>> ImportError: No module named mymodule.
>> 
>> Is this by design? Is there a workaround?
> 
> Did this ever work?
> 
> Are you using hardcron?
> 
> Conjecture: PYTHONPATH isn't in the environment of the shell that cron 
> launches.
> 
> Possible workaround: create a directory site-packages in the web2py root 
> (sibling of gluon) and create a link from site-packages/mymodule to the 
> actual location of mymodule.

Another possible workaround. Instead of putting PYTHONPATH directly into the 
environment, put PYTHONSTARTUP in the environment and do your path additions in 
the python startup (rc) file. 

Reply via email to