X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=gdcmPython%2Fdemo%2FPrintFile.py.in;h=9098bd8f1ddf3003a9dc48ce9b15244563a7f416;hb=fa575ef40769378d9024dfaaf634d472c7039e35;hp=007a3fa1bfc8422f39044e58c2c163d6649c9f78;hpb=f51f3cf0f4013935c1d93a828779e5ca285a31fc;p=gdcm.git diff --git a/gdcmPython/demo/PrintFile.py.in b/gdcmPython/demo/PrintFile.py.in index 007a3fa1..9098bd8f 100644 --- a/gdcmPython/demo/PrintFile.py.in +++ b/gdcmPython/demo/PrintFile.py.in @@ -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