BrownBiomechanics / SlicerAutoscoperM

This 3D Slicer extension enables users to perform image registration.
https://autoscoperm.slicer.org
MIT License
0 stars 3 forks source link

Switch from Qt Process to subprocess #18

Closed NicerNewerCar closed 1 year ago

NicerNewerCar commented 1 year ago

After debugging with @amymmorton it seems that qt.QProcess does not appear to be working on some instances of Windows. However, using the subprocess library from Python worked fine.

This appears to be related to issue #15

jcfr commented 1 year ago

Is there a qt issue referencing a known problem ?

NicerNewerCar commented 1 year ago

I could not find an issue on the Qt forums, Amy and I tried a few things to get the QProcess working but nothing seemed to work. I did have another idea, however, @amymmorton could you add the following line to AutoscoperM.py at line 351?

print(self.AutoscoperProcess.state())

This will allow us to verify the state of the subprocess right before the connection attempt is made.

amymmorton commented 1 year ago

To

C:\Users\amorton1\AppData\Local\slicer.org\Slicer 5.3.0-2023-03-27\ slicer.org \Extensions-31693\SlicerAutoscoperM\lib\Slicer-5.3\qt-scripted-modules\AutoscoperM.py

on line 351 added

print(self.AutoscoperProcess.state())

I relaunched slicer and the autoscoperM module, tried to launch autoscoper,

before the error messages was 0:

0

Traceback (most recent call last):

File "C:/Users/amorton1/AppData/Local/slicer.org/Slicer 5.3.0-2023-03-27/slicer.org/Extensions-31693/SlicerAutoscoperM/lib/Slicer-5.3/qt-scripted-modules/AutoscoperM.py", line 249, in onApplyButton

self.logic.startAutoscoper(executablePath)

File "C:/Users/amorton1/AppData/Local/slicer.org/Slicer 5.3.0-2023-03-27/slicer.org/Extensions-31693/SlicerAutoscoperM/lib/Slicer-5.3/qt-scripted-modules/AutoscoperM.py", line 357, in startAutoscoper

self.connectToAutoscoper()

File "C:/Users/amorton1/AppData/Local/slicer.org/Slicer 5.3.0-2023-03-27/slicer.org/Extensions-31693/SlicerAutoscoperM/lib/Slicer-5.3/qt-scripted-modules/AutoscoperM.py", line 310, in connectToAutoscoper

self.AutoscoperSocket = AutoscoperConnection()

File "C:\Users\amorton1\AppData\Local\slicer.org\Slicer 5.3.0-2023-03-27\lib\Python\Lib\site-packages\PyAutoscoper\connect.py", line 24, in init

self.socket = self._openConnection()

File "C:\Users\amorton1\AppData\Local\slicer.org\Slicer 5.3.0-2023-03-27\lib\Python\Lib\site-packages\PyAutoscoper\connect.py", line 103, in _openConnection

s.connect((self.address, 30007))

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

NicerNewerCar commented 1 year ago

I was able to recreate the error on my desktop. It appears we are getting a Failed to Start error. Which could be is due to a permission error^1. I will continue to investigate this issue.

Autoscoper process error:  0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Failed to Start:  0
Crashed:  1
Timedout:  2
WriteError:  4
ReadError:  3
UnknownError:  5
NicerNewerCar commented 1 year ago

Note: This is the same issue as described in issue #15 by @kaitohl

NicerNewerCar commented 1 year ago

Closed via #19