Open GoogleCodeExporter opened 9 years ago
[deleted comment]
Here is a more detailed test.
[04:04:10]<pp@host:/home/pp/> cat cron/syncr.py
#!/usr/bin/env python
import os
import sys
sys.path += ['/home/pp/django/src']
sys.path += ['/home/pp/django/projects']
sys.path += ['/home/pp/django/apps']
os.environ['DJANGO_SETTINGS_MODULE'] = 'pp.settings'
from pp import setting
sfrom syncr.app.tweet import TwitterSyncr
t = TwitterSyncr('user', 'pass')
t.syncTwitterUserTweets('user')
[04:04:15]<pp@host:/home/pp/> cron/syncr.py
Traceback (most recent call last):
File "cron/syncr.py", line 11, in <module>
from syncr.app.tweet import TwitterSyncr
File "/home/pp/cron/syncr.py", line 11, in <module>
from syncr.app.tweet import TwitterSyncr
ImportError: No module named app.tweet
[04:04:19]<pp@host:/home/pp/> /usr/bin/env pythonPython 2.6.1 (r261:67515, Mar
7
2009, 00:47:26)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2Type "help", "copyright", "credits" or
"license" for more information.
>>> import os, sys
>>> sys.path += ['/home/pp/django/src']
>>> sys.path += ['/home/pp/django/projects']
>>> sys.path += ['/home/pp/django/apps']
>>> os.environ['DJANGO_SETTINGS_MODULE'] = 'pp.settings'
>>> from pp import settings
>>> from syncr.app.tweet import TwitterSyncr
/home/opt/local/lib/python2.6/site-packages/twitter.py:25: DeprecationWarning:
the
md5 module is deprecated; use hashlib instead
import md5
>>> t = TwitterSyncr('user', 'pass')
>>> t.syncTwitterUserTweets('user')
>>>
Original comment by federico.maggi
on 8 Mar 2009 at 4:13
This is a clear PYTHONPATH issue. Now you are setting the PYTHONPATH using
sys.path which is good. But
where exactly is syncr.
I think its in pp. So you should be adding
Anyway you are having a directory 'pp' which is inside of another 'pp' which is
confusing. Make sure you put
__init__.py in the directory which contains syncr and also set the python path
and give it a try...
Original comment by yash...@gmail.com
on 9 Mar 2009 at 7:16
I think it probably is an environment variable issue too. Where do you have the
syncr app installed to?
Underneath /home/pp/django/apps ? Are you on Dreamhost ?
Original comment by jesse.l...@gmail.com
on 11 Mar 2009 at 12:22
This may be a dumb question, but what is the name of your sync script? I just
spent
20 minutes with a sync script names 'syncr.py' until I realized that Python was
looking for 'app.tweet' inside it.
Original comment by kchar...@gmail.com
on 24 Feb 2010 at 6:17
Original issue reported on code.google.com by
federico.maggi
on 8 Mar 2009 at 3:49