jblindsay / whitebox-tools

An advanced geospatial data analysis platform
https://www.whiteboxgeo.com/
MIT License
919 stars 161 forks source link

python implementation changes the current working directory #413

Open cefect opened 1 month ago

cefect commented 1 month ago

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 commented 1 month ago

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

cefect commented 1 month ago

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

giswqs commented 1 month ago

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