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

Cannot connect saspy with windows #529

Closed ErisConsulting closed 1 year ago

ErisConsulting commented 1 year ago

This is the error I get:


SASIONotSupportedError Traceback (most recent call last) Cell In[2], line 1 ----> 1 sas=saspy.SASsession(cfgname='default')

File ~\Anaconda3\lib\site-packages\saspy\sasbase.py:556, in SASsession.init(self, kwargs) 554 self._io = SASsessionSTDIO(sascfgname=self.sascfg.name, sb=self, kwargs) 555 else: --> 556 raise SASIONotSupportedError(self.sascfg.mode, alts=['IOM']) 557 elif self.sascfg.mode == 'IOM': 558 self._io = SASsessionIOM(sascfgname=self.sascfg.name, sb=self, **kwargs)

SASIONotSupportedError: Cannot use STDIO I/O module on Windows. Try the following: IOM

tomweber-sas commented 1 year ago

Hey, I'm on vacation till Wednesday but you can see how to configure saspy based upon what kind of SAS deployment you are trying to connect to here https://sassoftware.github.io/saspy/configuration.html

ErisConsulting commented 1 year ago

Thank you for your response. But, it is still confusing. If you don't mind letting me know when you're available to help that would be great.

On Mon, Feb 13, 2023 at 10:59 AM Tom Weber @.***> wrote:

Hey, I'm on vacation till Wednesday but you can see how to configure saspy based upon what kind of SAS deployment you are trying to connect to here https://sassoftware.github.io/saspy/configuration.html

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1428193963, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4A2CMQMOAKN6VONX6TWXJK7VANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

Sure, I'll be back and available on Wednesday. Tom

ErisConsulting commented 1 year ago

Hi there - any chance you are available?

ErisConsulting commented 1 year ago

I am running into the following issue to connecting Python to SAS on demand:


NameError Traceback (most recent call last) Cell In[3], line 1 ----> 1 sas=saspy.SASsession(cfgname='default')

File ~\Anaconda3\lib\site-packages\saspy\sasbase.py:526, in SASsession.init(self, kwargs) 524 self._obj_cnt = 0 525 self.nosub = False --> 526 self.sascfg = SASconfig(kwargs) 527 self.batch = False 528 self.results = kwargs.get('results', self.sascfg.results)

File ~\Anaconda3\lib\site-packages\saspy\sasbase.py:138, in SASconfig.init(self, **kwargs) 135 except Exception as e: 136 self.pandas = e --> 138 SAScfg = self._find_config(cfg_override=kwargs.get('cfgfile')) 139 self.SAScfg = SAScfg 141 # Get Config options. Fallback to empty dict.

File ~\Anaconda3\lib\site-packages\saspy\sasbase.py:353, in SASconfig._find_config(self, cfg_override) 349 sys.path.insert(0, mod_path) 351 try: 352 # Option 2, 3, 4 --> 353 import sascfg_personal as SAScfg 354 except ImportError: 355 # Option 5 356 import sascfg as SAScfg

File ~\Anaconda3\lib\site-packages\saspy\sascfg_personal.py:5 1 { 2 "cells": [ 3 { 4 "cell_type": "code", ----> 5 "execution_count": null, 6 "id": "c2c53d77", 7 "metadata": {}, 8 "outputs": [], 9 "source": [ 10 "SAS_config_names=['oda']\n", 11 "oda = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe',\n", 12 "#US Home Region 1\n", 13 "'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],\n", 14 "#US Home Region 2\n", 15 "#'iomhost' : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com'],\n", 16 "#European Home Region 1\n", 17 "#'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com'],\n", 18 "#Asia Pacific Home Region 1\n", 19 "#'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com'],\n", 20 "#Asia Pacific Home Region 2\n", 21 "#'iomhost' : ['odaws01-apse1-2.oda.sas.com','odaws02-apse1-2.oda.sas.com'],\n", 22 "'iomport' : 8591,\n", 23 "'authkey' : 'oda',\n", 24 "'encoding' : 'utf-8'\n", 25 "}" 26 ] 27 } 28 ], 29 "metadata": { 30 "kernelspec": { 31 "display_name": "Python 3 (ipykernel)", 32 "language": "python", 33 "name": "python3" 34 }, 35 "language_info": { 36 "codemirror_mode": { 37 "name": "ipython", 38 "version": 3 39 }, 40 "file_extension": ".py", 41 "mimetype": "text/x-python", 42 "name": "python", 43 "nbconvert_exporter": "python", 44 "pygments_lexer": "ipython3", 45 "version": "3.9.13" 46 } 47 }, 48 "nbformat": 4, 49 "nbformat_minor": 5 50 }

NameError: name 'null' is not defined

tomweber-sas commented 1 year ago

Hey, yes, I'm back trying to catch up on everything. Can you run the following code (if you're in jupyter, then one line per cell so we get the output; better if you just run this in line mode python shell). I can't really tell what the above is.

import saspy
saspy
saspy.SAScfg
saspy.list_configs()
print(open(saspy.SAScfg).read())
ErisConsulting commented 1 year ago

Yes - Here you go....

{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "c2c53d77", "metadata": {}, "outputs": [], "source": [ "SAS_config_names=['oda']\n", "oda = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe',\n", "#US Home Region 1\n", "'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],\n", "#US Home Region 2\n", "#'iomhost' : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com'],\n", "#European Home Region 1\n", "#'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com'],\n", "#Asia Pacific Home Region 1\n", "#'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com'],\n", "#Asia Pacific Home Region 2\n", "#'iomhost' : ['odaws01-apse1-2.oda.sas.com','odaws02-apse1-2.oda.sas.com'],\n", "'iomport' : 8591,\n", "'authkey' : 'oda',\n", "'encoding' : 'utf-8'\n", "}" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }

On Wed, Feb 15, 2023 at 2:23 PM Tom Weber @.***> wrote:

Hey, yes, I'm back trying to catch up on everything. Can you run the following code (if you're in jupyter, then one line per cell so we get the output; better if you just run this in line mode python shell). I can't really tell what the above is.

import saspy saspy saspy.SAScfg saspy.list_configs() print(open(saspy.SAScfg).read())

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1431896203, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4HQFEPVVZF55M5GBO3WXUUL5ANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

That's not the output from the code I asked to run. Can you run python in a shell and run the code so I can actually see the output and read it?

ErisConsulting commented 1 year ago

Please see the SHELL screen shot with what you asked for:

[image: image.png]

On Wed, Feb 15, 2023 at 2:50 PM Tom Weber @.***> wrote:

That's not the output from the code I asked to run. Can you run python in a shell and run the code so I can actually see the output and read it?

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1431935073, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4CEBWPQ5B672QZME3TWXUXQLANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

There's no image to see. If it's from a shell, why try to send a picture? just cut and paste the output so I can see it please.

ErisConsulting commented 1 year ago

Here it is

import saspy saspy <module 'saspy' from 'C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\init.py'> saspy.SAScfg 'C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py' saspy.list_configs() ['C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py', 'C:\Users\m0k0871\sascfg_personal.py'] print(open(saspy.SAScfg).read()) { "cells": [ { "cell_type": "code", "execution_count": null, "id": "c2c53d77", "metadata": {}, "outputs": [], "source": [ "SAS_config_names=['oda']\n", "oda = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe',\n", "#US Home Region 1\n", "'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com',' odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],\n", "#US Home Region 2\n", "#'iomhost' : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com '],\n", "#European Home Region 1\n", "#'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com '],\n", "#Asia Pacific Home Region 1\n", "#'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com '],\n", "#Asia Pacific Home Region 2\n", "#'iomhost' : ['odaws01-apse1-2.oda.sas.com',' odaws02-apse1-2.oda.sas.com'],\n", "'iomport' : 8591,\n", "'authkey' : 'oda',\n", "'encoding' : 'utf-8'\n", "}" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }

On Wed, Feb 15, 2023 at 2:56 PM Tom Weber @.***> wrote:

There's no image to see. If it's from a shell, why try to send a picture? just cut and paste the output so I can see it please.

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1431942356, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4CJPH6JL5NFREKMUD3WXUYFLANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

ok, that's not a shell, but at least you put each line in a different cell in jupyter so I can at least interpolate. So what is your error when you try to submit the following? sas = saspy.SASsession()

tomweber-sas commented 1 year ago

And, for clarity, why not submit the following:

for cfg in saspy.list_configs():
   print(cfg, '=', open(cfg).read())

Since you're not getting the configuration you are showing in that output. Can you send the actual output from python, not some jupyter exported metadata from the cells?

ErisConsulting commented 1 year ago

Here is what I have when I submit the following:

sas = saspy.SASsession() Traceback (most recent call last): File "", line 1, in File "C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sasbase.py", line 526, in init self.sascfg = SASconfig(*kwargs) File "C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sasbase.py", line 138, in init SAScfg = self._find_config(cfg_override=kwargs.get('cfgfile')) File "C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sasbase.py", line 353, in _find_config import sascfg_personal as SAScfg File "C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py", line 5, in "execution_count": null, NameError: name 'null' is not defined*

Are you able to assist me with this? If not please let me know.

On Wed, Feb 15, 2023 at 3:01 PM Tom Weber @.***> wrote:

ok, that's not a shell, but at least you put each line in a different cell in jupyter so I can at least interpolate. So what is your error when you try to submit the following? sas = saspy.SASsession()

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1431951643, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4HYSEMM7PPYVXVPGUTWXUY23ANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

It seems you're only interacting with this issue via email. I think that may be part of the problem, especially with only using jupyter instead of a python shell, that I could read the output from. Can you access a web browser? Can you see this actual issues page and see what's being posted to it? https://github.com/sassoftware/saspy/issues/529 I bet it's not whatever you see in your email.

The error above is:

  File
"C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py",
line 5, in <module>
    "execution_count": null,
*NameError: name 'null' is not defined*

Since I can't see the actual output from the commands I asked to run, I can't actually tell what's in your config file. The error you're getting is a python syntax error in your config file. Can you attach the actual file itself here? That would help.

Thanks, Tom

tomweber-sas commented 1 year ago

If what you posted from your post above (what I have below) is actually the output from the command (and actually your config file contents), and not some exported jupyter cell output, then that's your problem. That's not even close to being a valid config file. Is this actually the contents of that config file - C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py?

>> print(open(saspy.SAScfg).read())
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c2c53d77",
   "metadata": {},
   "outputs": [],
   "source": [
    "SAS_config_names=['oda']\n",
    "oda = {'java' : 'C:\\\\Program Files (x86)\\\\Common
Files\\\\Oracle\\\\Java\\\\javapath\\\\java.exe',\n",
    "#US Home Region 1\n",
    "'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','
odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],\n",
    "#US Home Region 2\n",
    "#'iomhost' : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com
'],\n",
    "#European Home Region 1\n",
    "#'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com
'],\n",
    "#Asia Pacific Home Region 1\n",
    "#'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com
'],\n",
    "#Asia Pacific Home Region 2\n",
    "#'iomhost' : ['odaws01-apse1-2.oda.sas.com','
odaws02-apse1-2.oda.sas.com'],\n",
    "'iomport' : 8591,\n",
    "'authkey' : 'oda',\n",
    "'encoding' : 'utf-8'\n",
    "}"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
ErisConsulting commented 1 year ago

Hi - Here is my question to the SAS COMMUNITY ... I would like to connect Connect to the SAS OnDemand for Academics Servers from Python.

Such that I can execute SAS commands within a Notebook.

Is that something you can help set-up, if not. Could you please let me know who can help. The instructions available are not useful. I have reached out to SAS and they had suggested I use the community. Which has not been successful.

On Wed, Feb 15, 2023 at 3:54 PM Tom Weber @.***> wrote:

If what you posted from your post above (what I have below) is actually the output from the command (and actually your config file contents), and not some exported jupyter cell output, then that's your problem. That's not even close to being a valid config file. Is this actually the contents of that config file - C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py?

print(open(saspy.SAScfg).read()) { "cells": [ { "cell_type": "code", "execution_count": null, "id": "c2c53d77", "metadata": {}, "outputs": [], "source": [ "SAS_config_names=['oda']\n", "oda = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe',\n", "#US Home Region 1\n", "'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],\n", "#US Home Region 2\n", "#'iomhost' : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com '],\n", "#European Home Region 1\n", "#'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com '],\n", "#Asia Pacific Home Region 1\n", "#'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com '],\n", "#Asia Pacific Home Region 2\n", "#'iomhost' : ['odaws01-apse1-2.oda.sas.com','odaws02-apse1-2.oda.sas.com'],\n", "'iomport' : 8591,\n", "'authkey' : 'oda',\n", "'encoding' : 'utf-8'\n", "}" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1432018535, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4HE3UOFAMD2C3632XLWXU7BXANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

Can you show me your config file. Yes, I can and have been trying to help. I wrote saspy. I know how it works. Can you how me your config file please.

ErisConsulting commented 1 year ago

Where can I find my config file?

On Wed, Feb 15, 2023 at 4:17 PM Tom Weber @.***> wrote:

Can you show me your config file. Yes, I can and have been trying to help. I wrote saspy. I know how it works. Can you how me your config file please.

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1432046107, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4AG32IJIKV56JZMQJDWXVBYBANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py

ErisConsulting commented 1 year ago

I have it located in

C:\Users\m0k0871\Anaconda3\Lib\site-packages\saspy

Below are the contents of that file:

{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "c2c53d77", "metadata": {}, "outputs": [], "source": [ "SAS_config_names=['oda']\n", "oda = {'java' : 'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath\\java.exe',\n", "#US Home Region 1\n", "'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com',' odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],\n", "#US Home Region 2\n", "#'iomhost' : ['odaws01-usw2-2.oda.sas.com','odaws02-usw2-2.oda.sas.com '],\n", "#European Home Region 1\n", "#'iomhost' : ['odaws01-euw1.oda.sas.com','odaws02-euw1.oda.sas.com '],\n", "#Asia Pacific Home Region 1\n", "#'iomhost' : ['odaws01-apse1.oda.sas.com','odaws02-apse1.oda.sas.com '],\n", "#Asia Pacific Home Region 2\n", "#'iomhost' : ['odaws01-apse1-2.oda.sas.com',' odaws02-apse1-2.oda.sas.com'],\n", "'iomport' : 8591,\n", "'authkey' : 'oda',\n", "'encoding' : 'utf-8'\n", "}" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }

On Wed, Feb 15, 2023 at 4:20 PM Tom Weber @.***> wrote:

C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1432048932, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4FVLZJYMT6JKENVST3WXVCCNANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

That's completely wrong and the cause of your errors. Why is it full of jupyter cell metadata output? Based upon what I can tell it should contain nothing but the following (assuming those are the right values for you). Where did you come up with the contents you have in it?

SAS_config_names=['oda']

oda = {'java' : 'C:\\Program Files (x86)\\CommonFiles\\Oracle\\Java\\javapath\\java.exe',
       #US Home Region 1\n",
       'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],
       'iomport' : 8591,
       'authkey' : 'oda',
       'encoding' : 'utf-8'
    }
tomweber-sas commented 1 year ago

Assuming the values you showed are correct for your system and ODA account, then I'm sure the next problem you will have is what's documented in this section: https://sassoftware.github.io/saspy/configuration.html#attn-as-of-saspy-version-3-3-3-the-classpath-is-no-longer-required-in-your-configuration-file

ODA now requires that the 3 encryption jars be included in the saspy deployment. The doc for this ODA requirement in in that section of doc, but I'll just paste it here. You have to follow these instruction and put the 3 jars (from the download, then extract them) into this directory: C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\java\iomclient\

ATTN: SAS ODA Users!! SAS/On Demand for Academics (ODA) has recently upgraded their SAS server environment to
use SAS 9.40M7! This means that the 3 encryption jars are now required in order to be able to connect; they use AES
encryption, and even with Java 8, you can no longer connect without these jars in the deployment. Since you don’t
necessarily have a SAS deployment to get these jars from, you can download them from the following location. 
Download, unzip and then copy them to the java/iomclient directory of the SASPy deployment, as explained above. 
Encryption jar download: https://support.sas.com/downloads/package.htm?pid=2494.
ErisConsulting commented 1 year ago

I got the contents from the SAS instructions for SASpy. That is why I said it is confusing and not useful. With that said, if you can please let me know:

1. What should I have in the file? 2. Where should I save it? 3. How can I test the connection?

Please keep it simple, my interest is not in the intricacies of the set-up, I just want to be able to run analysis and address a host of business problems using SAS.

On Wed, Feb 15, 2023 at 4:32 PM Tom Weber @.***> wrote:

That's completely wrong and the cause of your errors. Why is it full of jupyter cell metadata output? Based upon what I can tell it should contain nothing but the following (assuming those are the right values for you). Where did you come up with the contents you have in it?

SAS_config_names=['oda']

oda = {'java' : 'C:\Program Files (x86)\CommonFiles\Oracle\Java\javapath\java.exe',

US Home Region 1\n",

   'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'],
   'iomport' : 8591,
   'authkey' : 'oda',
   'encoding' : 'utf-8'
}

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1432062096, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4CVPNZQAZJDDN55NADWXVDOLANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

Have you read the previous two posts? I showed you the file name and what the contents should be. Then you need to add the jars to the deployment to access ODA (which it seems like you are). Then you submit sas = saspy.SASsession()

In no instructions, nor the example config file, does it have anything that looks like what you have in that config file. Can you point me at the SAS instructions for SASpy that you mentioned, that has all of that jupyter cell metadata as the contents of the config file? I'll need to address that since it's completely wrong. Don't want anyone else finding that, wherever it is.

Thanks, Tom

ErisConsulting commented 1 year ago

I will try your suggestion after my meetings and let you know. Thank you. Sent from my iPhoneOn Feb 15, 2023, at 4:56 PM, Tom Weber @.***> wrote: Have you read the previous two posts? I showed you the file name and what the contents should be. Then you need to add the jars to the deployment to access ODA (which it seems like you are). Then you submit sas = saspy.SASsession() In no instructions, nor the example config file, does it have anything that looks like what you have in that config file. Can you point me at the SAS instructions for SASpy that you mentioned, that has all of that jupyter cell metadata as the contents of the config file? I'll need to address that since it's completely wrong. Don't want anyone else finding that, wherever it is. Thanks, Tom

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

ErisConsulting commented 1 year ago

Hello Tom -

I have performed the following:

1. I have updated my (sascfg_personal) to have the following syntax:

SAS_config_names=['oda']

oda = {'java' : 'C:\Program Files (x86)\CommonFiles\Oracle\Java\javapath\java.exe',

US Home Region 1\n",

   'iomhost' : ['odaws01-usw2.oda.sas.com','odaws02-usw2.oda.sas.com','

odaws03-usw2.oda.sas.com','odaws04-usw2.oda.sas.com'], 'iomport' : 8591, 'authkey' : 'oda', 'encoding' : 'utf-8' }

2. I have it saved (sascfg_personal) in - C:\Users\m0k0871\Anaconda3\Lib\site-packages\saspy

*3. I have downloaded and save the jar files in

4. I submitted sas = saspy.SASsession() in a python notebook and it is asking for the _authinfo ?

Thanks MK.

On Wed, Feb 15, 2023 at 4:56 PM Tom Weber @.***> wrote:

Have you read the previous two posts? I showed you the file name and what the contents should be. Then you need to add the jars to the deployment to access ODA (which it seems like you are). Then you submit sas = saspy.SASsession()

In no instructions, nor the example config file, does it have anything that looks like what you have in that config file. Can you point me at the SAS instructions for SASpy that you mentioned, that has all of that jupyter cell metadata as the contents of the config file? I'll need to address that since it's completely wrong. Don't want anyone else finding that, wherever it is.

Thanks, Tom

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1432094428, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4H4NBCQTXMVL7ZHOR3WXVGJ5ANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

Ok, that all sounds better. What do you mean its asking for the _authinfo? Show me what you submitted and the output (all of it) that was produced. We should be getting somewhere now. But I need to actually see the code and errors or whatever it shows. Thanks, Tom

ErisConsulting commented 1 year ago

Great. Also, please note that I have both the desktop and On Demand Version of SAS if that makes a difference.

Submitted:

import saspy import pandas as pd import saspy, os print(saspy.file.replace('init.py', 'sascfg_personal.py'))

print(saspy.file.replace('init.py', 'java%siomclient' % os.sep))

sas = saspy.SASsession()

Result:

C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sascfg_personal.py Using SAS Config named: oda Error trying to read authinfo file:C:\Users\m0k0871_authinfo [Errno 2] No such file or directory: 'C:\Users\m0k0871\_authinfo' Did not find key oda in authinfo file:C:\Users\m0k0871_authinfo

Please enter the OMR user id:

On Thu, Feb 16, 2023 at 10:59 AM Tom Weber @.***> wrote:

Ok, that all sounds better. What do you mean its asking for the _authinfo? Show me what you submitted and the output (all of it) that was produced. We should be getting somewhere now. But I need to actually see the code and errors or whatever it shows. Thanks, Tom

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1433318517, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4EAVLJTGM67KYWWKHDWXZFH3ANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

Please enter the OMR user id: And did you type in your id and pw? Did it connect?

You have the 'authkey' in your config. But you didn't create the _authinfo file and add your credentials? That's what happened, but it prompted you for your credentials. Did you type them in and connect?

tomweber-sas commented 1 year ago

BTW here's the doc about how to use the _authinfo file for your credentials, so you don't have to type them in each time: https://sassoftware.github.io/saspy/configuration.html#the-authinfo-file-authinfo-on-windows

ErisConsulting commented 1 year ago

Thanks -

  1. Just to confirm, which exact user ID and PASSWORD is this looking for? for SAS/On Demand for Academics (ODA)?
  2. Could I add 'authkey' : 'oda', AND oda user XXX password XXX to the config file? or where?

On Thu, Feb 16, 2023 at 11:24 AM Tom Weber @.***> wrote:

BTW here's the doc about how to use the _authinfo file for your credentials, so you don't have to type them in each time: https://sassoftware.github.io/saspy/configuration.html#the-authinfo-file-authinfo-on-windows

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1433355255, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4AQO4TXL3ISXR22U53WXZICHANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

Do you have an ODA account? It want's your ODA credentials. Did you just try typing them in and see if it connects? The instructions for using _authinfo are in the previous post (but of course, simply in the doc for saspy.

ErisConsulting commented 1 year ago

Yes, I have a SAS ODA account.

My ODA account is my: Email and Password.

When I enter it, it does not work.

On Thu, Feb 16, 2023 at 11:39 AM Tom Weber @.***> wrote:

Do you have an ODA account? It want's your ODA credentials. Did you just try typing them in and see if it connects? The instructions for using _authinfo are in the previous post (but of course, simply in the doc for saspy https://sassoftware.github.io/saspy/index.html.

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1433377387, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4GOZQ6ACTMOWUISILDWXZJ2PANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

ErisConsulting commented 1 year ago

Do you recommend I reach out to SAS for this? Thanks. Regards.

On Thu, Feb 16, 2023 at 11:46 AM Michael @ Eris Consulting < @.***> wrote:

Yes, I have a SAS ODA account.

My ODA account is my: Email and Password.

When I enter it, it does not work.

On Thu, Feb 16, 2023 at 11:39 AM Tom Weber @.***> wrote:

Do you have an ODA account? It want's your ODA credentials. Did you just try typing them in and see if it connects? The instructions for using _authinfo are in the previous post (but of course, simply in the doc for saspy https://sassoftware.github.io/saspy/index.html.

— Reply to this email directly, view it on GitHub https://github.com/sassoftware/saspy/issues/529#issuecomment-1433377387, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJWR4GOZQ6ACTMOWUISILDWXZJ2PANCNFSM6AAAAAAUZQZCOA . You are receiving this because you authored the thread.Message ID: @.***>

-- Partner & Solutions Consultant Michael Kaushansky

-- Partner & Solutions Consultant Michael Kaushansky

tomweber-sas commented 1 year ago

I see you opened a TS track. I also see that you actually showed the the error you got, as opposed to just When I enter it, it does not work. which isn't helpful as I can't help you without having any idea what happened, or what you actually submitted.

The error you are getting now:

The OS Error was:
The system cannot find the file specified

is simply that you don't have java in the path you put in your config file. See here: https://sassoftware.github.io/saspy/troubleshooting.html#java-problems

Do you have Java installed on you machine? If so, put the correct path to it in the config file so it can be found.

ErisConsulting commented 1 year ago

I do have java installed in: C:\Program Files (x86)\Common Files\Oracle\Java\javapath

ErisConsulting commented 1 year ago

Would be able to get on Zoom for like 5 mins, I bet we can fix this very quickly?

ErisConsulting commented 1 year ago

I was finally able to establish a connection. But the SAS connection still has bugs. For example:

hr = sas.read_csv("./HR_comma_sep.csv")

hr = sas.read_csv("C:/Users/m0k0871/Downloads/Baton Rouge LA Employee Salaries Test.csv")

C:\Users\m0k0871\Anaconda3\lib\site-packages\saspy\sasioiom.py:1033: UserWarning: Noticed 'ERROR:' in LOG, you ought to take a look and see if there was a problem warnings.warn("Noticed 'ERROR:' in LOG, you ought to take a look and see if there was a problem")

tomweber-sas commented 1 year ago

Did you look at the error? I'm sure it's about the file you're trying to have SAS read in not existing, since SAS is remote and can't access the C drive on your client PC. You can either upload it to the SAS server and then use read_csv or read it in locally with pandas and convert it to a SAS data set on the server using df2sd. I expect there are other ways using other ODA processes to load local data to your work area on the server side, but I don't really know about that as I don't use ODA myself.

I'm going to close this issue, since it was about trying to get your config file correct, which finally seems to be good. The API doc is here: https://sassoftware.github.io/saspy/api.html# And I suggest you read through the example notebook here, to learn how you use features of SASPy: https://github.com/sassoftware/saspy-examples/blob/main/SAS_contrib/Ask_the_Expert_Demo.ipynb That's the demo notebook for an Ask the Expert presentation of SASPy, you can also access and watch it to learn more: https://communities.sas.com/t5/Ask-the-Expert/Ask-the-Expert-SASPy-Demo-Q-amp-A-Slides-Demo-Notebook-and-On/ta-p/764217