A
A
alekssamos2018-01-28 18:53:10
Python
alekssamos, 2018-01-28 18:53:10

Installing Python 3.6 on Win 32 issue with extensions and command line arguments on startup?

If run like this: script.py arg1 arg2 argN, then no arguments will be passed,
and if like this: python.exe script.py arg1 arg2 argN, then they will.
How to make, that in the first case arguments were transferred?
Editing

HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command
brought no result.
An example is below.
import sys
print("arguments:", str(len(sys.argv)))
for arg in sys.argv: print(arg)

launch:
D:\>script.py arg1 arg2 argN && python.exe script.py arg1 arg2 argN
arguments: 1
D:\script.py
arguments: 4
script.py
arg1
arg2
argN

By the way, the launcher doesn't work either:
D:\>py
"py" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.

Although in the installer (screen below) there are checkmarks.
At the very first installation, everything was fine, the launcher was also there, the .py and .pyw extensions were added automatically, in general, everything was fine.
Then I deleted the previous version and wanted to install another one. After the reinstallation, this started: the file extensions were not matched, and there is no launcher, and they are no longer installed in any way.
5a6dedab5e9d1793411966.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekssamos, 2018-01-29
@alekssamos

1. Solution: to pass arguments:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\pyw_auto_file\shell\open\command]
@="\"C:\\Users\\Alexey\\AppData\\Local\\Programs\\Python\\Python36-32\\pythonw.exe\" \"%1\" %*"

[HKEY_CLASSES_ROOT\Applications\pythonw.exe\shell\open\command]
@="\"C:\\Users\\Alexey\\AppData\\Local\\Programs\\Python\\Python36-32\\pythonw.exe\" \"%1\" %*"

[HKEY_CLASSES_ROOT\py_auto_file\shell\open\command]
@="\"C:\\Users\\Alexey\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe\" \"%1\" %*"

[HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command]
@="\"C:\\Users\\Alexey\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe\" \"%1\" %*"

* the FileTypesMan nirsoft
2 program helped me figure out the parameters. But why the installer does not associate these extensions and does not install the Python Launcher (on the second and subsequent installations) (ticks in place) - this question remains open.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question