Breaking time

1402
11
09-12-2018 12:01 AM
HåkonDreyer
Esri Contributor

Hi, it seems importing the GIS breaks a former from time import time import as demonstrated in the following example.

          Code sample

Switching the imports works, but it's not intuitive, and neither very PEP 8.

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().
Still, there are three instances of import time scattered around in the __init__.py file. Wouldn't it be better to narrow the import to a from time import sleep in the imports at top of the file?
Tags (2)
0 Kudos
11 Replies
DanPatterson_Retired
MVP Emeritus

Strange too

even in jupyter console and spyder

I read somewhere that the time namespace gets reassigned, but I can't put my hand on it

0 Kudos
AndrewChapkowski
Esri Regular Contributor

Yes the python API does use the `time` module.  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.

0 Kudos