sassoftware / saspy

A Python interface module to the SAS System. It works with Linux, Windows, and Mainframe SAS as well as with SAS in Viya.
https://sassoftware.github.io/saspy
Other
367 stars 149 forks source link

Error Ending SAS Session #493

Closed gfbarbieri closed 1 year ago

gfbarbieri commented 1 year ago

Describe the bug When I close a SAS session, the receive an AttributeError: 'NoneType' object has no attribute 'pid'.

The error verbatim:

AttributeError                            Traceback (most recent call last)
C:\Users\BARBIE~1\AppData\Local\Temp/ipykernel_12684/1451299667.py in <module>
      2 #os.environ["PATH"] += os.environ["PATH"][:-1] + 'C:\\SASHome\\SASFoundation\\9.4\\core\\sasext;'
      3 sas = saspy.SASsession(cfgfile='sascfg_personal.py')
----> 4 sas.endsas()

c:\Anaconda3\lib\site-packages\saspy\sasbase.py in endsas(self)
    706         This method terminates the SAS session, shutting down the SAS process.
    707         """
--> 708         return self._endsas()
    709 
    710     def _endsas(self):

c:\Anaconda3\lib\site-packages\saspy\sasbase.py in _endsas(self)
    711         self.SASpid = None
    712         if self._io:
--> 713            return self._io._endsas()
    714 
    715     def _getlog(self, **kwargs):

c:\Anaconda3\lib\site-packages\saspy\sasioiom.py in _endsas(self)
    617 
    618          if self.sascfg.verbose:
--> 619             logger.info("SAS Connection terminated. Subprocess id was "+str(self.pid if os.name != 'nt' else self.pid.pid))
    620          self.pid        = None
    621          self._sb.SASpid = None

AttributeError: 'NoneType' object has no attribute 'pid'

To Reproduce

import saspy
sas = saspy.SASsession(cfgfile='sascfg_personal.py')
sas.endsas()

Configuration information saspy version: 4.3.4.

tomweber-sas commented 1 year ago

Hey, that one's on me. I was trying to clean up some stuff and accidently messed up that line of code. This should be fixed in the current prod release - V4.3.5. Do you mind trying that:

pip uninstall -y saspy pip install saspy

And that should go away.

Thanks, Tom

tomweber-sas commented 1 year ago

I'm going to close this since I know this is fixed in the current prod release. If you find anything different or need anything else, reopen or open a new issue for other things.

Thanks! Tom