Closed gitmichaelcraig closed 1 year ago
Figured this out. Looks like the current versions doesn't gracefully handle if a cookie file doesn't exist, and the default path is at /root/.ynam_mint_api_cookies.
Doing touch .ynam_mint_api_cookies
in a directory you mount into /root for the container seems to get past it.
ynam knows how to recover from a missing cookie file. When it can't login, it calls MintAPI.updateAuth()
, which resets the cookie file, among other things. There might be a filesystem permissions issue that stops ynam from creating files, though, which could cause this error.
As @natescherer mentioned, the default location is in the home directory of whatever user it's running as. If you need it to be elsewhere, the --cookies
parameter is your friend
I'm not much well-versed in python so please forgive me in advance. I'm running macOS Monterey and tried getting the utility to work in Terminal and also trying to run in Docker. So I attempted to do a fresh install and run in Docker (building the image using the dockerfile in the ynam repo). When I go to run the container, I get this error...
2022-11-30 19:58:52 Traceback (most recent call last): 2022-11-30 19:58:52 File "/usr/local/lib/python3.8/dist-packages/ynam/main.py", line 21, in main 2022-11-30 19:58:52 mints = mapi.getXtns() 2022-11-30 19:58:52 File "/usr/local/lib/python3.8/dist-packages/ynam/api.py", line 84, in getXtns 2022-11-30 19:58:52 client.authorize(self.cookies(), self.key()) 2022-11-30 19:58:52 File "/usr/local/lib/python3.8/dist-packages/ynam/api.py", line 98, in cookies 2022-11-30 19:58:52 with open(self.cpath, 'r') as file: 2022-11-30 19:58:52 FileNotFoundError: [Errno 2] No such file or directory: '/root/.ynam_mintapi_cookies' 2022-11-30 19:58:52 2022-11-30 19:58:52 During handling of the above exception, another exception occurred: 2022-11-30 19:58:52 2022-11-30 19:58:52 Traceback (most recent call last): 2022-11-30 19:58:52 File "/usr/local/bin/ynam", line 8, in <module> 2022-11-30 19:58:52 sys.exit(main()) 2022-11-30 19:58:52 File "/usr/local/lib/python3.8/dist-packages/ynam/main.py", line 23, in main 2022-11-30 19:58:52 mapi.updateAuth() 2022-11-30 19:58:52 File "/usr/local/lib/python3.8/dist-packages/ynam/api.py", line 117, in updateAuth 2022-11-30 19:58:52 file.write(str(bowser._get_cookies())) 2022-11-30 19:58:52 File "/src/mintapi/mintapi/browser.py", line 214, in _get_cookies 2022-11-30 19:58:52 return self.driver.get_cookies() 2022-11-30 19:58:52 AttributeError: 'NoneType' object has no attribute 'get_cookies'
It does this whether I try to run manually in Terminal, or try to start the container in Docker
Also even after installing ynam with python3, I'm getting a
command not found
when trying to run the ynam function...I may have missed a number of steps.Thanks!