Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My sascfg_personal.py is something wrong. #629

Open
YuttyGitHub opened this issue Feb 3, 2025 · 9 comments
Open

My sascfg_personal.py is something wrong. #629

YuttyGitHub opened this issue Feb 3, 2025 · 9 comments

Comments

@YuttyGitHub
Copy link

Hi Matthew and Tom,

I would like you two to give me some advise for setting sascfg_personal.py.

The sascfg_personal that I set is the below:

SAS_config_names=["autogen_winlocal"]
SAS_config_options = {
"lock_down": False,
"verbose" : True
}
cpW = r";C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\aspyiom.jar"
autogen_winlocal = {
"java" : "java",
"encoding" : "utf_8",
"classpath" : cpW
}
import os
os.environ["PATH"] += ";C:\Program Files\SASHome\SASFoundation\9.4\core\sasext"

And I executed the following python code (saspy_check.py) to confirm whether the above setting is correct or not:

import saspy
from IPython.display import HTML
print("SASPy version is: " + saspy.version)
sas = saspy.SASsession()

However, there are some ERROR on the log.

No SAS process attached. SAS process has terminated unexpectedly.
Traceback (most recent call last):
File "c:\Users....\saspy_check.py", line 7, in
sas = saspy.SASsession()
^^^^^^^^^^^^^^^^^^
File "C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\sasbase.py", line 620, in init
res = self._io.submit(sysvars, "text")['LOG']
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\sasioiom.py", line 905, in submit
raise SASIOConnectionTerminated(Exception)
saspy.sasexceptions.SASIOConnectionTerminated: No SAS process attached. SAS process has terminated unexpectedly.
<class 'Exception'>

I could not find the solution. Would it be possible to resolve this?

Thankyou,
Yutty

Originally posted by @YuttyGitHub in #627

@tomweber-sas
Copy link
Contributor

Well the first problem is that you're specifying a bad classpath. You shouldn't be specifying any class path. That's been addressed since years ago. See the doc here: 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
The other things in your config that may be an issue (I can't tell at this point), are that you specify java as 'java'. Is 'java' found on your system w/out having to provide the full path? If so, then that's fine. Actually, I'd expect a different error if that wasn't found, so it's probably ok.
Then the path specification for
os.environ["PATH"] += ";C:\Program Files\SASHome\SASFoundation\9.4\core\sasext"
should probably have the r'' added or double up al the backslashes, since this is windows.
Other than that, it looks fine as all you really need is the valid path to java and that sspiauth.dll directory in the path; and you have both of those - just be sure they're coded right. So remove classpath and see if you're good to go.

@YuttyGitHub
Copy link
Author

Hi @tomweber-sas ,

Thank you for your comment.
I updated sascfg_personal.py as your advice:

  • deleted classpath
  • add r'' to the path.
    And then, saspy_check.py has been executed again.

`
SAS_config_names=["autogen_winlocal"]

SAS_config_options = {
"lock_down": False,
"verbose" : True
}
cpW = r";C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\aspyiom.jar"
autogen_winlocal = {
"java" : "java",
"encoding" : "utf_8",
}
import os
os.environ["PATH"] += r";C:\Program Files\SASHome\SASFoundation\9.4\core\sasext"
`

But there are still ERROR.

`
SASPy version is: 5.101.1
Using SAS Config named: autogen_winlocal
The OS Error was:
指定されたファイルが見つかりません。
SAS Connection failed. No connection established. Double check your settings in sascfg_personal.py file.
Attempted to run program java with the following parameters:
['java', '-classpath',
'C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\saspyiom.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\log4j-1.2-api-2.12.4.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\log4j-api-2.12.4.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\log4j-core-2.12.4.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.security.sspi.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.core.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.svc.connection.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.rutil.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.rutil.nls.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sastpj.rutil.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\glassfish-corba-internal-api.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\glassfish-corba-omgapi.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\glassfish-corba-orb.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\pfl-basic.jar;
C:\Users\[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\pfl-tf.jar',
'pyiom.saspy2j', '-host', 'localhost', '-stdinport', '58818', '-stdoutport', '58819', '-stderrport', '58820', '-cancelport', '58821', '-zero', '-lrecl', '1048576', '']

If no OS Error above, try running the following command (where saspy is running) manually to see what is wrong:
java -classpath "C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\saspyiom.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\log4j-1.2-api-2.12.4.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\log4j-api-2.12.4.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\log4j-core-2.12.4.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.security.sspi.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.core.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.svc.connection.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.rutil.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sas.rutil.nls.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\iomclient\sastpj.rutil.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\glassfish-corba-internal-api.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\glassfish-corba-omgapi.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\glassfish-corba-orb.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\pfl-basic.jar;
C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\java\thirdparty\pfl-tf.jar"
pyiom.saspy2j -host localhost -stdinport 58818 -stdoutport 58819 -stderrport 58820 -cancelport 58821 -zero -lrecl 1048576

No SAS process attached. SAS process has terminated unexpectedly.
Traceback (most recent call last):
File "c:\Users[User-Name]...\saspy_check.py", line 7, in
sas = saspy.SASsession()
^^^^^^^^^^^^^^^^^^
File "C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\sasbase.py", line 620, in init
res = self._io.submit(sysvars, "text")['LOG']
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users[User-Name]\AppData\Local\Programs\Python\Python312\Lib\site-packages\saspy\sasioiom.py", line 905, in submit
raise SASIOConnectionTerminated(Exception)
saspy.sasexceptions.SASIOConnectionTerminated: No SAS process attached. SAS process has terminated unexpectedly.
<class 'Exception'>
`

@tomweber-sas
Copy link
Contributor

The other things in your config that may be an issue (I can't tell at this point), are that you specify java as 'java'. Is 'java' found on your system w/out having to provide the full path? If so, then that's fine. Actually, I'd expect a different error if that wasn't found, so it's probably ok.
Yeah, well, no. It's not ok. Did you try running the command yourself like the error message said? If so I expect you'd see similar results as here: https://sassoftware.github.io/saspy/troubleshooting.html#java-problems
Looks like you need to specify the path to java.exe, as it's not being found just saying 'java':

The OS Error was:
指定されたファイルが見つかりません。
SAS Connection failed. No connection established. Double check your settings in sascfg_personal.py file.

which is the same as this, I believe:

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

SAS Connection failed. No connection established. Double check your settings in sascfg_personal.py file.

@tomweber-sas
Copy link
Contributor

Did you provide the path to java.exe and get it to work?

@YuttyGitHub
Copy link
Author

I found that there is no java.exe in the PC, so I requested IT department to install it.
It is going to be installed next week.
Would it be possible to keeping this issue ongoing?

Thank you,
Yutty

@tomweber-sas
Copy link
Contributor

Sure @YuttyGitHub, we can keep this open until you can try this out.

@YuttyGitHub
Copy link
Author

I found java.exe by using command prompt. There is java.exe in the following path:
C:\Program Files (x86)\Common Files\Oracle\Java\java8path\java.exe

SAS_config_names=["autogen_winlocal"] SAS_config_options = { "lock_down": False, "verbose" : True } cpW = r";C:\\Users\\[User-Name]\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\saspy\\java\\aspyiom.jar" autogen_winlocal = { "java" : r"C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\java8path\\java.exe", "encoding" : "utf_8", "classpath" : cpW } import os os.environ["PATH"] += ";C:\\Program Files\\SASHome\\SASFoundation\\9.4\\core\\sasext"

The log is below and it seems that there is no error, but the execution has not been completed for a long time.
SASPy version is: 5.101.1
Using SAS Config named: autogen_winlocal

@YuttyGitHub
Copy link
Author

I found where java.exe is.
C:\Program Files (x86)\Common Files\Oracle\Java\java8path\java.exe

So I updated sascfg_personal.py like the following way and executed saspy_check.py:

SAS_config_names=["autogen_winlocal"]
SAS_config_options = {
	"lock_down": False,
	"verbose"  : True
	}
cpW = r";C:\\Users\\[User-Name]\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\saspy\\java\\aspyiom.jar"
autogen_winlocal = {
	"java"      : r"C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\java8path\\java.exe",
	"encoding"  : "utf_8",
	"classpath" : cpW
	}
import os
os.environ["PATH"] += ";C:\\Program Files\\SASHome\\SASFoundation\\9.4\\core\\sasext"

The log is below, but the execution has not been completed for a long time.
I would appreciate it if you would have any solutions for this.

SASPy version is: 5.101.1
Using SAS Config named: autogen_winlocal

@tomweber-sas
Copy link
Contributor

you put the bad classpath back in what you're showing me, and I don't see any error, but that's certainly the problem now if that's what you're actually using. Please remove these lines from your config:

cpW = r";C:\\Users\\[User-Name]\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\saspy\\java\\aspyiom.jar"

	"classpath" : cpW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants