Python 2.7 segfaults on 'import site'

Dave Angel davea at davea.name
Mon Dec 29 10:57:34 EST 2014


On 12/29/2014 09:33 AM, Chris Angelico wrote:
> rosuav at sikorsky:~$ python -S
> Python 2.7.3 (default, Mar 13 2014, 11:03:55)
> [GCC 4.7.2] on linux2
>>>>
> rosuav at sikorsky:~$ python
> Segmentation fault
>
> This is the system Python on Debian Wheezy, and I haven't changed
> site.py at all. This broke some time in the last few days, and I'm
> trying to figure out why. (I have been fiddling with my python3, but
> the system Python is untouched, as you can see from the above.)
> Attempting to 'import site' manually causes the same segfault; things
> get interesting if I create my own local site.py though:
>
> rosuav at sikorsky:~/aaa$ touch site.py
> rosuav at sikorsky:~/aaa$ python
> Segmentation fault
> rosuav at sikorsky:~/aaa$ python -S
> Python 2.7.3 (default, Mar 13 2014, 11:03:55)
> [GCC 4.7.2] on linux2
>>>> import site
>>>>
>
> So clearly an empty 'site' can be imported safely, but running Python
> without -S segfaults.
>
> Can anyone advise as to where I should look for the cause of the trouble?
>

My gut feeling is you should check if there is another site.py* anywhere 
on your system.  (Use find rather than just manually checking the 
sys.path locations)


-- 
DaveA



More information about the Python-list mailing list