<?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 Why does DLT modify datetime import definition in Data Loading Tools Questions</title>
    <link>https://community.esri.com/t5/data-loading-tools-questions/why-does-dlt-modify-datetime-import-definition/m-p/68162#M2</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The ExecuteDataLoad tool, when run in python at least, appears to overwrite the datetime module imported by import arcpy.&amp;nbsp; This sample code hopefully describes the issue:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy‍

&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; datetime
&lt;SPAN class="comment token"&gt;#import datetime appears to be part of import arcpy&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#but for readability of code, you can include it, though it's redundant&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#even if we exclude "import datetime", the following line shows it imports the module&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#returns &amp;lt;module 'datetime' from 'C:\\...\\ESRI\\conda\\envs\\arcgispro-py3-clone\\lib\\datetime.py'&amp;gt;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#so you can do things like the following:&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;now&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Now lets run the data loading tools&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dlt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ExecuteDataLoad&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;'...\dataloadingworkspace\DataReference.xlsx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#However, after running the ExecuteDataLoad tool, datetime is modified, so now:&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#returns &amp;lt;class 'datetime.datetime'&amp;gt;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#which means the code&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;now&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#that previously worked, suddenly now&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#returns AttributeError: type object 'datetime.datetime' has no attribute 'datetime'‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is, first off, this is confusing as can be, and makes reading/following the code rather confusing that there's an undocumented shift in what is defined as datetime.&amp;nbsp; However, second, and more worrisome, is the fact that I have to assume import arcpy includes an import of datetime for a reason.&amp;nbsp; What I'm getting at is, if arcpy assumes datetime will be the datetime module and calls like datetime.datetime.now() (and others) will work in that specific syntax.&amp;nbsp; Then isn't there a potential that a tool, only callable within arcpy, modifying that core assumption, could cause issues with other parts of arcpy...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I over-thinking this or missing something?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:37:12 GMT</pubDate>
    <dc:creator>DETCOG_GIS</dc:creator>
    <dc:date>2021-12-10T22:37:12Z</dc:date>
    <item>
      <title>Why does DLT modify datetime import definition</title>
      <link>https://community.esri.com/t5/data-loading-tools-questions/why-does-dlt-modify-datetime-import-definition/m-p/68162#M2</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The ExecuteDataLoad tool, when run in python at least, appears to overwrite the datetime module imported by import arcpy.&amp;nbsp; This sample code hopefully describes the issue:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy‍

&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; datetime
&lt;SPAN class="comment token"&gt;#import datetime appears to be part of import arcpy&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#but for readability of code, you can include it, though it's redundant&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#even if we exclude "import datetime", the following line shows it imports the module&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#returns &amp;lt;module 'datetime' from 'C:\\...\\ESRI\\conda\\envs\\arcgispro-py3-clone\\lib\\datetime.py'&amp;gt;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#so you can do things like the following:&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;now&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#Now lets run the data loading tools&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dlt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ExecuteDataLoad&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;'...\dataloadingworkspace\DataReference.xlsx'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#However, after running the ExecuteDataLoad tool, datetime is modified, so now:&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#returns &amp;lt;class 'datetime.datetime'&amp;gt;&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;#which means the code&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;datetime&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;now&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#that previously worked, suddenly now&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#returns AttributeError: type object 'datetime.datetime' has no attribute 'datetime'‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is, first off, this is confusing as can be, and makes reading/following the code rather confusing that there's an undocumented shift in what is defined as datetime.&amp;nbsp; However, second, and more worrisome, is the fact that I have to assume import arcpy includes an import of datetime for a reason.&amp;nbsp; What I'm getting at is, if arcpy assumes datetime will be the datetime module and calls like datetime.datetime.now() (and others) will work in that specific syntax.&amp;nbsp; Then isn't there a potential that a tool, only callable within arcpy, modifying that core assumption, could cause issues with other parts of arcpy...?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I over-thinking this or missing something?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:37:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-loading-tools-questions/why-does-dlt-modify-datetime-import-definition/m-p/68162#M2</guid>
      <dc:creator>DETCOG_GIS</dc:creator>
      <dc:date>2021-12-10T22:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why does DLT modify datetime import definition</title>
      <link>https://community.esri.com/t5/data-loading-tools-questions/why-does-dlt-modify-datetime-import-definition/m-p/68163#M3</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/384149"&gt;John Streeb&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;Thank you for reporting this, our developer will fix this issue for the upcoming release of the tools.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Oct 2020 23:59:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-loading-tools-questions/why-does-dlt-modify-datetime-import-definition/m-p/68163#M3</guid>
      <dc:creator>AlixVezina</dc:creator>
      <dc:date>2020-10-13T23:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why does DLT modify datetime import definition</title>
      <link>https://community.esri.com/t5/data-loading-tools-questions/why-does-dlt-modify-datetime-import-definition/m-p/1037766#M36</link>
      <description>&lt;P&gt;I just ran into this and this appears to go back years, at least as far as &lt;FONT face="courier new,courier"&gt;import arcpy&lt;/FONT&gt; overriding &lt;FONT face="courier new,courier"&gt;datetime&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;See&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/import-arcpy-tramples-datetime-import/m-p/288325" target="_self"&gt;https://community.esri.com/t5/python-questions/import-arcpy-tramples-datetime-import/m-p/288325&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Alix, are you able to tell us what release this is scheduled to be fixed in? I see it's still present in ArcPy shipping with Pro 2.7.x.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 19:18:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/data-loading-tools-questions/why-does-dlt-modify-datetime-import-definition/m-p/1037766#M36</guid>
      <dc:creator>PeterWiringa</dc:creator>
      <dc:date>2021-03-17T19:18:33Z</dc:date>
    </item>
  </channel>
</rss>

