WebFaction
Community site: login faq

I have a tweepy script that works fine from the command line, using tweepy installed with "pip install tweepy". It also worked fine via cron job when I was using the default python2.4. I later upgraded to python2.6 and reinstalled my libs.

The script imports all of the paths it needs to find, e.g.: sys.path.append('/home/username/lib/python2.6') (which is where tweepy lives). But when the script is run from a cron job, it now errors with:

$ cat cron.log 
/home/username/lib/python2.6/simplejson/scanner.py:6: RuntimeWarning: Python C API version mismatch for module _speedups: This Python has API version 1012, module _speedups has version 1013.
  from simplejson._speedups import make_scanner
Traceback (most recent call last):
  File "/home/username/webapps/django/bucketlist/scripts/tweet_sked.py", line 29, in ?
    import tweepy
  File "/home/username/lib/python2.6/tweepy/__init__.py", line 17, in ?
    from tweepy.streaming import Stream, StreamListener
  File "/home/username/lib/python2.6/tweepy/streaming.py", line 17, in ?
    json = import_simplejson()
  File "/home/username/lib/python2.6/tweepy/utils.py", line 83, in import_simplejson
    import simplejson as json
  File "/home/username/lib/python2.6/simplejson/__init__.py", line 273, in ?
    object_pairs_hook=None)
  File "/home/username/lib/python2.6/simplejson/decoder.py", line 395, in __init__
    self.scan_once = make_scanner(self)
SystemError: NULL result without error in PyObject_Call

So the script IS finding tweepy, but is complaining about Python C API version mismatch

Suggestions? Thanks.

asked 18 May '11, 14:01

shacker
312
accept rate: 0%


I think you're probably using the wrong version of Python in your cron job. Try changing your cron job so that it invokes your script like this:

/usr/local/bin/python2.6 /home/username/webapps/django/bucketlist/scripts/tweet_sked.py

Hope that helps!

permanent link

answered 18 May '11, 14:24

seanf
12.2k42136
accept rate: 37%

Thanks SeanF - that was totally it. Much appreciated.

(18 May '11, 22:24) shacker
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×337
×81
×3

question asked: 18 May '11, 14:01

question was seen: 4,266 times

last updated: 18 May '11, 22:24

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM