AttributeError due to variable shadowing imported module
Created by: titodalcanton
Hi,
Hopefully this is the right place for reporting this. I get an AttributeError from dqsegdb when (mis)using pycbc_coinc_time
:
$ pycbc_coinc_time --gps-start-time 1169107218 --gps-end-time `lalapps_tconvert` --veto-definer output/results/1._analysis_time/1.01_segment_data/H1L1-HOFT_C00_O2_CBC.xml --pad-data 8 --segment-start-pad 144 --segment-end-pad 16 --min-analysis-segments 1 --segment-length 512 --science-names H1:DMT-ANALYSIS_READY:1 L1:DMT-ANALYSIS_READY:1 --segment-server ldr.atlas.local:80
Traceback (most recent call last):
File "/home/tito/sw_install/pycbc_1.6.3//bin/pycbc_coinc_time", line 4, in <module>
__import__('pkg_resources').run_script('PyCBC==1.6.3', 'pycbc_coinc_time')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 534, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1438, in run_script
execfile(script_filename, namespace, namespace)
File "/home/tito/sw_install/pycbc_1.6.3/lib/python2.7/site-packages/PyCBC-1.6.3-py2.7.egg/EGG-INFO/scripts/pycbc_coinc_time", line 130, in <module>
'active', args.gps_start_time, args.gps_end_time)[0]['active'])
File "/usr/lib/python2.7/dist-packages/dqsegdb/apicalls.py", line 180, in dqsegdbQueryTimes
result=urifunctions.getDataUrllib2(queryurl)
File "/usr/lib/python2.7/dist-packages/dqsegdb/urifunctions.py", line 114, in getDataUrllib2
warnings.warn("Issue accesing url: %s; Reason: %s" % (url,str(e.reason)))
AttributeError: 'bool' object has no attribute 'warn'
The issue is that getDataUrllib2
takes an arg called warnings
which shadows the import warnings
at the top.