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

python implementation changes the current working directory #413

Open
cefect opened this issue Jun 1, 2024 · 3 comments
Open

python implementation changes the current working directory #413

cefect opened this issue Jun 1, 2024 · 3 comments

Comments

@cefect
Copy link

cefect commented Jun 1, 2024

calling something like the below seems to change the working directory. This seems like a bad idea (especially without warning the user) as writes to relative file paths don't land as expected. I for one lost some time trying to figure out where my files were going.

pre_working_dir =  os.getcwd()
if not wbt.cost_distance(wse_fp,cost_fp, 
                         os.path.join(out_dir, f'01_outAccum.tif'),
                         backlink_fp) == 0:
    raise IOError('cost_distance')

assert pre_working_dir==os.getcwd(), 'directory changed unexpectedly'

@giswqs
Copy link
Contributor

giswqs commented Jun 1, 2024

Are you using the whitebox-Python package? If yes, please report the issue at https://github.com/opengeos/whitebox-python

@cefect
Copy link
Author

cefect commented Jun 2, 2024

I don't think so... I'm using the methods here. Should I be using the opengeos repo? What is the difference?

@giswqs
Copy link
Contributor

giswqs commented Jun 2, 2024

I see. That seems a WBT backend issue. You are right reporting it here

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

No branches or pull requests

2 participants