open( "file","mode") difference between script and commandline?

Michael Praschl praschl at bigfoot.com
Sat Nov 6 21:41:43 EST 1999


hi all 

im using python 1.5.2 for BeOS and im having a problem with file
opening. when i use 

>>> f = open( "filename","w" ) 

in the command line interface, this works perfectly ok. but when i use
the same function from a script, i get the following error: 

Traceback (innermost last): 
  File "Signmail.py", line 19, in ? 
    f = open( "/tmp/workfile", "w" ) 
TypeError: illegal argument type for built-in operation 

can anybody tell me why this is? and what i can do about it? 

the second problem i found while i was trying to get around this. i have
a multiline string (linefeeds) in the variable reply, and want to do the
following: 

system( "echo >/tmp/pgpBeMail `reply`" )  #reply is within this "\"
apostrphys (in case the newsreaders cant show them correctly) 

in this case the file is empty after the call. i tried also turning to
this "/" apostrophys and to normal ones, but then the file contains
"reply" as expected, but not the contents of "reply" 

if anybody knows what im doing wrong, please give me a hint! 

-- mfG, Michael Praschl





More information about the Python-list mailing list