esheldon / esutil

A variety of python utilities focusing on numerical, scientific, and astrophysical computing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

htm match expects ascii names for matchfile; fails silently for unicode names

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?

matchfile = u'filename'
h = eu.htm.HTM(8)
h.match(lenses['RA'], lenses['DEC'], shapes[config['shape_ra_key']], 
shapes[config['shape_dec_key']], maxrange, maxmatch=-1, file=matchfile)

What is the expected output? What do you see instead?

No matchfile is created, no error/warning message is throw. Unicode names are 
returned by some of python filesystem function, in this case glob, which cause 
the code to fail working properly.

What version of the product are you using? On what operating system?

esutil 0.5.1 on Linux with python 2.7.3

Original issue reported on code.google.com by peter.m....@gmail.com on 6 Dec 2014 at 6:39

Yes, this is because I'm checking for a python string in the c++ code. I need 
to do something smarter.

Original comment by erin.sheldon@gmail.com on 6 Dec 2014 at 8:35

It doesn't have to be much smarter, but a warning message would help.

Original comment by peter.m....@gmail.com on 6 Dec 2014 at 8:47

in the mean time you can call the code with str(filename) and it should work.

Original comment by erin.sheldon@gmail.com on 6 Dec 2014 at 8:47

In the trunk I've added a warning, and converted unicode to string.

In the longer term, need to deal properly with wide chars at the C++ level

Original comment by erin.sheldon@gmail.com on 9 Dec 2014 at 8:30