Closed sourabh2404 closed 1 year ago
Well, I haven't heard of that tool before. Seems interesting. So, can I assume that if you just run that code in Python it works? Assuming so, it would seem you would probably need to see about bundling in all the rest of the files from the saspy deployment that it will end up needing; I doubt the config file is the only one, I expect it'll need the jar files since your using IOM.
I would take a look at the section of their doc on packaging in other files to the bundle they create: https://pyinstaller.org/en/stable/runtime-information.html
I have no idea if this tool will work with saspy, since it's not a simple python program. But maybe including the rest of the files saspy will need into the bundle it creates might happen to work?
Hi Tom, thanks for the quick reply. Actually, the purpose of creating a .exe file is because the system I want to run the program doesn't have python installed.
I have tried writing the code another way also.
---------------------Start----------------------------------- import saspy
try:
# Create a new SAS session
config_path = r'D:\sascfg_personal.py'
print("Config File Loaded:- "+ config_path)
sas_session = saspy.SASsession(cfgfile=config_path, cfgname='iomlinux')
print("SAS Connection Successful")
# End the SAS session
sas_session.endsas()
except Exception as error: error_string = str(error) print("Error Has Occurred ---> " +error_string)
---------------------END---------------------
sascfg_personal.py SAS_config_names = ['iomlinux']
'iomlinux'= { 'java': 'C:\Program Files\Java\jre1.8.0_341\bin\java.exe', 'iomhost': '10.**', 'iomport': 8591, 'encoding': 'utf-8', 'omruser': 'omruser', 'omrpw':'omrpwd' }
again creating an .exe for the above code using pyinstaller, I'm getting the error as below:
Can you please advise. Thanks in advance.
It seemed referencing the config file happened to cause it to be included in the bundle, I guess. Or you 're running on the machine where that path happens to resolves at runtime. The next error is the jar file not being found. That's the next thing I expected you'd run into. You ought o look at their instructions (the link I posted before) about including these files they way they provide so they can be found in their bundle they build. Again, I don't know if this tool will be able to create this right such that it really works, but maybe. Look at their doc about including these other required files and see if you can get it to work.
Hi Tom, Thanks a lot for your advice. After providing the jar files at the proper step at runtime, now the code is able to connect to the SAS server and access the data.
Hey, that's really cool! I'd never heard of that tool before, and wasn't sure it would really work, but that's great news! Awesome!
Describe the bug
Hi, I' trying to connect to SAS Instance in python, based on the following thread:- without a sascfg_personal.py file
https://github.com/sassoftware/saspy/issues/410
My code is as follows:-
---------------Start-------------------- import saspy
iomj = {'java': "C:\Program Files\Java\jre1.8.0_341\bin\java.exe'', 'iomhost': 10.**, 'iomport': 8591, 'encoding': 'utf-8', 'omruser': omruser, 'omrpw': omrpw }
try:
sas = saspy.SASsession(**iomj) print("SAS Connection Successful !!") except Exception as error: error_string = str(error) print("Error Has Occurred ---> " +error_string)
------------End----------------------------
After this, I convert this .py script to a .exe using pyinstaller. When I try to run the .exe i'm getting the following error:
No Module named 'sascfg'
Can you please advise.