TransWikia.com

Using Accented character in ArcPy

Geographic Information Systems Asked by Mahfoud B. on May 8, 2021

I am trying to export a map using Python/ArcPy script. The problem that the title of the exported map containts somthing like “A(c)” instead of the accent “é” I wrote. The date (dt) is printed (in french) with no problem.
This part of my scripts looks like:

    txt1="Densité  n"+ dt
    elmts[1].text=txt1

I am using Python 2.7, ArcGIS 10.2, Notepad++ as text editor and pythonWin IDE.

enter image description here

One Answer

The "é" characters that appeared in the exported map instead of the accented char "é" that I want, came from the change of the written script itself not in the way PythonWin compilate the code. I scripted my code using Notepad++ and the concerned part of the code was written like this:

Rtxt1="Densité  n"+ dt
elmts[1].text=txt1

But when I tried to open th script and run it under PythonWin I found that it was changed to:

Rtxt1="Densité  n"+ dt
elmts[1].text=txt1

So I changed it back to "é" in the PythonWin editor, run the script and it worked with no problem. I don't really know what exactly happen when going from Notepad++ to PythonWin but I think they don't treat accented chacters in the same way.

Answered by Mahfoud B. on May 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP