The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.

NodeBox 1ArchiveFrom the old forum

Python can't read the file

3 replies Last reply

  1. I try to open the text file as I follow the Str tutorial.
    str = open("joy.txt").read()

    fill(0.2)
    rect(0,0,WIDTH, HEIGHT)

    fill(1)

    font("Helvetica", 13)
    text("Heading", 20, 30)

    However I've got this error:
    Traceback (most recent call last):
    File "/Users/Joy/Documents/NodeBox/NodeBox.app/Contents/Resources/python/nodebox/gui/mac/init.py", line 361, in _execScript
    exec self._code in self.namespace
    File "<untitled>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: 'joy.txt'

    I use Nodebox Version 1.9.7rc1 (1) on OSX 10.11.3

    Thank you.

    Copy link
  2. NodeBox team

    Hi Joy,

    This can happen when your NodeBox file is not saved yet.

    NodeBox looks for files relative to the current .py file. However, if you haven't saved your file first, NodeBox doesn't know where to look. Try saving the script first, then placing the txt file in the same folder as the script.

    Best,

    F

    Copy link
  3. Hi Frederik,

    Thank you. I have saved the file and change the path to '/Users/Joy/Documents/NodeBox/sandbox/joy.txt'
    And it works now.

    Best,

    Joy

    Copy link
  4. NodeBox team

    I just checked and it isn't mentioned anywhere in the documentation, so it would be very hard for you to just know that :-)

    I'll see if I can update it.

    Copy link

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply