<?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: typeError about wrong type where type isn't relevant in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555804#M43415</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply, but no that doesn't work, as both produce exactly the same list of values for &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;rd&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Feb 2012 11:56:06 GMT</pubDate>
    <dc:creator>MennoNijhuis1</dc:creator>
    <dc:date>2012-02-14T11:56:06Z</dc:date>
    <item>
      <title>typeError about wrong type where type isn't relevant</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555802#M43413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My script below produces the following output and error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;DLB legger_kanaal.gdb L:\20_Productie\versie 0.3\DLB\data\legger_kanaal.gdb vStuw L:\20_Productie\versie 0.3\DLB\data\legger_kanaal.gdb\vStuw Traceback (most recent call last): &amp;nbsp; File "&amp;lt;string&amp;gt;", line 248, in run_nodebug &amp;nbsp; File "C:\Users\nijhm\Desktop\export_kunstwerktabellen.py", line 41, in &amp;lt;module&amp;gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; for kw in kunstwerklist: TypeError: object of type 'dict' has no len()&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've hashed out all but one of the dict items, this has made no difference, neither did shortening the 'kunstwerklist' to one item. Print statements were only added for clearance when debugging.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've fiddled around with the script a little. Before I did that it produced the same error (at the line with &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;fgdb = os.path.join(leggermap,rd,'data',db)&lt;/SPAN&gt;&lt;SPAN&gt;)but traced it also back to ntpath.py (os module) line 96 which does indeed include a len() method, whereas my script doesn't. Also, the input to the os.path.join is in no case a &amp;lt;type 'dict'&amp;gt;, apart from the fact that getting a len() from a dictionary shouldn't be a problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, when reproducing the script step by step in the Python interpreter window (without dictionary or for loops), no error occurs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Most important finding thusfar &lt;/STRONG&gt;&lt;SPAN&gt;(and reason of posting here and not on &lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.esri.com/www.python-forum.org):"&gt;www.python-forum.org):&lt;/A&gt;&lt;SPAN&gt; when hashing out the gp.TableToDBASE_conversion(), the script simply prints as it is instructed to do and does not produce an error!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please reply if you have any ideas of why this might go wrong, or have any other idea of exporting a lot of gdb tables to dbf.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import os, arcgisscripting gp = arcgisscripting.create(9.3)&amp;nbsp; exportmap = r'L:\20_Productie\versie 0.3\Werk\kunstwerktabellen' leggermap = r'L:\20_Productie\versie 0.3'&amp;nbsp; dictType = { ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DIJG":["legger_openwater.gdb"], ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DNB":["legger_kanaal.gdb"], ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DNH":["legger_openwater.gdb","legger_kanaal.gdb"], ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DNN":["legger_openwater.gdb"], ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DON":["legger_kanaal.gdb","legger_rivier.gdb"], &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DLB":["legger_kanaal.gdb","legger_rivier.gdb"], ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DUT":["legger_kanaal.gdb"], ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DZH":["legger_rivier.gdb"], ##&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DZL":["legger_openwater.gdb","legger_kanaal.gdb"] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; ##kunstwerklist = ['vStuw','vSchutsluis','vInUitwateringSluis','vWaterReguleringsWerk','vGemaal'] kunstwerklist = ['vStuw'] exportlist = []&amp;nbsp; for rd in dictType: &amp;nbsp;&amp;nbsp;&amp;nbsp; print rd &amp;nbsp;&amp;nbsp;&amp;nbsp; for db in dictType[rd]: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print db &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fgdb = os.path.join(leggermap,rd,'data',db) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print fgdb &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for kw in kunstwerklist: ## THIS IS LINE 41 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print kw &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; geval = os.path.join(fgdb,kw) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print geval &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.TableToDBASE_conversion(geval,exportmap) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exportlist.append(geval)&amp;nbsp; print exportlist del gp&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;-----&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Pyscripter 2.4.3.0 (but also crashes in IDLE 2.6.5)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ArcGIS Desktop 10.0 SP3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Win7 x64&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 11:31:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555802#M43413</guid>
      <dc:creator>MennoNijhuis1</dc:creator>
      <dc:date>2012-02-14T11:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: typeError about wrong type where type isn't relevant</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555803#M43414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think what you want is instead of &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;for rd in dictType:&lt;/PRE&gt;&lt;SPAN&gt;you should use&lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;for rd in dictType.keys():&lt;/PRE&gt;&lt;SPAN&gt;That will give the for loop a list of all of the keys (unordered of course) of the dictionary.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 11:46:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555803#M43414</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2012-02-14T11:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: typeError about wrong type where type isn't relevant</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555804#M43415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply, but no that doesn't work, as both produce exactly the same list of values for &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;rd&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 11:56:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555804#M43415</guid>
      <dc:creator>MennoNijhuis1</dc:creator>
      <dc:date>2012-02-14T11:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: typeError about wrong type where type isn't relevant</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555805#M43416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't see where you declare the export file name. You might need to your script to something like:&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;gp.TableToDBASE_conversion(geval,os.path.join(exportmap,"name.mdb"))
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:00:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555805#M43416</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2021-12-12T00:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: typeError about wrong type where type isn't relevant</title>
      <link>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555806#M43417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually, that isn't necessary with the TableToDBASE tool, as the output table becomes the same name as the input table. However, I now realize that the input table names may have a name which is too long for a dbf table, which might be the cause of the error. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When looking for abilities to specify the output table's name, I found another tool (TableToTable) with which I am able to copy a GDB table to dbf format as well, without errors, and while specifying the table name for each export.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, still a little strange but I found a workaround. Thanks for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 12:36:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/typeerror-about-wrong-type-where-type-isn-t/m-p/555806#M43417</guid>
      <dc:creator>MennoNijhuis1</dc:creator>
      <dc:date>2012-02-14T12:36:50Z</dc:date>
    </item>
  </channel>
</rss>

