Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one Python module break another?

After several hours of debugging and trial and error, I found that importing two independent Python modules caused a function in one of them to stop working.

import arcpy
# works
sde_conn = arcpy.ArcSDESQLExecute(r"C:\temp\test.sde")

Yet:

import arcpy
import rtree
# fails
sde_conn = arcpy.ArcSDESQLExecute(r"C:\temp\test.sde")

The two Python modules are rtree and ESRI's arcpy, both of which I have running on Windows (the issue occurs on both Windows 7 and Windows Server 2008 R2, and on 32 bit and 64 bit Python installations).

I logged the issue, but I'd like to know what are the possible causes of one module breaking a function in another?

I had a quick check for globals, and modifying the system path. Both also rely on DLLs.

What other factors could be responsible?

like image 497
geographika Avatar asked Nov 02 '22 19:11

geographika


1 Answers

It happens when using:

from (module) import * 

if both modules have functions with the same names. Shamelessly taken from @karthikr

like image 78
Andreas GS Avatar answered Nov 14 '22 01:11

Andreas GS