Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 2nd, 2005, 06:15 AM
Timothy Smith
Guest
 
Posts: n/a
Default startfile problems

hello i have a very odd issue with os.startfile()

ok basicly my app works perfectly on every single other pc todate. i
cannot recreate this issue on any system. so i've already ruled out any
obvious coding issues, such as wrong file names etc. this issue only
occurs on this one old pc.

upon trying to os.startfile() a pdf document (that i create) i get the
error - Windows error [erro2]"System cannot find the specified file"
however when i go in to the program directory, the file is there, and i
can open it. i have ruled out the following:
the pdf viewer is working.
the path and file name are correct
the path and file name do not contain any spaces and what not.

it's a windows xp system and i'm using python 2.3

i'm very curious as to what everyone thinks
  #2  
Old August 2nd, 2005, 08:35 AM
Dennis Lee Bieber
Guest
 
Posts: n/a
Default Re: startfile problems

On Tue, 02 Aug 2005 15:10:23 +1000, Timothy Smith
<timothy@open-networks.net> declaimed the following in comp.lang.python:
[color=blue]
>
> i'm very curious as to what everyone thinks[/color]

I suspect most of us think: Where's the code?
followed by: Where's the traceback?

As for your statement of verifying the path and filename... We
haven't seen it so can't guess... (part of the "where's the code")

Does the path contain \n, \t, \r, \f, etc. If it does, and you
are not using a raw string, you are looking for a file with newline,
tab, carriage return, formfeed, etc. respectively in the name.


fid = "c:\temp\something.pdf" #bad, this is
# c:<tab>emp\something.pdf
# assuming \s isn't some special character

fid = r"c:\temp\something.pdf" #good
fid = "c:\\temp\\something.pds" #okay

--[color=blue]
> ================================================== ============ <
> wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed@dm.net | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <[/color]
  #3  
Old August 2nd, 2005, 08:45 AM
Timothy Smith
Guest
 
Posts: n/a
Default Re: startfile problems

Dennis Lee Bieber wrote:
[color=blue]
>On Tue, 02 Aug 2005 15:10:23 +1000, Timothy Smith
><timothy@open-networks.net> declaimed the following in comp.lang.python:
>
>
>[color=green]
>>i'm very curious as to what everyone thinks
>>
>>[/color]
>
> I suspect most of us think: Where's the code?
> followed by: Where's the traceback?
>
> As for your statement of verifying the path and filename... We
>haven't seen it so can't guess... (part of the "where's the code")
>
> Does the path contain \n, \t, \r, \f, etc. If it does, and you
>are not using a raw string, you are looking for a file with newline,
>tab, carriage return, formfeed, etc. respectively in the name.
>
>
>fid = "c:\temp\something.pdf" #bad, this is
># c:<tab>emp\something.pdf
># assuming \s isn't some special character
>
>fid = r"c:\temp\something.pdf" #good
>fid = "c:\\temp\\something.pds" #okay
>
>
>[/color]
it's iterally just

PDFname = 'tmp.pdf'
os.startfile(PDFname)

thats the code.

so obviously it contains no errnous characters. see my update btw. it
actually DOES open the report, but throws up the exception as well.
  #4  
Old August 2nd, 2005, 06:25 PM
Dennis Lee Bieber
Guest
 
Posts: n/a
Default Re: startfile problems

On Tue, 02 Aug 2005 17:35:27 +1000, Timothy Smith
<timothy@open-networks.net> declaimed the following in comp.lang.python:

[color=blue]
> it's iterally just
>
> PDFname = 'tmp.pdf'
> os.startfile(PDFname)
>
> thats the code.
>[/color]
No "import os"?
And the full traceback?
[color=blue]
> so obviously it contains no errnous characters. see my update btw. it
> actually DOES open the report, but throws up the exception as well.[/color]

Must not have made it to my server yet, assuming it was posted
after my comment.

import os

PDFname = "test.pdf"
os.startfile(PDFname)

No errors if I'm in the directory with the PDF when I execute
the program...

E:\UserData\Dennis Lee Bieber\My Documents>script1.py

E:\UserData\Dennis Lee Bieber\My Documents>python script1.py

E:\UserData\Dennis Lee Bieber\My Documents>



--[color=blue]
> ================================================== ============ <
> wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed@dm.net | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <[/color]
  #5  
Old August 2nd, 2005, 11:45 PM
Timothy Smith
Guest
 
Posts: n/a
Default Re: startfile problems

Dennis Lee Bieber wrote:
[color=blue]
>On Tue, 02 Aug 2005 17:35:27 +1000, Timothy Smith
><timothy@open-networks.net> declaimed the following in comp.lang.python:
>
>
>
>[color=green]
>>it's iterally just
>>
>>PDFname = 'tmp.pdf'
>>os.startfile(PDFname)
>>
>>thats the code.
>>
>>
>>[/color]
> No "import os"?
> And the full traceback?
>
>
>[color=green]
>>so obviously it contains no errnous characters. see my update btw. it
>>actually DOES open the report, but throws up the exception as well.
>>
>>[/color]
>
> Must not have made it to my server yet, assuming it was posted
>after my comment.
>
>import os
>
>PDFname = "test.pdf"
>os.startfile(PDFname)
>
> No errors if I'm in the directory with the PDF when I execute
>the program...
>
>E:\UserData\Dennis Lee Bieber\My Documents>script1.py
>
>E:\UserData\Dennis Lee Bieber\My Documents>python script1.py
>
>E:\UserData\Dennis Lee Bieber\My Documents>
>
>
>
>
>[/color]
yep the program is executed in the same dir as the pdf file. like i said
it actually opens it, but throws up an exception as well.
if i hadn't seen it with my own eyes i wouldn't believe it.
  #6  
Old August 3rd, 2005, 12:55 AM
Michael Hoffman
Guest
 
Posts: n/a
Default Re: startfile problems

Timothy Smith wrote:
[color=blue]
> yep the program is executed in the same dir as the pdf file. like i said
> it actually opens it, but throws up an exception as well.[/color]

You are far more likely to get informed help if you post the traceback
here, as has been suggested twice already.
--
Michael Hoffman
  #7  
Old August 3rd, 2005, 01:05 AM
Timothy Smith
Guest
 
Posts: n/a
Default Re: startfile problems

Michael Hoffman wrote:
[color=blue]
>Timothy Smith wrote:
>
>
>[color=green]
>>yep the program is executed in the same dir as the pdf file. like i said
>>it actually opens it, but throws up an exception as well.
>>
>>[/color]
>
>You are far more likely to get informed help if you post the traceback
>here, as has been suggested twice already.
>
>[/color]
i can't since it's a remote site and i can't reproduce the error. the
best i have is a screen shot.
besdies which the only information it gives is the names and line
numbers of the my py modules, nothing more. the only real info it gives
i have posted already, in my inital post (the last line of it,
WindowsError etc..)

other then that there's no more information to be had. it's a bloody
simple 2 line function, nothing funky about it.
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles