BU-hammerTeam/PyHammer

PyHammer UnboundLocalError

JosephKarpinski opened this issue · 5 comments

See attachment:
UnboundLocalError: local variable 'snVal' referenced before assignment.
Workaround, remove last file processed at time of abend from control file and restart.

pyhammer_unboundlocalerror

Issue should have been fixed in commit 0152715 on developer branch. Check out the lastest of that branch and let me know if this resolves your issue.

Just tried the new PyHammer code.
Getting UnboundLocalError in two different location:

  • line 128 when new lineOutfile is turned on
    Josephs-iMac:~ josephkarpinski$ python3 new_pyhammer.py -f -i downloads/out.txt
  1. Processing bad_A4 (G_165-39)_FeH[-2.32]_spec-3588-55184-0392.fits
  2. Processing bad_A9V (154660)_FeH[-2.32]_spec-3590-55201-0318.fits
    Traceback (most recent call last):
    File "new_pyhammer.py", line 846, in goToMain
    main(self.options)
    File "new_pyhammer.py", line 128, in main
    lineOutfile.write(fname + ',' + str(value[0]) + ',' + str(value[1])+',')
    UnboundLocalError: local variable 'lineOutfile' referenced before assignment
    Abort trap: 6
  • line 193 when new lineOutfile is turned off
    Josephs-iMac:~ josephkarpinski$ python3 new_pyhammer.py -f -i downloads/out.txt
  1. Processing bad_A4 (G_165-39)_FeH[-2.32]_spec-3588-55184-0392.fits
  2. Processing bad_A9V (154660)_FeH[-2.32]_spec-3590-55201-0318.fits
  3. Processing bad_A9V (154660)_FeH[0.25]_spec-3609-55201-0112.fits
  4. Processing bad_CV_FeH[0.17]_spec-5848-56029-0134.fits
  5. Processing bad_F5Ib... (17463)_FeH[0.17]_spec-3609-55201-0018.fits
  6. Processing bad_F6III (61064)_FeH[0.09]_spec-3606-55182-0454.fits
  7. Processing bad_F8V (G_243-63)_FeH[-0.05]_spec-3587-55182-0006.fits
  8. Processing bad_K1_FeH[0.05]_spec-0792-52353-0217.fits
  9. Processing spec-0266-51630-0015.fits
  10. Processing spec-0618-52049-0372.fits
  11. Processing spec-1079-52621-0509.fits
    Traceback (most recent call last):
    File "new_pyhammer.py", line 846, in goToMain
    main(self.options)
    File "new_pyhammer.py", line 193, in main
    lineOutfile.close()
    UnboundLocalError: local variable 'lineOutfile' referenced before assignment
    Abort trap: 6

Made more updates. Check out developer branch and give it a go.