Nike-Inc / gimme-aws-creds

A CLI that utilizes Okta IdP via SAML to acquire temporary AWS credentials
Apache License 2.0
927 stars 263 forks source link

Gimme-aws-creds no longer works in Powershell after updating from 2.3.1 to 2.3.3 #188

Open privojaime opened 4 years ago

privojaime commented 4 years ago

2.3.1 was running perfectly today in Powershell. As soon as I ran pip3 install --upgrade gimme-aws-creds, I type in gimme-aws-creds and I get nothing. Not sure how I can see the errors, or force an install of the older version (I'm currently working on that)

Thanks! -Jaime

bicasoft commented 4 years ago

I got the same error. And nothing seems to fix it.

curtis-turner commented 4 years ago

Just adding so we can see how many are impacted by this. I have the same issue, I rolled back with pip uninstall gimme-aws-creds and then pip install gimme-aws-creds==2.3.1 and that seems get things working again.

Sector95 commented 4 years ago

In 2.3.2 there was a change to the batch file that enforced the use of Python 3 in environments where more than one version of Python is installed.

185

Can you guys elaborate more on your Windows environment please?

curtis-turner commented 4 years ago

Hey @Sector95 my environment is as follows

I only have Python 3.8.2 installed, windows 10, I manage my dependencies using pipenv. I flipped the echo OFF to ON to see the output and here is what i got.

"C:\Users\Curtis Turner\AppData\Local\Microsoft\WindowsApps\python3.exe" -x "C:\Users\Curtis Turner.virtualenvs\aws_scripts-15QqIJ3N\Scripts\gimme-aws-creds.cmd"

So it looks like it is detecting a different version of python 3 than it should I am looking into how to remove that if possible. hopefully this helps let me know if you need any more details.

I found this helpful link here on how to disable the windows apps python alias

https://superuser.com/questions/1437590/typing-python-on-windows-10-version-1903-command-prompt-opens-microsoft-stor

it helped but still not running correctly.

Here is the full error output

`gimme-aws-creds.cmd

REM="""

setlocal

set PythonExe=""

set PythonExeFlags=

for %i in (cmd bat exe) do (for %j in (python3.%i) do (call :SetPythonExe "%~$PATH:j" ) )

(for %j in (python3.cmd) do (call :SetPythonExe "%~$PATH:j" ) )

(call :SetPythonExe "" )

if not [""] == [""] (if [""] == [""] (set PythonExe="" ) )

goto :EOF

(for %j in (python3.bat) do (call :SetPythonExe "%~$PATH:j" ) )

(call :SetPythonExe "" )

if not [""] == [""] (if [""] == [""] (set PythonExe="" ) )

goto :EOF

(for %j in (python3.exe) do (call :SetPythonExe "%~$PATH:j" ) )

(call :SetPythonExe "" )

if not [""] == [""] (if [""] == [""] (set PythonExe="" ) )

goto :EOF

for /F "tokens=2 delims==" %i in ('assoc .py') do (for /F "tokens=2 delims==" %j in ('ftype %i') do (for /F "tokens=1" %k in ("%j") do (call :SetPythonExe %k ) ) )

(for /F "tokens=2 delims==" %j in ('ftype pyautofile') do (for /F "tokens=1" %k in ("%j") do (call :SetPythonExe %k ) ) )

(for /F "tokens=1" %k in (""C:\Users\Curtis Turner\AppData\Local\Programs\Python\Python38-32\python.exe"") do (call :SetPythonExe %k ) )

(call :SetPythonExe "C:\Users\Curtis )

if not ["C:\Users\Curtis"] == [""] (if [""] == [""] (set PythonExe="C:\Users\Curtis" ) )

goto :EOF

"C:\Users\Curtis" -x "C:\Users\Curtis Turner\AppData\Local\Programs\Python\Python38-32\Scripts\gimme-aws-creds.cmd" '"C:\Users\Curtis"' is not recognized as an internal or external command, operable program or batch file.

exit /B 9009`

Sector95 commented 4 years ago

Hm. Looks like the space in your user folder's name is causing issues... Let me see what I can find.

bicasoft commented 4 years ago

Hi Sector95, I also have Python 3.8.2 and Windows 10. I have installed Python via Chocolatey v0.10.15

Sector95 commented 4 years ago

Can you guys pull down this branch and test it for me? https://github.com/Nike-Inc/gimme-aws-creds/tree/win-path-fix

pip uninstall gimme-aws-creds
git clone https://github.com/Nike-Inc/gimme-aws-creds/tree/win-path-fix
cd \path\to\gimme-aws-creds
pip install .
curtis-turner commented 4 years ago

Just tested it got another error.

gimme-aws-creds The syntax of the command is incorrect.

Sector95 commented 4 years ago

Thanks for the testing help!

I think we've got it this time, if you would uninstall, reinstall, and test like above one more time, I'd appreciate it!

curtis-turner commented 4 years ago

Sure thing give me a few minutes and i'll report back.

Here is the output still not working.

gimme-aws-creds.cmd '"C:\Users\Curtis"' is not recognized as an internal or external command, operable program or batch file.

curtis-turner commented 4 years ago

I think I got it fixed with some messing about with the cmd file let me pull the repo and push my edits.

this seemed to make it work -> "tokens=1 delims=^"

Sector95 commented 4 years ago

Odd, that was working on my Windows machine... Makes me nervous that we're getting such divergent behavior.

The odd thing with that solution is that we've opened the quotes, then escaped the closing quote... I'll try it on my machine as well.

curtis-turner commented 4 years ago

Yeah that does seem weird.... I think I might move to just using the docker container for this since that should at least isolate the environment to inside the container.

curtis-turner commented 4 years ago

I just tested it again with this change - "tokens=1 delims=" and it seems to work as well so that might be a better solution as it does not escape the last double quote.

Sector95 commented 4 years ago

That behavior doesn't work on my end, because the output of the ftype command on my computer has multiple values output:

C:\WINDOWS\system32>assoc .py
.py=Python.File

C:\WINDOWS\system32>ftype Python.File
Python.File="C:\WINDOWS\py.exe" "%L" %*

delims= causes it to capture the whole line, whereas we just want the first object in quotes.

curtis-turner commented 4 years ago

I moved my Python install to my root C:\ and I get the same results from those commands for the file association. This also gets rid of the space in the path issue as its just at C:\Python38-32

assoc .py .py=Python.File

ftype Python.File Python.File="C:\Windows\py.exe" "%L" %*

and i reinstalled gimme-aws-creds==2.3.3 from pypi and it is working in my current configuration

lw-cchapin commented 4 years ago

Greetings- any updates on the best way to get the latest version working on Windows 10? I'm still having issues past 2.3.1. Thank you!

kylecompassion commented 3 years ago

Would love to see this fixed so we can reliably use >2.3.1 on Windows machines

iniquityx2 commented 3 years ago

agreed.. I have not been able to update for a while now. I tried again yesterday to see if the issue reported in https://github.com/Nike-Inc/gimme-aws-creds/issues/302 would be resolved by the upgrade. It wasn't of course.

Now that the proposed fix is being merged, if it is not packported to 2.3.1 then windows users will still have issues.

Of course we can manually update the code but this is not ideal.

lw-cchapin commented 3 years ago

Greetings- any updates on the best way to get the latest version working on Windows 10? I'm still having issues past 2.3.1. Thank you!

Not sure of the reasonings - but between Python 3.9.6 and gimme-aws-creds 2.4.3 this is now working on Windows 10 for me, where I was previously stuck on 2.3.1.

iniquityx2 commented 3 years ago

@PrivoChapin I tried that fix but it didn't pan out for me. I used the windows 64 installer on (https://www.python.org/downloads/release/python-396/), chose to add python to environment checkbox of course. Then did pip3 install --upgrade gimme-aws-creds

However, after that changed the error and that lead me to this stack exchange article.

error:

"Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases."

https://stackoverflow.com/questions/65348890/python-was-not-found-run-without-arguments-to-install-from-the-microsoft-store

Using the second suggestion "3.Go to -> "start" and type "Manage App Execution Aliases" .Go to it and turn off "python"

and unchecking both of the python radio dots worked.

iniquityx2 commented 3 years ago

which is also apparently solved here lol

https://github.com/Nike-Inc/gimme-aws-creds/issues/257