Thread: IOError?

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Posts
    52
    Rep Power
    13

    IOError?


    Hi, I am receiving an IOError (2) when I try to open() or file(). I have reinstalled Python but cannot remedy this issue. Python says it can't find the file even though the file I am trying to open is in the script's working directory. Thanks.
    Ryan
  2. #2
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Scripts working directory? As far as i know Python doesn't have a directory called this so, this will mean nothing to Python, try typing the full path to the file and see if that helps. You may also want to check your current working directory using os.getcwd()

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

  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Posts
    52
    Rep Power
    13
    Right, by 'working directory' I meant the CWD....which shows as the directory where both the script and file reside...
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Sorry i totaly misunderstood you there . Anyway, maybe you could post some code. Also, what playform and version of Python are you using.

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

  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Posts
    52
    Rep Power
    13
    Well....anything with the file or open function just fails...

    x = file('something.txt', 'r')

    y = open('blah.dat', 'r')

    ...both give IOError [2]
  10. #6
  11. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Ok, but what OS and Python version are you running. Also, did you try using the full path to the file?
    programming language development: www.netytan.com Hula

  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Posts
    52
    Rep Power
    13
    Nevermind...the 'problem' (as it wasn't) was solved. Thank you and sorry for the time.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    Houston, TX
    Posts
    383
    Rep Power
    13
    What was the non-problem?
    Debian - because life's too short for worrying.
    Best. (Python.) IRC bot. ever.
  16. #9
  17. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Really, that was what i was wondering .
    programming language development: www.netytan.com Hula


IMN logo majestic logo threadwatch logo seochat tools logo