Breaking time

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

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

Code sample

切换的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 ofimport timescattered around in the __init__.py file. Wouldn't it be better to narrow the import to afrom time import sleepin the imports at top of the file?
Tags(2)
0Kudos
11 Replies
DanPatterson_Retired
MVP Esteemed Contributor

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

0Kudos
AndrewChapkowski
金宝搏吧

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.

0Kudos