Python Forum
annoying conflict: stat - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: annoying conflict: stat (/thread-23375.html)



annoying conflict: stat - Skaperen - Dec-26-2019

in a module i created to collect lots of different things i do, i ended up with:
import stat
from os import stat
they were not in the same place and the 2nd one also had lots of other functions. but at least both were in the same file. and things got even worse in my current project where the pattern of variable names i was using made sense to use stat as one of the names. but at least all the confusion with that led to the discovery of the conflict in that file. now to figure out the best way to resolve this.


RE: annoying conflict: stat - ichabod801 - Dec-26-2019

Always put all of your imports at the top of the file.


RE: annoying conflict: stat - Skaperen - Dec-26-2019

i did. there were so many in that one file that they were several lines apart. all the straight imports were first, followed by all the "from" imports.