atom-community / atom-community/atom-script

Relative path referencing error

Open
#223 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
730
Forks
264
PR merge metrics
No merged PRs in 30d

Description

I'm having this problem with Python (I havn't tried this with different languages). When referring to another file inside the source and running the script, there is an error where the file cannot be found. It seems to be that the program is looking for the file in relation to the base directory you are working from in Atom rather than in relation to the location of the source file.
#### e.g. We have:
- base\src\main.py
- base\img\image.png

Inside main.py we want to load an image, so you would think that we could refer to the image as "..\img\image.png". But because we are in the base directory in Atom, this causes an error. This isn't due to an error in the code from the Python script.
#### Ways around problem:
- Change the Atom working directory to be the same as the source file (so in the example above, we would change the working directory to src)
- Refer to the image in relation to the current working directory (definitely not recommended, since this is an error in coding)
- Refer to the image using its full path (also not recommended since the path will likely change when distributed)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.