SilentSys / orhelper

orhelper is a module which aims to facilitate interacting and scripting with OpenRocket from Python
GNU General Public License v2.0
16 stars 17 forks source link

Change simple.ork load location in examples #6

Open SiboVG opened 2 years ago

SiboVG commented 2 years ago

As a complete noob to orhelper, I had some trouble getting just a basic example script to work, I kept getting a 'FileNotFoundError' for the design file. The problem was that the example files take 'examples/simple.ork' as the default location for the .ork file, but if I run the script, that is already inside the examples-directory, the script looked for simple.ork inside 'examples/examples.ork' which just threw the exception.

So I just removed the extra examples-directory reference so that the example files look for simple.ork inside their relative directory, which is already the examples-directory.

Note: again, I have close to zero experience with orhelper, so I'm sorry if this is a bogus PR.

SiboVG commented 2 years ago

@SilentSys does this PR make any sense?

SilentSys commented 2 years ago

Sorry for the delay.

I'm assuming you were running the examples with OrHelper installed through pip?

If I remember correctly, the reasoning for this was to allow people to clone the repo, make changes, and run the examples using the cloned OrHelper. In this case, you are not able to run from within the examples directory because python can't recognize modules from parent directories.

I agree that this can be unintuitive to people who have OrHelper installed and are just trying to run the examples. So maybe the ideal solution involves using something like os.path.dirname(__file__) to always get the correct path in all use cases.

SiboVG commented 1 year ago

Sorry @SilentSys I really lost track of this. The file locations in the other two files should be fixed now.

SiboVG commented 6 months ago

@SilentSys care to merge this change?