When I connect using
sas = saspy.SASsession(cfgname='winlocal')
I get
Did not find key AKEY in authinfo file:C:\Users\myuser\_authinfo
The format of _authinfo is correct, followed docs and is exactly this:
AKEY user <myuser> password <mypassword>
If I log in when prompted everything works, I am connected and can run queries, access tables etc. The only thing not working is the authkey. Permissions on _authinfo allow access as well.
Can you try just saving it as ASCII? Grasping at straws here, but let's eliminate all possibilities that it's some odd ball encoding issue. I think you could just cut and paste into a Notepad, taking care to delete the .txt extension afterwards (or saving as type *.*).
Jim
This may not be the issue, but let's eliminate one possible cause of this problem. Open a Windows Explorer session and navigate to
C:\Users\myuser
Click on "View", "Options", and then "Change Folder and Search Options".
The below pop-up should appear. Make sure that the indicated check box is NOT checked. If it is checked, un-check it, and click "OK".
Now look for the file _authinfo with no file extension in your Windows Explorer session. This is the file that is being used. Now look for _authinfo.txt. This possibly is the file you saved if you used something like Notepad.exe to add your ID and password to the file. Windows automatically adds .txt if you use Notepad. You won't see this unless the check box in the options shown above is un-checked.
If there is a _authinfo.txt that has the correct ID and password, rename _authinfo (with no file extension) to _authinfo.bak and rename _authinfo.txt to just _authinfo. Try running again.
Jim
OK, worth a shot, and certainly one to eliminate up front.
And
Jim
If that's not the issue (again, just eliminating possibilities), then check this out and see if it sheds any light:
https://communities.sas.com/t5/SAS-Programming/Sas-Authkey/m-p/581062#M165112
Jim
Yeah I've seen that post. My format is the one quoted from the docs there, and my _authinfo file *is* being found, so I do not believe it applies here.
Well, crap. OK, see my response (will post in a few minutes) to my encoding response.
Jim
Can you try just saving it as ASCII? Grasping at straws here, but let's eliminate all possibilities that it's some odd ball encoding issue. I think you could just cut and paste into a Notepad, taking care to delete the .txt extension afterwards (or saving as type *.*).
Jim
That did it, well I guess its good to know that it requires ASCII.. Thanks! This is actually taking place on 1 of 2 computers I have this set up on, and on the first I believe I did use (regular) notepad and saved it w/o extension, and got the same result.
To clearly state what I did, I used the encoding drop-down menu in notepad++ to switch the encoding to ANSI.
OK, cool. (about time, lol)
Everything you were doing sounded right to me, so I started looking for oddball stuff like file extensions and encodings that would keep correctly coded parameters from working. Glad I finally got it right. I was running out of hunches. 🙂
Jim
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.