<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Niels,<br>nice to hear from you.<br><br>I'm not sure to get enough informations to help you in an efficient way but let me try. <br><br>It seems that the instance named "gdal" is undefined or not initialized (the "not scriptable" from the error message shall mean that).<br><br>As you experienced the workshop material [1] you probably noticed the specific [env] section of the main.cfg file which let you define any environment variables (on runtime) which are required to run properly your service [2]. So, my first assumption is that maybe your gdal python module is installed in a specific directory or was not found. In such case, you'll have to add the [env] section and then set the PYTHON_PATH variable manualy In there. You can find example on how to setup such variable from the OpenOffice Support page [3].<br><br>Another assumption can be that you use different Python versions from ZOO-Kernel than from command line. Please verify this also. You shall be able to check the Python version used by ZOO-Kernel by running ldd on it.<br><br>Hope to hear from you,<br>Best regards,<br><br>[1] <a href="http://zoo-project.org/trac/wiki/ZooWorkshop/FOSS4GJapan">http://zoo-project.org/trac/wiki/ZooWorkshop/FOSS4GJapan</a><br>[2] <a href="http://zoo-project.org/trac/wiki/ZooWorkshop/FOSS4GJapan/UsingZooFromOSGeoLiveVM#ZOOKernelInstallation">http://zoo-project.org/trac/wiki/ZooWorkshop/FOSS4GJapan/UsingZooFromOSGeoLiveVM#ZOOKernelInstallation</a><br>[3] <a href="http://zoo-project.org/trac/wiki/ZooWebSite/ZooKernel/InstallationUsingOO#ConfigureyourZOOKernel">http://zoo-project.org/trac/wiki/ZooWebSite/ZooKernel/InstallationUsingOO#ConfigureyourZOOKernel</a><br><div><div>Le 10 déc. 2010 à 21:56, niels hoffmann a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>zootribe,</div><div><br></div><div>I've got a question about some raster processing using python.</div><div>The code below works when I run it standalone, but not if I run it as a zoo-service.</div><div>Does anybody have a clue why not?</div>
<div><==========></div><div><div>driver=gdal.GetDriverByName('GTiff')</div><div>driver.Register()</div></div><div>ds=gdal.Open(filename, GA_ReadOnly)</div><div><br></div><div>cols=ds.RasterXSize</div><div>rows=ds.RasterYSize</div>
<div>rain_factor=0.85</div><div><br></div><div>r2arr=ds.GetRasterBand(1).ReadAsArray(0,0,cols, rows).astype(float)</div><div>r2rainfactor=dot(rain_factor,r2arr)</div><div>outputs["Result"]["value"]=str(r2rainfactor[100,100])</div>
<div><=========></div><div><div>TRACE : 'NotImplementedType' object is unsubscriptable</div><div>TRACE : <type 'exceptions.TypeError'></div><div>Unable to run your python process properly</div>
</div><div><br></div><div>So I'm trying to do a numpy scalar*array multiplication with the dot operator, this seems to be working standalone, but not in CGI?</div><div><br></div><div>Cheers, Niels</div>
_______________________________________________<br>Zoo-discuss mailing list<br><a href="mailto:Zoo-discuss@gisws.media.osaka-cu.ac.jp">Zoo-discuss@gisws.media.osaka-cu.ac.jp</a><br>http://gisws.media.osaka-cu.ac.jp/mailman/listinfo/zoo-discuss<br></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><span class="Apple-style-span" style="font-size: 12px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Gérald Fenoy</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="mailto:gerald.fenoy@geolabs.fr"><span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; ">gerald.fenoy@geolabs.fr</span></a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><span class="Apple-style-span" style="font-size: medium;">Just a ZOO Tribe member</span></div></span></div></span></div></body></html>