October 4th, 2004, 02:27 PM
Writing output to Excel sheet
I'm able to use a python script to write an output to an MS Excel sheet. But the second time I run the same script, it gives me permission error:
PS. Here I have used the # buttons as was mentioned in one of the "How to post messages" threads, but still when I use preview, the indentation is not conserved.
output= open("C:\Documents and Settings\Sam\Desktop\L24.xls","w")
IOError: [Errno 13] Permission denied: 'C:\\Documents and Settings\\Sam\\Desktop\\L24.xls'
Last edited by netytan; October 4th, 2004 at 03:01 PM.
October 4th, 2004, 03:07 PM
This error indicates that something else already has the file open. I'm guessing that you have the spreadsheet already open in Excel or something, or perhaps it is a previous running instance of the program which hasn't been killed off yet. Check your Task Manager to be certain.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
October 4th, 2004, 03:31 PM
Thanks alot, yes the page was open and I was trying to write to it!
October 4th, 2004, 03:34 PM
Check out your post by clicking on the Edit button; you should be able to see what's changed, and what you need to do to preserve your indentation in future .
Anyway, to explain your error. Usually if the file is in use by another program [locked], or you don't have write permission on the file, then Python shouldn't be able to write to the file. For example...
Maybe if you attach the script we could spot the problem. For more info on IOError's you can check out:
Last edited by netytan; October 4th, 2004 at 03:37 PM.