Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access prompt.txt via consistent path #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tomviner
Copy link

Imagine this folder structure:

$ tree
.
├── project
│   └── script.py
└── wolverine
    └── wolverine.py

I'd like to run wolverine.py from within my project folder. But I get:

$ python /tmp/wolverine/wolverine.py script.py
Traceback (most recent call last):
  File "/tmp/wolverine/wolverine.py", line 20, in <module>
    with open("prompt.txt") as f:
         ^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'prompt.txt'

The fix is to calculate the path to prompt.txt relative to wolverine.py.

The allows running in the following way.

cd project
python ../wolverine/wolverine.py script.py

@tomviner tomviner changed the title Access prompt.txt via relative path Access prompt.txt via consistent path Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant