Hi Marcus, welcome.
I'm Francky (from Project Euler, as you I guess)
I don't see any problem in your pieces of code.
Just I can tell some Python 'tricks', as you're new at SPOJ.
Python2.5 label is mostly true.
I'm sure you're using Python2.7 at home, there's some little differences, so be careful, NZEC (an error can be raised).
But on SPOJ, there's many servers, and most of them provides Python2.5(+psyco if you want).
There's too some servers with Python2.7 inside, (without psyco). (You can recognize them after submitting, the memory print is greater than Py2.5 ; often it's 3.8MB vs 4.0MB as a base, + your data if consequent)
I prefer using Python3, but sometimes I use Py2 witch is faster on I/O.
But You can't choose Py2.5 or Py2.7, it's the luck at each submission.
You can try a Py3 translation, it could solve your problem.
Example given : bit_length() is not available with Py2.5 !!! Only P2.7 and Py3+
I don't know how is working your primes-below, but an offset sieve is the key for a fast Python AC (ACcepted) solution.
I think a sieve on the whole range will get TLE (Time Limit Exceeded).
IDEOne is with Py2.7, remember that.
More, hardware is much faster on IDEOne, SPOJ is a slow PIII.
Have fun.
Francky
PS : here is a link to my first post here (it was on prime1 too), there's some useful answers of numerix (the best Python Guru here).