Really, really annoying problem

Greg Landrum glandrum at my-deja.com
Wed Sep 20 19:21:42 EDT 2000


In article <BW8y5.7965$g12.449621 at news1.cableinet.net>,
  "Brett Lempereur" <a.lempereur[remove this|@|remove this]
cableinet.co.uk> wrote:
>
> > - how do you know that the backslashes are doubled?
> >   (in other words, how did you print the filename?)
>
> Because I do this:
>
> filename = tools.addroot("ppdump.cfg")
> file = open(filename, "w")
>
> The error occurs at the "open(filename, 'w')" stage, where it raises
the
> double backslash error
>
> The error message from python is....
>
> Traceback (most recent call last):
>   File "D:\Python\Pythonwin\pywin\framework\scriptutils.py", line
301, in
> RunScript
>     exec codeObject in __main__.__dict__
>   File "C:\My Documents\Python\Backup Program\Lib\recurse_test.py",
line 17,
> in ?
>     out_file = open(out_filename)
> IOError: [Errno 2] No such file or directory: 'C:\\ppdump.txt'
>

Fredrik already said this, but you didn't appear to read it, so I'll
say it too.
Look at the second to last line of your traceback.  The command being
executed is:
     out_file = open(out_filename)
what you probably meant to have there was:
     out_file = open(out_filename,"w")

The problem most likely has nothing to do with mysterious backslash
doubling.

-greg


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list