#1
  1. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154

    Problem Detecting Files


    I'm not sure why this is happening, but I can read/write to files but I cannot open them using os.startfile. The following code will add the text in setup.txt to the text control correctly.
    Code:
    for item in file('setup.txt'):
                self.AddText(item)
    Of course it also adds the new line, but that's besides the point. The next piece of code used to open the setup.txt file, however it no longer does, it says that the file does not exist.
    Code:
    os.startfile('setup.txt')
    The os module has been imported (import os).
    Is there any reason for this?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    73
    Rep Power
    11
    Originally Posted by †Yegg†
    I'm not sure why this is happening, but I can read/write to files but I cannot open them using os.startfile. The following code will add the text in setup.txt to the text control correctly.
    Code:
    for item in file('setup.txt'):
                self.AddText(item)
    Of course it also adds the new line, but that's besides the point. The next piece of code used to open the setup.txt file, however it no longer does, it says that the file does not exist.
    Code:
    os.startfile('setup.txt')
    The os module has been imported (import os).
    Is there any reason for this?
    so far your code looks ok, but maybe there's another factor in your code which causes the problem, anyway make sure you're not opening the file in a writing more
  4. #3
  5. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    There doesn't seem to be any other problems with my code. I'll look more into this soon, I still can't figure it out.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Posts
    461
    Rep Power
    25
    well, i am sure someone here would be very willing to help you out. So you can just post your code.
  8. #5
  9. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Actually, I wouldn't be sure what to post. I have a lot of code in my program, and I have no clue what could be causing this problem. Considering the exact same code (atleast I think so) I used a while back that used to work, now no longer works. It remains yet a mystery until I can find what could be causing this to occur.
  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    We should only need the code for the classes you're using and the lines between the first and last piece of code you posted. Maybe you change your working directory somewhere?

    Alternatively you could zip your program up and attach it to this thread; assuming it's not too big.

    Take care,

    Mark.
    programming language development: www.netytan.com Hula

  12. #7
  13. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Dec 2004
    Location
    Meriden, Connecticut
    Posts
    1,797
    Rep Power
    154
    Well, my whole program is one large class, with a ton of functions inside it. Although it is only a little under 2000 lines of code, so it's not that big. The program itself is 85kb, I will go ahead and zip it to send to you. Can you send me your email so I can send it to you? At the moment I can't think of anything place where I can upload it for a download link.
    Edit: I found the attack file area, I'll use that instead.

    Here is the file.
    Last edited by †Yegg†; May 5th, 2005 at 03:31 PM.

IMN logo majestic logo threadwatch logo seochat tools logo