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
375 stars 149 forks source link

issue connect to SAS Unix server from local #402

Closed hg0111 closed 3 years ago

hg0111 commented 3 years ago

com_error Traceback (most recent call last)

in 1 import saspy ----> 2 saspy.SASsession(cfgfile = 'sascfg_personal.py', cfgname = 'sasserver', results = 'html') C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasbase.py in __init__(self, **kwargs) 531 self._io = SASsessionIOM(sascfgname=self.sascfg.name, sb=self, **kwargs) 532 elif self.sascfg.mode == 'COM': --> 533 self._io = SASSessionCOM(sascfgname=self.sascfg.name, sb=self, **kwargs) 534 elif self.sascfg.mode == 'HTTP': 535 self._io = SASsessionHTTP(sascfgname=self.sascfg.name, sb=self, **kwargs) C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasiocom.py in __init__(self, **kwargs) 199 self._sb = kwargs.get('sb') 200 --> 201 self.pid = self._startsas() 202 203 def __del__(self): C:\ProgramData\Anaconda3\lib\site-packages\saspy\sasiocom.py in _startsas(self) 253 self.keeper.AddObject(1, 'WorkspaceObject', self.workspace) 254 self.adodb.Open('Provider={}; Data Source=iom-id://{}'.format( --> 255 self.sascfg.provider, self.workspace.UniqueIdentifier)) 256 257 ll = self.submit("options svgtitle='svgtitle'; options validvarname=any validmemname=extend pagesize=max nosyntaxcheck; ods graphics on;", "text") C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py in Open(self, ConnectionString, UserID, Password, Options) C:\ProgramData\Anaconda3\lib\site-packages\win32com\client\dynamic.py in _ApplyTypes_(self, dispid, wFlags, retType, argTypes, user, resultCLSID, *args) 285 286 def _ApplyTypes_(self, dispid, wFlags, retType, argTypes, user, resultCLSID, *args): --> 287 result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args) 288 return self._get_good_object_(result, user, resultCLSID) 289 com_error: (-2147352567, 'Exception occurred.', (0, 'ADODB.Connection', 'Provider cannot be found. It may not be properly installed.', 'C:\\WINDOWS\\HELP\\ADO270.CHM', 1240655, -2146824582), None)
tomweber-sas commented 3 years ago

Hey ,I can try to help with this. Can you show me you're config definition: sasserver ?
Thanks, Tom

hg0111 commented 3 years ago

sasserver = {
'iomhost' : ['host1', 'host2', 'host3'], 'iomport' : nnnn, 'class_id' : '440196d4-90f0-11d0-9f41-00a024bb830c', 'provider' : 'sas.iomprovider', 'encoding' : 'latin_1', 'authkey' : 'usr_pwrd', } (I mask the iomhost and iomport. those settings should not have problems, since the settings work for my coworkers. Actually, I compare the sascfg_personal.py file, nothing inconsistent. However it runs into error on my computer. It used to work. I started getting this error after I reinstall SAS Enterprise Guide some time ago.)

tomweber-sas commented 3 years ago

Ah, ok. Yes the provider field is correct; has to be that. And, that is a thing EG would set up, as the COM access method depends upon having EG installed for it to work (or there's a download w/ the com pieces). So, it would seem to have something to do with that 'provider' not being configured, such as the ADODB stuff expects it to be; given the error: ADODB.Connection', 'Provider cannot be found. It may not be properly installed.

Googling that, I see no end of hits. Does EG come up and work for you? Do you know what changed when you redid that? Not for nothing, but I would use the IOM access methods instead of COM, but that doesn't mean this still shouldn't work for you.

If you Goto Control Panel Goto Administrator Tools Goto Data Sources (ODBC) Click the "Drivers" tab.

Do you see the SAS driver in there (64bit/32bit) SASDRV32.DLL?

I don't know much about this, but at least let's check those things first.

Thanks, Tom

cjdinger commented 3 years ago

The IOM provider is part of the SAS Integration Technologies client, which you can download: https://tds.sas.com/downloads/browse.htm?fil=&cat=56 -- EG installs this, but perhaps you reinstalled different bitness (32-bit EG instead 64-bit or vice-versa). I recommend reinstalling the IntTech client as a start.

cjdinger commented 3 years ago

You can also get just the OLEDB providers as a download: https://tds.sas.com/downloads/browse.htm?fil=&cat=64

hg0111 commented 3 years ago

Thank you for the above inputs. I may have to check if the software is acceptable to my company. Will keep you updated with progress.

hg0111 commented 3 years ago

I checked the SAS EG I installed. It is 32-bit. What do I need to do with this?

tomweber-sas commented 3 years ago

Well, if Python is 64 bit, then I would guess that may be why it can't find it as a provider (just an obvious guess; I don't know how that works). Is your computer really only 32 bit? What bit is the Python you're using? If you're a 64 bit system, and Python is installed 64-bit, then can you install EG 64 bit so things would be compatible?

cjdinger commented 3 years ago

You can install/reinstall the 64-bit IntTech client. It shouldn't interfere with your EG install -- the 32-bit and 64-bit IntTech clients can coexist. No need to reinstall a 64-bit EG.

hg0111 commented 3 years ago

Ah, ok. Yes the provider field is correct; has to be that. And, that is a thing EG would set up, as the COM access method depends upon having EG installed for it to work (or there's a download w/ the com pieces). So, it would seem to have something to do with that 'provider' not being configured, such as the ADODB stuff expects it to be; given the error: ADODB.Connection', 'Provider cannot be found. It may not be properly installed.

Googling that, I see no end of hits. Does EG come up and work for you? Do you know what changed when you redid that? Not for nothing, but I would use the IOM access methods instead of COM, but that doesn't mean this still shouldn't work for you.

If you Goto Control Panel Goto Administrator Tools Goto Data Sources (ODBC) Click the "Drivers" tab.

Do you see the SAS driver in there (64bit/32bit) SASDRV32.DLL?

I don't know much about this, but at least let's check those things first.

Thanks, Tom

I have checked that I do not have "SAS driver" in either ODBC Data Sources (32-bit) or (64-bit). However, I checked with my coworker who is able to connect to SAS successfully, she does not have that either. Both of us have "SQL server" driver.

tomweber-sas commented 3 years ago

So, did you check to see if it is a 32/64 bit discrepancy? And if so, have you installed either the IntTech or EG 64 bit versions to see if that fixed it? And again, FWIW, using the IOM access method will be better in the long run, than COM, but it should still be able to work. The ODBC thing didn't matter. It's OLEDB, not ODBC that this uses. I was off base with that when looking to see what I had on my system.

Thanks, Tom

tomweber-sas commented 3 years ago

@hg0111 did you get the appropriate EG/IntTech client installed to get COM working? Did you switch to just IOM? Is there anything else you need, or can we close this issue? Anything else I can do?

Thanks, Tom

tomweber-sas commented 3 years ago

I'm going to close this, as I haven't heard back in a month. Hopefully you switched to using the IOM access method and are up and running. If you need anything else, just open another issue, or reopen this if need be. Thanks, Tom