startfile problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Timothy Smith

    #1

    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
  • Dennis Lee Bieber

    #2
    Re: startfile problems

    On Tue, 02 Aug 2005 15:10:23 +1000, Timothy Smith
    <timothy@open-networks.net> declaimed the following in comp.lang.pytho n:
    [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\someth ing.pdf" #bad, this is
    # c:<tab>emp\some thing.pdf
    # assuming \s isn't some special character

    fid = r"c:\temp\somet hing.pdf" #good
    fid = "c:\\temp\\some thing.pds" #okay

    --[color=blue]
    > =============== =============== =============== =============== == <
    > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
    > wulfraed@dm.net | Bestiaria Support Staff <
    > =============== =============== =============== =============== == <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

    Comment

    • Timothy Smith

      #3
      Re: startfile problems

      Dennis Lee Bieber wrote:
      [color=blue]
      >On Tue, 02 Aug 2005 15:10:23 +1000, Timothy Smith
      ><timothy@ope n-networks.net> declaimed the following in comp.lang.pytho n:
      >
      >
      >[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\someth ing.pdf" #bad, this is
      ># c:<tab>emp\some thing.pdf
      ># assuming \s isn't some special character
      >
      >fid = r"c:\temp\somet hing.pdf" #good
      >fid = "c:\\temp\\some thing.pds" #okay
      >
      >
      >[/color]
      it's iterally just

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

      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.

      Comment

      • Dennis Lee Bieber

        #4
        Re: startfile problems

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

        [color=blue]
        > it's iterally just
        >
        > PDFname = 'tmp.pdf'
        > os.startfile(PD Fname)
        >
        > 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(PD Fname)

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

        E:\UserData\Den nis Lee Bieber\My Documents>scrip t1.py

        E:\UserData\Den nis Lee Bieber\My Documents>pytho n script1.py

        E:\UserData\Den nis Lee Bieber\My Documents>



        --[color=blue]
        > =============== =============== =============== =============== == <
        > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
        > wulfraed@dm.net | Bestiaria Support Staff <
        > =============== =============== =============== =============== == <
        > Home Page: <http://www.dm.net/~wulfraed/> <
        > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

        Comment

        • Timothy Smith

          #5
          Re: startfile problems

          Dennis Lee Bieber wrote:
          [color=blue]
          >On Tue, 02 Aug 2005 17:35:27 +1000, Timothy Smith
          ><timothy@ope n-networks.net> declaimed the following in comp.lang.pytho n:
          >
          >
          >
          >[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(P DFname)
          >
          > No errors if I'm in the directory with the PDF when I execute
          >the program...
          >
          >E:\UserData\De nnis Lee Bieber\My Documents>scrip t1.py
          >
          >E:\UserData\De nnis Lee Bieber\My Documents>pytho n script1.py
          >
          >E:\UserData\De nnis 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.

          Comment

          • Michael Hoffman

            #6
            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

            Comment

            • Timothy Smith

              #7
              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.

              Comment

              Working...