Project

General

Profile

Bug #1085

download_geometry.py fails with filename

Added by Rogers, Chris about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Littlefield, Matthew
Category:
Geometry
Target version:
Start date:
01 August 2012
Due date:
% Done:

100%

Estimated time:
Workflow:
New Issue

Description

Try:

/home/cr67/MAUS/maus_merge/bin/utilities/download_geometry.py -geometry_download_run_number 4065 -geometry_download_directory ./ -verbose_level 0

and the download works okay
Try:
mkdir download
/home/cr67/MAUS/maus_merge/bin/utilities/download_geometry.py -geometry_download_run_number 4065 -geometry_download_directory ./download -verbose_level 0

I get an error like:
geometry.zip not a gdml or xml file - ignored
FileList.txt not a gdml or xml file - ignored
Traceback (most recent call last):
  File "/home/cr67/MAUS/maus_merge/bin/utilities/download_geometry.py", line 80, in <module>
    main()
  File "/home/cr67/MAUS/maus_merge/bin/utilities/download_geometry.py", line 70, in main
    gdmls.format()
  File "/home/cr67/MAUS/maus_merge/src/common_py/geometry/GDMLFormatter.py", line 265, in format
    self.insert_materials_ref(self.txt_file)
  File "/home/cr67/MAUS/maus_merge/src/common_py/geometry/GDMLFormatter.py", line 210, in insert_materials_ref
    fout = open(os.path.join(self.path_out, gdmlfile), 'w')
IOError: [Errno 2] No such file or directory: u'./download/./download/FastradModel.gdml'

Somehow the download directory is getting appended twice, making an error.

#1

Updated by Littlefield, Matthew about 9 years ago

Hey Chris I don't get this error when I call the download? Only thing I noticed is that I had to put the full path for -geometry_download_directory. I'm coming back over to RAL on Fri if you want me to take a look at your machine?

#2

Updated by Rogers, Chris about 9 years ago

bzr diff output after fix from Matt:

=== modified file 'src/common_py/geometry/GDMLFormatter.py'
--- src/common_py/geometry/GDMLFormatter.py    2012-04-16 13:57:16 +0000
+++ src/common_py/geometry/GDMLFormatter.py    2012-08-17 11:00:49 +0000
@@ -180,7 +180,7 @@
         """ 
         impl = minidom.getDOMImplementation()
         docstr = 'gdml [<!ENTITY materials SYSTEM "' \
-        + os.path.join(self.path_out, self.material_file) + '">]'
+        + os.path.join(self.material_file) + '">]'
         doctype = impl.createDocumentType(docstr, None, None)
         newdoc = impl.createDocument(None, "MAUS", doctype)
         config = minidom.parse(os.path.join(self.path_out, gdmlfile))
@@ -207,7 +207,7 @@
         """ 
         fin = open(inputfile, 'r')
         gdmlfile = inputfile[:-4] + '.gdml'
-        fout = open(os.path.join(self.path_out, gdmlfile), 'w')
+        fout = open(gdmlfile, 'w')
         for line in fin.readlines():
             if line.find('<!-- Materials definition CallBack -->')>=0:
                 matdef = '<!-- Materials definition CallBack -->'

=== modified file 'src/common_py/geometry/GDMLtoMAUSModule.py'
--- src/common_py/geometry/GDMLtoMAUSModule.py    2012-02-15 14:44:16 +0000
+++ src/common_py/geometry/GDMLtoMAUSModule.py    2012-08-17 10:59:49 +0000
@@ -60,6 +60,7 @@
             if fname.find('materials') >= 0:
                 found_file = self.path + '/' + fname
                 self.material_file = found_file
+                print found_file 
                 self.material_file_path = os.path.abspath(self.material_file)
             if fname == 'fastradModel.gdml' or fname == 'FastradModel.gdml':
                 found_file = self.path + '/' + fname

#3

Updated by Littlefield, Matthew almost 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
#4

Updated by Rogers, Chris almost 9 years ago

  • Target version changed from Future MAUS release to MAUS-v0.4.0

Also available in: Atom PDF