<?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: Breaking time in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774841#M876</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strange too&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image" height="390" src="https://community.esri.com/legacyfs/online/424971_timefail2.png" width="637" /&gt;&lt;/P&gt;&lt;P&gt;even in jupyter console and spyder&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 jive-image" height="430" src="https://community.esri.com/legacyfs/online/424972_timefail.png" width="585" /&gt;&lt;/P&gt;&lt;P&gt;I read somewhere that the time namespace gets reassigned, but I can't put my hand on it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 22 Oct 2018 13:27:01 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2018-10-22T13:27:01Z</dc:date>
    <item>
      <title>Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774834#M869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, it seems importing the GIS breaks a former &lt;STRONG&gt;&lt;CODE&gt;from time import time&lt;/CODE&gt;&lt;/STRONG&gt; import as demonstrated in the following example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;IMG alt="Code sample" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/421711_time_snip_20180912084904.png" /&gt;&lt;/P&gt;&lt;P&gt;Switching the imports works, but it's not intuitive, and neither very PEP 8.&lt;/P&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;It seems time.sleep() is the only function from the time module that are used in the API, and it is only used twice, in Item.export() and Item._check_publish_status().&lt;/DIV&gt;&lt;DIV&gt;Still, there are three instances of &lt;STRONG&gt;&lt;CODE&gt;import time&lt;/CODE&gt;&lt;/STRONG&gt; scattered around in the __init__.py file. Wouldn't it be better to narrow the import to a &lt;CODE&gt;&lt;STRONG&gt;from time import sleep&lt;/STRONG&gt;&lt;/CODE&gt; in the imports at top of the file?&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 07:01:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774834#M869</guid>
      <dc:creator>HåkonDreyer</dc:creator>
      <dc:date>2018-09-12T07:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774835#M870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might want to post this on GitHub as well&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-python-api" title="https://github.com/Esri/arcgis-python-api"&gt;GitHub - Esri/arcgis-python-api: Documentation and samples for ArcGIS API for Python&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 10:51:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774835#M870</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-09-12T10:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774836#M871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guess I could, but the take from&amp;nbsp;&lt;A href="https://community.esri.com/thread/215973"&gt;What is the preferred way to report found bugs in the Python API?&lt;/A&gt; and&amp;nbsp;&lt;A href="https://community.esri.com/thread/196929-geonet-or-github-for-technical-questions-about-api"&gt;https://community.esri.com/thread/196929-geonet-or-github-for-technical-questions-about-api&lt;/A&gt; was that GeoNet was the preferred channel for this kind of reports.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 11:24:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774836#M871</guid>
      <dc:creator>HåkonDreyer</dc:creator>
      <dc:date>2018-09-12T11:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774837#M872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, but it is nice to see it on GitHub as well for those that don't travel geonet&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 12:44:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774837#M872</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-09-12T12:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774838#M873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am unable to reproduce it with v1.5. What version of the Python API are you using?&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/424970_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2018 12:51:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774838#M873</guid>
      <dc:creator>RohitSingh2</dc:creator>
      <dc:date>2018-10-22T12:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774839#M874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strange, I'm on 1.5.&amp;nbsp;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/424973_snip_20181022150004.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2018 13:00:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774839#M874</guid>
      <dc:creator>HåkonDreyer</dc:creator>
      <dc:date>2018-10-22T13:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774840#M875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But then, when testing in an environment &lt;STRONG&gt;not&lt;/STRONG&gt; cloned from Pro it works…&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/424975_snip_20181022151541.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2018 13:22:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774840#M875</guid>
      <dc:creator>HåkonDreyer</dc:creator>
      <dc:date>2018-10-22T13:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774841#M876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Strange too&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image" height="390" src="https://community.esri.com/legacyfs/online/424971_timefail2.png" width="637" /&gt;&lt;/P&gt;&lt;P&gt;even in jupyter console and spyder&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 jive-image" height="430" src="https://community.esri.com/legacyfs/online/424972_timefail.png" width="585" /&gt;&lt;/P&gt;&lt;P&gt;I read somewhere that the time namespace gets reassigned, but I can't put my hand on it&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2018 13:27:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774841#M876</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-10-22T13:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774842#M877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this is more of an ArcPy issue than an ArcGIS API for Python issue, but it becomes an issue for the latter when the former is imported.&amp;nbsp; If you import ArcPy first (&lt;EM&gt;not suggesting it as a workflow/workaround, just for testing&lt;/EM&gt;), then importing from arcgis.gis doesn't clobber your time import.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;(arcgis-py3) C:\Users\user\AppData\Local\ESRI\conda\envs\arcgis-py3&amp;gt;python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; from time import time
&amp;gt;&amp;gt;&amp;gt; type(time)
&amp;lt;class 'builtin_function_or_method'&amp;gt;
&amp;gt;&amp;gt;&amp;gt; import arcpy
&amp;gt;&amp;gt;&amp;gt; type(time)
&amp;lt;class 'module'&amp;gt;
&amp;gt;&amp;gt;&amp;gt; from time import time
&amp;gt;&amp;gt;&amp;gt; type(time)
&amp;lt;class 'builtin_function_or_method'&amp;gt;
&amp;gt;&amp;gt;&amp;gt; from arcgis.gis import GIS
&amp;gt;&amp;gt;&amp;gt; type(time)
&amp;lt;class 'builtin_function_or_method'&amp;gt;
&amp;gt;&amp;gt;&amp;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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately, importing from &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;datetime&lt;/SPAN&gt; and &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;time&lt;/SPAN&gt; can be tricky since the modules contain classes with the exact same names.&amp;nbsp; For that reason, I just import the time module since &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;time()&lt;/SPAN&gt; doesn't save much over &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;time.time()&lt;/SPAN&gt;.&amp;nbsp; For datetime, I usually do from &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;datetime import datetime as dt&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be great if we had a &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;time.Time&lt;/SPAN&gt; class instead of a &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;time.time&lt;/SPAN&gt; class, and a &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;datetime.Datetime&lt;/SPAN&gt; class instead of a &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;datetime.datetime&lt;/SPAN&gt;, but I don't know the full history of why those two modules ended up the way they did.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:41:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774842#M877</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T08:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774843#M878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good point, guess it explains the difference between cloned Pro-environments and environments built in Conda.&lt;/P&gt;&lt;P&gt;And yes, switching the imports works, but it is neither intuitive nor good style as mentioned in the original post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2018 14:45:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774843#M878</guid>
      <dc:creator>HåkonDreyer</dc:creator>
      <dc:date>2018-10-22T14:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774844#M879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;maybe arcpy used have used 'thyme' instead &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2018 15:15:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774844#M879</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-10-22T15:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Breaking time</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774845#M880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes the python API does use the `time` module.&amp;nbsp; This is not an easy fix since the API uses many 3rd party libraries as well who do `import time`, so there is no guarantee that if we modify code to not use `import time` that it would still not be an issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Oct 2018 15:17:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/breaking-time/m-p/774845#M880</guid>
      <dc:creator>AndrewChapkowski</dc:creator>
      <dc:date>2018-10-22T15:17:31Z</dc:date>
    </item>
  </channel>
</rss>

