Opening file in Excel

Mark Hammond mhammond at skippinet.com.au
Wed Aug 21 22:34:07 EDT 2002


Lemniscate wrote:
> "dsavitsk" <dsavitsk at e-coli.net> wrote in message news:<buT79.3072$yt3.1265418 at newssrv26.news.prodigy.com>...
> 
>>have you tried using the whole file path? i.e. -> 'C:\\my\\path\\mytest.xls'
>>also, instead of throwing the file name at XL, see if the file exists first.
>>
>>>>>import os.path
>>>>>if os.path.exists(filename):
>>>>
>>...    lf.xlBook = self.xlApp.Workbooks.Open(filename)
>>
>>-d
>>
> 
> 
> Sorry for the delayed response, an unexpected twist at work has kept
> me away from the computer.
> 
> Yes, my original message included the line "Using the full path of the
> file results in the
> exact same thing."  Here is a complete interactive session to show
> what I mean...

Maybe Excel doesnt like the forward slashes, or the spaces without 
quotes, or the time of the day?  Either way, it is unlikely to be a 
Python specific issue - if you write a quick VBScript app with the same 
hardcoded path name, I would expect to see it fail in the same way.

Experiment a little - try "c:\\test.xls", for example, and work back 
from that.

Mark.




More information about the Python-list mailing list