I'll take a stab at this... This looks like something I see sometimes when I accidentally invoke a script without specifying a Python interpreter, e.g. I say ./foo.py
instead of python foo.py
, or do not have a #!
line at the script's beginning. When I do this, the script fails after some time with a syntax error, and the directory is filled with files named sys, os, time, et al -- exactly the modules I was importing in my script. These new files are fairly large (7MB). Doing head sys
shows file contents essentially the same as yours. I use Linux (Ubuntu) and no IDE for my Python development, just a bash shell.
Here's what I think is going on, at least on Linux: If you do man import
you'll see
import - saves any visible window on an X server and outputs it as an image file. You can capture a single window, the entire screen, or any rectangular portion of the screen.
[...]
The import program is a member of the ImageMagick(1) suite of tools. Use it to capture some or all of an X server screen and save the image to a file.
So I'm guessing that the shell is interpreting the first line of Python import
statements as the /usr/bin/import
command, and using the "argument" (module name) as the name of the image file to save. Hence the PS / ImageMagick stuff at the top of the file.
Again, I only see this when I occasionally space out and invoke my script with no Python interpreter. Since I don't know your code or usage conditions I can't guarantee this is your exact issue, but I'm guessing you're doing something similar (maybe unknowingly). I hope this helps, and gets you on the right track.
EDIT: Here's an experiment which basically reproduces your issue. Code:
import sys
import random
import os
import time
import signal
def main():
sys.stdout.write('foo\n')
if (__name__ == "__main__"):
main()
I invoke it with no Python:
./foo.py
./foo.py: line 8: syntax error near unexpected token `('
./foo.py: line 8: `def main():'
New files are there:
$ ls
total 25096
-rwxr-xr-x 1 doug doug 146 2013-06-27 10:31 foo.py
-rw-r--r-- 1 doug doug 7291759 2013-06-27 10:12 os
-rw-r--r-- 1 doug doug 7291763 2013-06-27 10:12 random
-rw-r--r-- 1 doug doug 1903418 2013-06-27 10:32 signal
-rw-r--r-- 1 doug doug 1903415 2013-06-27 10:32 sys
-rw-r--r-- 1 doug doug 7291761 2013-06-27 10:12 time
Look at the contents of them:
$ head sys
%!PS-Adobe-3.0
%%Creator: (ImageMagick)
%%Title: (sys)
%%CreationDate: (2013-06-27T10:32:20-05:00)
%%BoundingBox: 0 0 663 471
%%HiResBoundingBox: 0 0 663 471
%%DocumentData: Clean7Bit
%%LanguageLevel: 1
%%Orientation: Portrait
%%PageOrder: Ascend
Again, I hope this sheds some light and helps a bit.