udvlpr / alembic

Automatically exported from code.google.com/p/alembic
Other
0 stars 0 forks source link

PyAlembic I/OArchive constructors do not accept unicode strings for filename #316

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

>>> import alembic
>>> alembic.Abc.OArchive(ur'C:\1\myabc.abc')

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

I would expect it to support unicode strings in addition to byte strings

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

Windows7 x64 ultimate
PyAlembic-1.5.0.win-amd64-py2.7.exe

I am using the most recent binaries for alembic and boost available here:
http://www.lfd.uci.edu/~gohlke/pythonlibs

Original issue reported on code.google.com by 007bren...@gmail.com on 19 Sep 2013 at 3:06

GoogleCodeExporter commented 9 years ago
forgot to include the traceback:

Boost.Python.ArgumentError: Python argument types in
    IArchive.__init__(IArchive, unicode)
did not match C++ signature:
    __init__(class boost::python::api::object, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > fileName)

Original comment by 007bren...@gmail.com on 19 Sep 2013 at 3:07

GoogleCodeExporter commented 9 years ago

Original comment by miller.lucas on 19 Sep 2013 at 8:15

GoogleCodeExporter commented 9 years ago

Original comment by miller.lucas on 19 Sep 2013 at 8:15

GoogleCodeExporter commented 9 years ago
User should encode filename to proper filesystem bytes (string), like  
`open(u'ыыыы'.encode(sys.getfilesystemencoding()))`

Or custom converter should be implemented in python bindings.

I think this page 
https://wiki.python.org/moin/boost.python/EmbeddingPython#Working_with_Unicode

And something like 
https://github.com/sopvop/ptex-tools/blob/master/src/ptex_utils/py_ptx_utils.cpp
#L5 for python2 (python3 has PyUnicode_FSConverter) should be useful for 
implementing this.

Original comment by sop...@gmail.com on 27 Aug 2014 at 8:00