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

SASIONotSupported Error #477

Closed yam3moe closed 2 years ago

yam3moe commented 2 years ago

Hello, I am trying to access SAS 9.4 (local installed on Windows client) from Python on Jupyter lab (accessed through Anaconda) and I believe I followed the steps outlined here. After reading through the documentation on configuration, I determined that the access method I should use is 'IOM using COM' and this is my modified sascfg_personal.py

SAS_config_names=['default']

SAS_config_options = {'lock_down': False,
                      'verbose'  : True,
                      'prompt'   : True
                     }
default  = {'saspath'  : '/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_u8'
            }

ssh      = {'saspath' : '/opt/sasinside/SASHome/SASFoundation/9.4/bin/sas_en',
            'ssh'     : '/usr/bin/ssh',
            'host'    : 'remote.linux.host', 
            'encoding': 'latin1',
            'options' : ["-fullstimer"]
            }
iomcom = {
    # 'iomhost' : 'mynode.mycompany.org',
    # 'iomport' : 8591,
    'class_id': '440196d4-90f0-11d0-9f41-00a024bb830c',
    'provider': 'sas.iomprovider',
    'encoding': 'windows-1252'}

And then, following the steps shown in https://github.com/sassoftware/saspy-examples/blob/main/SAS_contrib/saspy_example_github.ipynb, I ran the following lines of code,

import saspy
saspy
saspy.SAScfg
saspy.list_configs()
sas = saspy.SASsession()

I keep getting SASIONotSupportedError: Cannot use STDIO I/O module on Windows. Try the following: IOM error, and I found two other similar issues previously posted. But, after reading them, I am still at my wit's end how to solve this issue. So, I would appreciate your help. Thanks.

tomweber-sas commented 2 years ago

Hey, good job reading the doc! You're very close. The reason you're getting that error is because the only configuration definition you've allowed is default which is not valid for your situation.

SAS_config_names=['default']

It also doesn't seem you need the ssh one in your config; not for getting at your local PC SAS; maybe you also have access to a stand alone linux deployment? You can change the name of the config def you want to use to be default, then it will use that one. Or change the value in the SAS_config_names to be the one (or ones) you want to be able to use, then it will use that one or promt you for which one if you list multiple (or you can specify which one on SASsession(cfgname='config_def_name').

BTW, COM isn't the best choice, you ought to use IOM if you want full functionality and performance. COM can work, but it's not one of the fully supported Access Methods I created and support. It was user contributed a while back and isn't current with performance and functionality of the other 3 access methods.

Anyway, the error is simply because you've told it to use what you have named default which is only valid for STDIO and that doesn't work on windows.

Thanks, Tom

yam3moe commented 2 years ago

Hi Tom,

Thanks, the comment line # SAS_config_names = ['default', 'ssh', 'iomlinux', 'iomwin', 'winlocal', 'winiomlinux', 'winiomwin', 'httpsviya', 'httpviya', 'iomcom'] escaped me and I didn't think of changing the name. It works fine now.

It also doesn't seem you need the ssh one in your config; not for getting at your local PC SAS; maybe you also have access to a stand alone linux deployment?

No, I don't have a stand alone deployment. So, I deleted it.

I have another question if you don't mind. You said IOM may be a better choice. In that case, I should change SAS_config_names to SAS_config_names = ['winiomwin']? and have the following dictionary

winiomwin  = {'java'    : 'java',
             #'iomhost'   : 'windows.iom.host',
             #'iomport'   : 8591,
             }

in the sascfg_personal.py?

tomweber-sas commented 2 years ago

Hey that's great; you're up and running. Yes, IOM uses java, so that example config definition is one that has IOM keys in it. You can name these anything you want; these are just python variables; I just used meaningful names in the examples instead of 'foo' and 'bar' so that the names were sorta self documenting.

The IOM access method is a lot better than COM. Back when the user contributed COM, they were all fairly equal, but my access methods (all the others than COM) have been enhanced in many ways and data movement performs much better since then. I can't really do those things in the COM access method because it's completely different. Just follow the instructions for IOM (Local) and you should be up running quickly again but with better functionality. https://sassoftware.github.io/saspy/configuration.html#iom

Let me know if you need anything else! Tom

tomweber-sas commented 2 years ago

Were you able to switch to using the IOM access method? Is there anything else you need, or can this issue be closed?

Thanks! Tom

yam3moe commented 2 years ago

Were you able to switch to using the IOM access method? Is there anything else you need, or can this issue be closed?

Thanks! Tom

Sorry, I was out of office for a few days and didn't get to look at this. Yes, I was able to switch to the IOM access method, and it is working fine on my Jupyterlab now. Thanks for your help and please close the case if you want to.

YAM

tomweber-sas commented 2 years ago

Hey that's great, I will go ahead and close this then. Thanks, Tom