Forgot to explain earlier:
We have problems on Spyder ONLY when we make out test scripts 'proper' scripts, i.e. if main(): is replaced with try:, and try: main() (just before except error as err:) is removed (so you need to do this if you want to see for yourself error messages on second run in Spyder). The reason for introducing main() was exactly this second run problem. However, if our scrips are essentially functions, all data disappears after script finishes, which is not what one expects from a script. This is why we started seeking help with this issue rather than continue 'papering over the crack'.
By the way, no error messages are issued if a 'proper' script is executed twice in Python command shell. So, this appears to be a Spyder-specific problem rather than a bug in our interface.
On the bright side: problem disappears if one selects 'Execute in a new dedicated Python console' in Spyder Run Settings - not a perfect solution, but sill a better option than 'function-scripts' do you think?
-----Original Message-----
From: CCP-PETMR Developers list [mailto:[log in to unmask]] On Behalf Of Evgueni Ovtchinnikov
Sent: 09 December 2016 16:59
To: [log in to unmask]
Subject: Re: spyder second run problem
Well, actually, spyder reloads them, and pyiutil is loaded in pGadgetron.py, which calls pyiutil.deleteObject() methods.
From: Casper da Costa-Luis [[log in to unmask]]
Sent: Friday, December 09, 2016 4:34 PM
To: Ovtchinnikov, Evgueni (STFC,RAL,SC)
Cc: [log in to unmask]
Subject: Re: spyder second run problem
Why do we need to "reload modules?" Perhaps if required reload pGadgetron before pyiutil?
On 9 December 2016 at 15:50, Evgueni Ovtchinnikov <[log in to unmask]<mailto:[log in to unmask]>> wrote:
Hi All,
When we run any of our scripts second time in spyder, we get error messages of the kind
runfile('/cs/research/external/home/eovtchin/devel/xGadgetron/examples/coil_sensitivity_maps.py', wdir='/cs/research/external/home/eovtchin/devel/xGadgetron/examples')
Reloaded modules: ismrmrdtools, pyiutil, pGadgetron, six, _pyiutil, _pygadgetron, ismrmrdtools.coils, pygadgetron Exception AttributeError: "'NoneType' object has no attribute 'deleteObject'" in <bound method AcquisitionData.__del__ of <pGadgetron.AcquisitionData instance at 0x23d3e18>> ignored
for every object that calls pyiutil.deleteObject() from __del__ (the above message is for an AcquisitionData object).
The error message suggests that by the time __del__ is called, module pyiutil has already been destroyed.
Any ideass how to get rid of these error messages?
|