T
tim
I wrote this very simple program that checks a directory and makes a
list of files that surpass a given size.
I tried to compile it using py2exe.
I used py2exe before with more complex programs without any problem.
Now, although my program works fine when I run it from PythonWin, it
won't compile to an executable.
here's the program:
#############
import os
blacklist=[]
d=raw_input('path')
s=int(raw_input('maxsize (in bytes):'))
f = os.listdir(d)
outfile = open(d + r'\filelist_for_this_location.txt', 'wb')
outfile.write('files found in ' + d + '\n'+ 'checking maximum filesize:
' + str(s) + ' bytes...\n')
for n in f:
filepath = os.path.join(d,n)
if os.path.isfile(filepath):
outfile.write(n + '\n')
currsize = int(os.path.getsize(filepath))
if currsize >= s:
outfile.write('------------> is too big\n')
blacklist.append(filepath)
outfile.write('\n'+'\n'+ 'blacklist\n')
for bl in blacklist:
outfile.write(bl + '\n')
outfile.close()
##############
here's the py2exe error log:
Traceback (most recent call last):
File "filesizechecker.py", line 4, in ?
EOFError: EOF when reading a line
any idea?
Tim
list of files that surpass a given size.
I tried to compile it using py2exe.
I used py2exe before with more complex programs without any problem.
Now, although my program works fine when I run it from PythonWin, it
won't compile to an executable.
here's the program:
#############
import os
blacklist=[]
d=raw_input('path')
s=int(raw_input('maxsize (in bytes):'))
f = os.listdir(d)
outfile = open(d + r'\filelist_for_this_location.txt', 'wb')
outfile.write('files found in ' + d + '\n'+ 'checking maximum filesize:
' + str(s) + ' bytes...\n')
for n in f:
filepath = os.path.join(d,n)
if os.path.isfile(filepath):
outfile.write(n + '\n')
currsize = int(os.path.getsize(filepath))
if currsize >= s:
outfile.write('------------> is too big\n')
blacklist.append(filepath)
outfile.write('\n'+'\n'+ 'blacklist\n')
for bl in blacklist:
outfile.write(bl + '\n')
outfile.close()
##############
here's the py2exe error log:
Traceback (most recent call last):
File "filesizechecker.py", line 4, in ?
EOFError: EOF when reading a line
any idea?
Tim