Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed local variable 'sec' referenced before assignment error #23

Closed
wants to merge 1 commit into from

Conversation

lassoan
Copy link
Collaborator

@lassoan lassoan commented Oct 3, 2017

When a file cannot be loaded (e.g., removed from disk) then multivolume importer plugin failed with this error:

[DEBUG][Qt] 02.10.2017 23:22:13 [] (unknown:0) - Could not load  "C:/Users/msliv/Downloads/dicom4miccai/DICOM4MICCAI-Data/QIN-HEADNECK-01-0024-PET/1.2.276.0.7230010.3.1.4.1334872705.15988.1505074246.702.dcm" 
DCMTK says:  No such file or directory
[DEBUG][Qt] 02.10.2017 23:22:13 [] (unknown:0) - SQL failed
 Bad SQL: INSERT OR REPLACE INTO TagCache VALUES(?,?,?)
[DEBUG][Qt] 02.10.2017 23:22:13 [] (unknown:0) - Error text: attempt to write a readonly database Unable to fetch row
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:\D\S4R\Slicer-build\lib\Slicer-4.7\qt-scripted-modules\DICOMLib\DICOMWidgets.py", line 718, in getLoadablesFromFileLists
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     loadablesByPlugin[plugin] = plugin.examine(fileLists)
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:/D/S4R/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 80, in examine
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     loadables += self.examineFiles(files)
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:/D/S4R/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 430, in examineFiles
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     mvNodes = self.initMultiVolumes(subseriesLists[key])
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:/D/S4R/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 646, in initMultiVolumes
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     tagValue = self.tm2ms(tagValueStr) # convert to ms
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:/D/S4R/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 615, in tm2ms
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     sec = sec+ssfrac
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) - UnboundLocalError: local variable 'sec' referenced before assignment
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) - Warning: Plugin failed: MultiVolumeImporterPlugin
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) - See python console for error message.
[INFO][Stream] 02.10.2017 23:22:23 [] (unknown:0) - DICOM Plugin failed: local variable 'sec' referenced before assignment

When a file cannot be loaded (e.g., removed from disk) then multivolume importer plugin failed with this error:

[DEBUG][Qt] 02.10.2017 23:22:13 [] (unknown:0) - Could not load  "C:/Users/msliv/Downloads/dicom4miccai/DICOM4MICCAI-Data/QIN-HEADNECK-01-0024-PET/1.2.276.0.7230010.3.1.4.1334872705.15988.1505074246.702.dcm" 
DCMTK says:  No such file or directory
[DEBUG][Qt] 02.10.2017 23:22:13 [] (unknown:0) - SQL failed
 Bad SQL: INSERT OR REPLACE INTO TagCache VALUES(?,?,?)
[DEBUG][Qt] 02.10.2017 23:22:13 [] (unknown:0) - Error text: attempt to write a readonly database Unable to fetch row
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:\D\S4R\Slicer-build\lib\Slicer-4.7\qt-scripted-modules\DICOMLib\DICOMWidgets.py", line 718, in getLoadablesFromFileLists
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     loadablesByPlugin[plugin] = plugin.examine(fileLists)
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:/D/S4R/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 80, in examine
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     loadables += self.examineFiles(files)
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:/D/S4R/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 430, in examineFiles
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     mvNodes = self.initMultiVolumes(subseriesLists[key])
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:/D/S4R/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 646, in initMultiVolumes
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     tagValue = self.tm2ms(tagValueStr) # convert to ms
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -   File "C:/D/S4R/Slicer-build/lib/Slicer-4.7/qt-scripted-modules/MultiVolumeImporterPlugin.py", line 615, in tm2ms
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -     sec = sec+ssfrac
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) - UnboundLocalError: local variable 'sec' referenced before assignment
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) - Warning: Plugin failed: MultiVolumeImporterPlugin
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) -
[CRITICAL][Stream] 02.10.2017 23:22:13 [] (unknown:0) - See python console for error message.
[INFO][Stream] 02.10.2017 23:22:23 [] (unknown:0) - DICOM Plugin failed: local variable 'sec' referenced before assignment
@fedorov
Copy link
Owner

fedorov commented Oct 3, 2017

xref: commontk/CTK#749

I guess this will be irrelevant once commontk/CTK#750 is merged?

@lassoan let me know if you still want to merge it.

slicerbot pushed a commit to Slicer/SlicerGitSVNArchive that referenced this pull request Oct 3, 2017
References:
* commontk/CTK#751
* fedorov/MultiVolumeImporter#23

List of changes:

```
$ git shortlog a83cec9..f096a15 --no-merges
Isaiah Norton (1):
      BUG: preserve whitespace in console completion

Steve Pieper (1):
      BUG: consistent return for value of uninitialized data
```

git-svn-id: http://svn.slicer.org/Slicer4/trunk@26416 3bd1e089-480b-0410-8dfb-8563597acbee
@jcfr
Copy link
Collaborator

jcfr commented Oct 3, 2017

For reference, as of Slicer r26416, commontk/CTK#750 has been integrated.

@lassoan
Copy link
Collaborator Author

lassoan commented Oct 3, 2017

It should not be necessary to merge it. Let's confirm that by testing the tomorrow's nightly build.

@fedorov
Copy link
Owner

fedorov commented Oct 3, 2017

@lassoan sounds good. Although, I think there may be some more deep underlying issue, which in my experience is not reproducible. I experienced this error several times (over months of time) with QuantitativeReporting, and was always unsuccessful trying to reproduce it after restarting Slicer.

@lassoan
Copy link
Collaborator Author

lassoan commented Oct 3, 2017

There have been some fixes in DICOM database connection handling in Slicer, so this problem might have been fixed.
I got the error when tried to examine images that were still in the database but their files were removed from disk.

@fedorov
Copy link
Owner

fedorov commented Oct 3, 2017

I see - glad there is an explanation for it in your case!

jcfr added a commit to jcfr/SlicerGitSVNArchive that referenced this pull request Oct 13, 2017
References:
* commontk/CTK#751
* fedorov/MultiVolumeImporter#23

List of changes:

```
$ git shortlog a83cec9..f096a15 --no-merges
Isaiah Norton (1):
      BUG: preserve whitespace in console completion

Steve Pieper (1):
      BUG: consistent return for value of uninitialized data
```

git-svn-id: http://svn.slicer.org/Slicer4/trunk@26416 3bd1e089-480b-0410-8dfb-8563597acbee
@lassoan
Copy link
Collaborator Author

lassoan commented Oct 18, 2017

This is not needed anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants