Newbie: opening files.

Bart Holthuijsen Gonk_ at spamspamhotmail.com
Fri May 19 09:22:28 EDT 2000


hi Python enthousiasts!

I'm having a problem with the opening of files under Python... I've seen
code which makes it seem easy, just a call like:
file = open(filename, 'r')

doesn't seem to hard, now does it?

now this is what I try to do:

-------------------------
from sys import *
from os import *
from string import *

def main():
 chdir('c:\stage\Xalan')
 f = open('Yearend.xml','r')
 print "file opened"
-------------------------

The following error message appears:

C:\Stage\xalan>python open.py
Traceback (innermost last):
  File "open.py", line 25, in ?
    if __name__=='__main__': main()
  File "open.py", line 13, in main
    f = open('Yearend.xml','r')
TypeError: illegal argument type for built-in operation

What am I doing wrong?

TIA,
 Bart Holthuijsen.




More information about the Python-list mailing list