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
373 stars 150 forks source link

Unable To Create SASSession From Local Window Machine To Remote SAS #369

Closed himmu closed 3 years ago

himmu commented 3 years ago

Hi

I am trying to connect saspy with python using IOMCOM configuration from my winodws system to Remote SAS but getting an error. My current conf is as below

iomcom = { 'iomhost': 'apslp###.domain.com', 'iomport': 8564, 'class_id': '440196D4-90F0-11D0-9F41-00A024BB830C', 'provider': 'sas.iomprovider', 'encoding': 'Latin1', 'omruser': '######', 'omrpw': '######' }

I have python and saspy installed in my local machine but SAS and java is not there in my system as i need to connect from remote sas server

Error:

Please enter the name of the SAS Config you wish to run. Available Configs are: ['iomcom', 'ssh'] iomcom Pandas module not available. Setting results to HTML Traceback (most recent call last): File "C:\optum_start\envs\sasEnv\lib\site-packages\win32com\client\dynamic.py", line 81, in _GetGoodDispatch IDispatch = pythoncom.connect(IDispatch) pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/optum_start/Fin360SasApp/connect_sas.py", line 6, in cfgfile='C:/optum_start/Fin360SasApp/sas_iomcom.py' File "C:\optum_start\envs\sasEnv\lib\site-packages\saspy\sasbase.py", line 498, in init self._io = SASSessionCOM(sascfgname=self.sascfg.name, sb=self, **kwargs) File "C:\optum_start\envs\sasEnv\lib\site-packages\saspy\sasiocom.py", line 200, in init self.pid = self._startsas() File "C:\optum_start\envs\sasEnv\lib\site-packages\saspy\sasiocom.py", line 215, in _startsas factory = dynamic.Dispatch('SASObjectManager.ObjectFactoryMulti2') File "C:\optum_start\envs\sasEnv\lib\site-packages\win32com\client\dynamic.py", line 113, in Dispatch IDispatch, userName = _GetGoodDispatchAndUserName(IDispatch,userName,clsctx) File "C:\optum_start\envs\sasEnv\lib\site-packages\win32com\client\dynamic.py", line 100, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\optum_start\envs\sasEnv\lib\site-packages\win32com\client\dynamic.py", line 83, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) pywintypes.com_error: (-2147221005, 'Invalid class string', None, None) Exception ignored in: <bound method SASSessionCOM.del of <saspy.sasiocom.SASSessionCOM object at 0x03542150>> Traceback (most recent call last): File "C:\optum_start\envs\sasEnv\lib\site-packages\saspy\sasiocom.py", line 203, in del if self.adodb.State == self.STATE_OPEN: AttributeError: 'SASSessionCOM' object has no attribute 'adodb'

================================================================================

FriedEgg commented 3 years ago

In order to use the IOMCOM method you need to have the SAS Integration Technologies Client for Windows installed on your local system. This is available for download here

tomweber-sas commented 3 years ago

Thanks @FriedEgg; always helpful! The other choice would be to download Java and use the IOM access method. That also doesn't require SAS locally, and it has some more advanced features that COM. COM is a user contributed access method, while IOM (STDIO and HTTP) I wrote and keep these three up to date with the latest features. I can't always enhance COM equally. So, COM works, but there are some things where IOM will work better. Just depends on what you need. Thanks, Tom

himmu commented 3 years ago

In order to use the IOMCOM method you need to have the SAS Integration Technologies Client for Windows installed on your local system. This is available for download here

Thanks @FriedEgg for a quick reply

I tried to find "SAS Integration Technologies Client for Windows" application in my organization appstore but seems it is only installable for citrix not in local machine.

Can you suggest any other alternatives

himmu commented 3 years ago

Thanks @FriedEgg; always helpful! The other choice would be to download Java and use the IOM access method. That also doesn't require SAS locally, and it has some more advanced features that COM. COM is a user contributed access method, while IOM (STDIO and HTTP) I wrote and keep these three up to date with the latest features. I can't always enhance COM equally. So, COM works, but there are some things where IOM will work better. Just depends on what you need. Thanks, Tom

Hi @tomweber-sas

Please suggest me best configuration to use for my below requirement.

I need to create a django based web application which sometimes try to access our organization SAS server and give the appropriate result.

Things must be in considered 1) Users May not have anything related to sas installed in their local system 2) Application will be on Linux Server

Thanks.

tomweber-sas commented 3 years ago

If your app (which is using saspy sometimes) is on linux, then you can't use COM anyway. You would need to use IOM. And, that's the best choice if you're building a production use case. If you'd like to get on a call and show me what you are trying to do, I'm happy to help out that way.

There are details about how you would be connecting to the remote IOM server; with common credentials, or which each users creds? More details about your client/server app, and where python really is would be helpful too. You started out with connecting from your windows box, but this sounds different. Though I suppose you were just trying to prototype some of this to start with? IOM will work from either Win or Linux, so using that, you could prototype the saspy code from either place and it will work form the other.

Let me know if you want to do a teams call. That might get thigs figured out quickly. Or just on here is ok too; your choice.

Thanks, Tom

tomweber-sas commented 3 years ago

@himmu is there anything else I can help you with for this? Were you able to connect w/ IOM? Did you get your app working? thanks, Tom

himmu commented 3 years ago

Hi Tom

Sorry for the late reply

Your tips worked me and my web app is now able to interact with SAS.

Thanks for correcting me with configuration.

Thanks again for your help

You rocks

On Mon, 26 Apr, 2021, 8:23 pm Tom Weber, @.***> wrote:

@himmu https://github.com/himmu is there anything else I can help you with for this? Were you able to connect w/ IOM? Did you get your app working? thanks, Tom

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/369#issuecomment-826899534, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6ZG5DXMDOF43A2UUILUTDTKV447ANCNFSM4ZOHU6XA .

tomweber-sas commented 3 years ago

Oh, well that's great news! Glad it's up and running! Let me know if you need anything else, I'll go ahead and close this one for now. Thanks! Tom