]> Creatis software - gdcm.git/blobdiff - gdcmPython/demo/PrintFile.py.in
BUG: I hate cmake...
[gdcm.git] / gdcmPython / demo / PrintFile.py.in
index 007a3fa1bfc8422f39044e58c2c163d6649c9f78..9098bd8f1ddf3003a9dc48ce9b15244563a7f416 100644 (file)
@@ -1,4 +1,5 @@
 import sys
+import os.path
 from gdcmConfigDemo import *
 from gdcmPython.core import *
 
@@ -16,6 +17,8 @@ try:
    fileName = sys.argv[1]
 except IndexError:
    fileName = os.path.join(GDCM_DATA_ROOT, "test.acr")
+   if( not os.path.isfile(fileName) ):
+      fileName=os.path.join(os.path.split(sys.argv[0])[0],"test.acr")
 
 try:
    printLevel = int(sys.argv[2])
@@ -23,7 +26,9 @@ except IndexError:
    printLevel = 1
 
 ### Build the file element list
-file = gdcm.File(fileName)
+file = gdcm.File()
+file.SetFileName(fileName)
+file.Load()
 if not file.IsReadable():
    PrintUse()
    raise RuntimeError,"The '%s' file is not readable with gdcm." % fileName