{{{
ERROR 1: TIFFOpen:D:\UMBE\PhD\Nepal\khumbu_article\shadow
_sun_hourly\prova_hourly_shadow\prova1.tif: No error
Using GDAL data type <Byte>
ERROR: Impossibile creare il dataset
<D:\UMBE\PhD\Nepal\khumbu_article\shadow
_sun_hourly\prova_hourly_shadow\prova1.tif> usando il driver <GTiff>
Traceback (most recent call last):
File "D:\UMBE\PhD\Nepal\khumbu_article\shadow\r_sun_hourly
\prova_r-sun-hourly.py", line 39, in <module>
nodata=255)
File "C:\OSGeo4W\apps\grass\grass-7.0.0\etc\python\grass\s
cript\core.py", line 375, in run_command
return handle_errors(returncode, returncode, args,
kwargs)
File "C:\OSGeo4W\apps\grass\grass-7.0.0\etc\python\grass\s
cript\core.py", line 310, in handle_errors
returncode=returncode)
grass.exceptions.CalledModuleError: Module run None
['r.out.gdal', '-c', 'output=D:\\UMBE\\PhD\\Nepal\\khumbu_ar
ticle\\shadow\r_sun_hourly\\prova_hourly_shadow\\prova1.tif'
, 'nodata=255', 'type=Byte', 'input=prova1'] ended with
error
Process ended with non-zero return code 1. See errors in the
(error) output.
}}}
Anyway, if I use the same call from the command line (not calling the Python
script) I have my "prova1.tif" written correctly in the folder I chose. Why?
Any guess?
{{{
ERROR 1: TIFFOpen:D:\UMBE\PhD\Nepal\khumbu_article\shadow
_sun_hourly\prova_hourly_shadow\prova1.tif: No error
Using GDAL data type <Byte>
ERROR: Impossibile creare il dataset
<D:\UMBE\PhD\Nepal\khumbu_article\shadow
_sun_hourly\prova_hourly_shadow\prova1.tif> usando il driver <GTiff>
Traceback (most recent call last):
File "D:\UMBE\PhD\Nepal\khumbu_article\shadow\r_sun_hourly
\prova_r-sun-hourly.py", line 39, in <module>
nodata=255)
File "C:\OSGeo4W\apps\grass\grass-7.0.0\etc\python\grass\s
cript\core.py", line 375, in run_command
return handle_errors(returncode, returncode, args,
kwargs)
File "C:\OSGeo4W\apps\grass\grass-7.0.0\etc\python\grass\s
cript\core.py", line 310, in handle_errors
returncode=returncode)
grass.exceptions.CalledModuleError: Module run None
['r.out.gdal', '-c', 'output=D:\\UMBE\\PhD\\Nepal\\khumbu_ar
ticle\\shadow\r_sun_hourly\\prova_hourly_shadow\\prova1.tif'
, 'nodata=255', 'type=Byte', 'input=prova1'] ended with
error
Process ended with non-zero return code 1. See errors in the
(error) output.
}}}
Anyway, if I use the same call from the command line (not calling the Python
script) I have my "prova1.tif" written correctly in the folder I chose. Why?
Any guess?
I think you're somehow getting a newline character into the output path. See below.
Try using the native python os.path.join(...) to create an output variable and avoid any use of string concatenation within the run_command statement (including the input varialbe)
On 04/07/2015 12:00 PM, umberto.minora wrote:
I am using "r.out.gdal" function within a Python script through the command
console of grass7.
I am calling it by doing:
{{{
ERROR 1: TIFFOpen:D:\UMBE\PhD\Nepal\khumbu_article\shadow
_sun_hourly\prova_hourly_shadow\prova1.tif: No error
Using GDAL data type <Byte>
ERROR: Impossibile creare il dataset
<D:\UMBE\PhD\Nepal\khumbu_article\shadow
_sun_hourly\prova_hourly_shadow\prova1.tif> usando il driver <GTiff>
Traceback (most recent call last):
File "D:\UMBE\PhD\Nepal\khumbu_article\shadow\r_sun_hourly
\prova_r-sun-hourly.py", line 39, in <module>
nodata=255)
File "C:\OSGeo4W\apps\grass\grass-7.0.0\etc\python\grass\s
cript\core.py", line 375, in run_command
return handle_errors(returncode, returncode, args,
kwargs)
File "C:\OSGeo4W\apps\grass\grass-7.0.0\etc\python\grass\s
cript\core.py", line 310, in handle_errors
returncode=returncode)
grass.exceptions.CalledModuleError: Module run None
['r.out.gdal', '-c', 'output=D:\\UMBE\\PhD\\Nepal\\khumbu_ar
ticle\\shadow\r_sun_hourly\\prova_hourly_shadow\\prova1.tif'
------------------^^^--------------------------------------------
Note the '\r' between shadow and _sun
, 'nodata=255', 'type=Byte', 'input=prova1'] ended with
error
Process ended with non-zero return code 1. See errors in the
(error) output.
}}}
Anyway, if I use the same call from the command line (not calling the Python
script) I have my "prova1.tif" written correctly in the folder I chose. Why?
Any guess?
Thank you so much. Indeed, the problem were those slashes.
Now I am using this line of code as suggested (with a slight addition
("os.sep") to make it work on a Windows machine):
Thank you so much. Indeed, the problem were those slashes.
Now I am using this line of code as suggested (with a slight addition
("os.sep") to make it work on a Windows machine):