Aws-cli: aws cli warning on Windows - no file association for .py

Created on 23 Aug 2018  ·  11Comments  ·  Source: aws/aws-cli

Using aws cli with pythno 3 on Windows, always getting a warning, but the program runs well after this message.

For example:

>>> aws --version --debug
Не найдено сопоставление для расширения имени файла .py.
aws-cli/1.15.83 Python/3.6.0 Windows/7 botocore/1.10.82

(vaguely -' Cannot find association for filename extension .py')

Any idea which part of aws scripts issues this warning and how to fix it? At what part does aws use Windows call?

closing-soon response-requested

Most helpful comment

I was able to resolve the problem by implementing a fix from this site:

To fix “File association not found for extension .py” on Windows, I executed the following two commands in a cmd.exe with administrator privileges:

assoc .py=pyautofile

ftype pyautofile="C:\Anaconda2\python.exe" "%1" %*

I changed the filename to the location of my python executable.

All 11 comments

@epogrebnyak - thanks for reaching out. I was not able to reproduce the same error. It appears the warning is related to the installation of Python 3 and not the CLI.

It appears you have already reached out to the Stack Overflow community.

What method or step were used with the CLI installation on the Windows platform? Did you use the MSI installer as recommended in our online documentation?

awscli install windows documentation

The setup is anaconda python installation (through MSI) and awscli pip install.

I understand one way to go is awscli MSI installer, but I'm restricted to current setup on this computer.

Unfortunately Stack Overflow was not too instructive to spot the source of my error. Normally .py extension is associated with an editor of choice, not python executable, so appearance of this warning is not clear.

I'm expecting the warnign originates somewhere these lines, but could not isolate where exactly:

https://github.com/aws/aws-cli/blob/b1a6e27a8cec4a177280826d3802813ee5afafe1/bin/aws.cmd#L1-L31

I'm solving this an edge case for the setup I have, and seeking advice, and not proposing change in your code base, just to be clear. Windows installations are too tricky.

I had the same problem once upon a time. Would have been solved by https://github.com/aws/aws-cli/pull/2005, had it been merged, or the change to use setuptools entry points, had that change not been reverted.

@lorengordon - thanks so much for a clue about https://github.com/aws/aws-cli/pull/2005!

Diverting stderr to null as 'assoc .py 2^> nul' in aws.cmd really solves the problem in one line.

I changed it localy , but I can only back merging the PR in code: https://github.com/aws/aws-cli/pull/2005. Strage it was closed without action. @justnance - perhaps you can reopen?

  • #2562, #2372, and #2581

@epogrebnyak and @lorengordon - Thanks for referencing #2005. Let's keep #2005 closed for now and track process on the current (#3518) issue.

@epogrebnyak this did not resolve the issue for me.

Diverting stderr to null as 'assoc .py 2^> nul' in aws.cmd really solves the problem in one line.

I was able to resolve the problem by implementing a fix from this site:

To fix “File association not found for extension .py” on Windows, I executed the following two commands in a cmd.exe with administrator privileges:

assoc .py=pyautofile

ftype pyautofile="C:\Anaconda2\python.exe" "%1" %*

I changed the filename to the location of my python executable.

Glad there is a fix that worked for you @sabotagebeats). Still unclear why aws-cli/bin/aws.cmd does not search associations silently.

@epogrebnyak - Thanks for your feedback. It is possible part of this issue was related to #3662 which was resolved around the time of your last reply. Are you still seeing the aws-cli/bin/aws.cmd not searching associations silently?

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

Was this page helpful?
0 / 5 - 0 ratings