Running ConditionalEvaluation requires manual Whitebox library folder permissions change
MarcusChMa opened this issue · comments
whitebox
version: 2.1.1- Python version: 3.9.10
- Operating System: Ubuntu 20.04 under Windows WSL2
Description
Running the ConditionalEvaluation
tool (also applies to RasterCalculator
as per jblindsay/whitebox-tools#202) requires a manual permission change on the whitebox
library folders and files. Without this, the tool crashes and throws a denied permissions exception.
When WBT executables are downloaded upon the first import whitebox
, some permissions are rw-r--r--
(644), other are rwxr-xr-x
(755). Changing all the whitebox/
folder, subfolders and files to rwxr-xr-x
allowed the tool to run properly.
What I Did
import whitebox
wbt = whitebox.WhiteboxTools()
wbt.conditional_evaluation(
i = "/path/to/raster/input.tif",
output = "/path/to/raster/output.tif",
statement = "'value >= 3'",
true = 1,
false = "nodata"
)
>>> ./whitebox_tools --run="ConditionalEvaluation" --input='/path/to/raster/input.tif' --statement='value >= 3' --true='1' --false='nodata' --output='/path/to/raster/output.tif'
>>> thread 'main' panicked at 'failed to execute process: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', whitebox-tools-app/src/tools/mod.rs:1264:26
>>> note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
>>> 0
Permissions change on the whitebox library folder and files, in your Python environment folder:
chmod -R 755 /path_to_conda_env/lib/python3.9/site-packages/whitebox/
wbt.conditional_evaluation(
i = "/path/to/raster/input.tif",
output = "/path/to/raster/output.tif",
statement = "'value >= 3'",
true = 1,
false = "nodata"
)
>>> ./whitebox_tools --run="ConditionalEvaluation" --input='/path/to/raster/input.tif' --statement='value >= 3' --true='1' --false='nodata' --output='/path/to/raster/output.tif'
>>> (Tool runs normally).
Thank you for reporting. I just committed code to fix the permission issue. Please update the package and try again.
pip install git+https://github.com/giswqs/whitebox-python.git
A new version has been released to PyPI.
pip install -U whitebox