[Solved] dae2egg and unicode


In my application I’m trying to convert COLLADA files to EGG files using dae2egg, this way:

dae2egg = self.paths['urban_resource_folder'] / 'bin' / 'dae2egg.exe'
subprocess.call('%s -noexist -tbnall -o "%s" "%s"' % (dae2egg, egg_path, temp_collada_path))

My issue is that it is failing with path that contains unicode characters like French accent “é”.
With the original input path:


I tried the following:


but none of those is working, I get an error:

Cannot find input file /c/Users/David/Documents/Projets/COLLADA/Boucli├â┬®.dae

But what surprises me is that it is working from a command shell:

C:\Users\David\Documents\Projets\COLLADA>dae2egg Bouclié.dae jojo.egg

Reading BoucliÚ.dae
Writing jojo.egg

Any idea what I should input in the subprocess call to make it work?

Thanks in advance


cmd_line = '%s -noexist -tbnall -o "%s" "%s"' % (dae2egg, egg_path, temp_collada_path)

But now it’s failing in the loadModel, see this post:
[url]loader.loadModel and unicode]

Any chance to see this fixed?
For now I still use the DOS 8.3 trick, and it works.

For those who would need the code:

path = os.path.normpath(path)
import win32api
path = win32api.GetShortPathName(path) #convert to DOS 8.3 for loadModel for instance
return Filename.fromOsSpecific(path).getFullpath()


Note that you can also use Filename.toOsShortName() to do the same trick without win32api. But I’m not sure what encoding subprocess requires.