January 26th, 2004, 07:45 AM
Could have somthing to do with the filename you passing to your files. instead of using the variable 'filename' your passing in a string "filename"
C:\Documents and Settings\Mark>cd desktop |
C:\Documents and Settings\Mark\Desktop>checkfile.py new.txt
Can read from <open file 'new.txt', mode 'r' at 0x008F6F60>
Can write to <open file 'new.txt', mode 'w' at 0x008F6F60>
Check a path to see if the file is readable/writable or not.
print 'Can read from', file(path, 'r')
print 'Cannot read from', path
print 'Can write to', file(path, 'w')
print 'Cannot write to', path
if __name__ == "__main__":
if len(sys.argv) != 2:
print 'Usage: ./filecheck <path/filename>'
changed things around and it worked fine.. oh
you really dont need a class there; people seems to use classes where a function would be fine, so not just you.
programming language development: www.netytan.com – Hula