<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Import Toolbox Problem with &amp;quot;umlaute&amp;quot; in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539583#M42184</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This error has nothing to do with the toolbox, and everything to do with the python code, and the data it's reading. It is a pretty common problem among people that haven't yet grasped unicode and encodings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The # -*- coding-comment at the first line tells the interpreter in which encoding the source code is saved. This might be related to the problem if the source contains non-ascii characters in string literals. But I suspect the problem lies in the source code somewhere, but it's impossible to say without seing relevant code and the complete traceback.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A very good link to read up on unicode and encodings: &lt;/SPAN&gt;&lt;A href="http://www.joelonsoftware.com/articles/Unicode.html"&gt;http://www.joelonsoftware.com/articles/Unicode.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And here is some more specific information about unicode in python:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://farmdev.com/talks/unicode/"&gt;http://farmdev.com/talks/unicode/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Jan 2011 06:05:46 GMT</pubDate>
    <dc:creator>NiklasNorrthon</dc:creator>
    <dc:date>2011-01-17T06:05:46Z</dc:date>
    <item>
      <title>Import Toolbox Problem with &amp;quot;umlaute&amp;quot;</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539580#M42181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i would like to Import a Toolbox into my Python Script to use some of the functions from the Toolbox. The Problem is that I get the following error-message:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;type 'exceptions.UnicodeEncodeError'&amp;gt;: 'ascii' codec can't encode character u'\xfc' in position 9: ordinal not in range(128)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I gues the reason is, that some of the functions in the called Toolbox uses "Umlaute" in the naming. I tried to set the coding like this in my python script:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# -*- coding: iso-8859-15 -*-&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but nothing changed. Does someone knows a way to Import a Toolbox in Python with "Umlaute"? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tanks for helping.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Karin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 13:58:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539580#M42181</guid>
      <dc:creator>karinweixler</dc:creator>
      <dc:date>2011-01-14T13:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Import Toolbox Problem with "umlaute"</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539581#M42182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try adding at the top of your imports&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# -*- coding: cp1252 -*-

# Some other code


# Some simple example
print "ä"
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was able to use the 'import script' successfully at v10 sp1 after I added this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:24:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539581#M42182</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2021-12-11T23:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Import Toolbox Problem with "umlaute"</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539582#M42183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your reply. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately this is not working with the Toolbox i like to import. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I also have installed AG 10 with ServicePack 1. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Do i have to consider something else? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Karin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 05:51:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539582#M42183</guid>
      <dc:creator>karinweixler</dc:creator>
      <dc:date>2011-01-17T05:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Import Toolbox Problem with "umlaute"</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539583#M42184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This error has nothing to do with the toolbox, and everything to do with the python code, and the data it's reading. It is a pretty common problem among people that haven't yet grasped unicode and encodings.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The # -*- coding-comment at the first line tells the interpreter in which encoding the source code is saved. This might be related to the problem if the source contains non-ascii characters in string literals. But I suspect the problem lies in the source code somewhere, but it's impossible to say without seing relevant code and the complete traceback.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A very good link to read up on unicode and encodings: &lt;/SPAN&gt;&lt;A href="http://www.joelonsoftware.com/articles/Unicode.html"&gt;http://www.joelonsoftware.com/articles/Unicode.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And here is some more specific information about unicode in python:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://farmdev.com/talks/unicode/"&gt;http://farmdev.com/talks/unicode/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 06:05:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539583#M42184</guid>
      <dc:creator>NiklasNorrthon</dc:creator>
      <dc:date>2011-01-17T06:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Import Toolbox Problem with "umlaute"</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539584#M42185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the hints and links. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If i have understand it correct, i have to know in which coding the toolbox was saved? But where and how do i tell python what encoding to use when importing the toolbox?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Karin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 07:27:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539584#M42185</guid>
      <dc:creator>karinweixler</dc:creator>
      <dc:date>2011-01-17T07:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Import Toolbox Problem with "umlaute"</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539585#M42186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The toolbox is a container for system tools, script tools, models and toolsets. It's a binary ArcGIS file, and has nothing to do with the error message from the python interpreter.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you need to know, is which encoding your python script is stored in, and if that is different from ascii, it should say so in the special coding comment in the script's first line. And you need to know the encoding of all data that you read or write.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 09:01:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539585#M42186</guid>
      <dc:creator>NiklasNorrthon</dc:creator>
      <dc:date>2011-01-17T09:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Import Toolbox Problem with "umlaute"</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539586#M42187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok. But the thing is that the error occur at the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox(&amp;lt;Toolboxname&amp;gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And the reason is that some of the modelnames in the toolbox are with umlaute. And i thought that this information (the models name and label) is saved in the toolbox? I can not change the names of the models, because it is not my toolbox.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 10:36:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539586#M42187</guid>
      <dc:creator>karinweixler</dc:creator>
      <dc:date>2011-01-17T10:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Import Toolbox Problem with "umlaute"</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539587#M42188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does the path to the toolbox name (including the its path) contain non-ascii characters?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If not: Can you reproduce the error with this two-liner:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.ImportToolbox(&amp;lt;Toolboxname&amp;gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If so it's definitly an arcpy bug, and should be reported to esri. I can't think of a workaround right now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 13:30:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539587#M42188</guid>
      <dc:creator>NiklasNorrthon</dc:creator>
      <dc:date>2011-01-17T13:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Import Toolbox Problem with "umlaute"</title>
      <link>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539588#M42189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No the path to the Toolbox does not contain non-ascii characters. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And Yes i can reproduce the error only with the 2-line code. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I also testet to import the Toolbox when i delete all the models with umlaute-name. Then it worked. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So unfortunally it looks like an arcpy.bug. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for helping and making the coding thing more clear!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jan 2011 14:07:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/import-toolbox-problem-with-amp-quot-umlaute-amp/m-p/539588#M42189</guid>
      <dc:creator>karinweixler</dc:creator>
      <dc:date>2011-01-17T14:07:30Z</dc:date>
    </item>
  </channel>
</rss>

