nakijun / tilers-tools

Automatically exported from code.google.com/p/tilers-tools
1 stars 0 forks source link

char const * fix #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. map2gdal.py --cut-file <FILE>.KAP

*or any script that uses reader_backend.py

What is the expected output? What do you see instead?
expected <FILE>.gmt

Got:
File "/home/will/bsbTileTools/tilers_tools/reader_backend.py", line 187, in 
__init__
    self.raster_ds = gdal.Open(self.img_file,GA_ReadOnly)
TypeError: in method 'Open', argument 1 of type 'char const *'
Exception AttributeError: 'raster_ds' in <bound method BsbLayer.__del__ of 
<reader_bsb.BsbLayer object at 0x7f1d4433ec90>> ignored

What version of the product are you using?

hg pull from October 4

What was the operating system?

Ubuntu Linux  11.10 / Gdal 1.7.3-5ubuntu1
*(Windows not effected)

Please provide any additional information below.

Simple fix...

line 185 in reader_backend.py
-self.img_file=self.get_raster()
+self.img_file=str(self.get_raster())

Original issue reported on code.google.com by manim...@gmail.com on 10 Oct 2011 at 2:35

GoogleCodeExporter commented 9 years ago
It seems the Gdal 1.7.3 does not Unicode string as a file name (no problem with 
gdal 1.8.0).

The fix could actually look something like:

diff -r 3801c135928d tilers_tools/reader_backend.py
--- a/tilers_tools/reader_backend.py    Tue Oct 11 09:35:02 2011 +0300
+++ b/tilers_tools/reader_backend.py    Tue Oct 11 11:45:09 2011 +0300
@@ -209,7 +209,7 @@

         self.img_file=self.get_raster()
         logging.info(' %s : %s (%s)' % (self.map.file,self.name,self.img_file))
-        self.raster_ds = gdal.Open(self.img_file,GA_ReadOnly)
+        self.raster_ds = 
gdal.Open(self.img_file.encode(locale.getpreferredencoding()),GA_ReadOnly)

         self.dtm=None
         self.refs=self.get_refs()           # fetch reference points

Original comment by vadp.d...@gmail.com on 11 Oct 2011 at 8:45

GoogleCodeExporter commented 9 years ago
The fix pushed into the rep

Original comment by vadp.d...@gmail.com on 11 Oct 2011 at 8:49