Using Python scripts with an installed Python program(Python v3.10)
Python installation and configuration
Download and install the Python program
You can down Python v3.10 at https://www.python.org/downloads/release/python-3101/.
Select “Windows installer (32-bit)”.
Install Python. Make sure that the Add Python 3.10 to PATH option is checked.
Install Pywin32
Run Command Prompt as an Administrator.
Use the following command to install Pywin32.
python -m pip install pywin32
Register Pywin32 to the Registry.
Run Command Prompt as an Administrator.
Run the following commands.
cd C:\Users\["UserName"]\AppData\Local\Programs\Python\Python310-32\Lib\site-packages\win32comext\axscript\client python .\pyscript.py
Copy the relevant files to your Python installation location.
Move to C:\Users\["UserName"]\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pywin32_system32 folder
Copy the following two files to the Python installation path (default path: C:\Users["UserName"]\AppData\Local\Programs\Python\Python310-32).
cd C:\Users\["UserName"]\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pywin32_system32 copy pythoncom310.dll C:\Users\["UserName"]\AppData\Local\Programs\Python\Python310-32 copy pywintypes310.dll C:\Users\["UserName"]\AppData\Local\Programs\Python\Python310-32
Change a Registry value
Find \HKEY_CLASSES_ROOT\WOW6432Node\CLSID\{DF630910-1C1D-11d0-AE36-8C0F5E000000}\InprocServer32 key.
Note: You can quickly find this by searching ‘pythoncom’ in the \HKEY_CLASSES_ROOT\WOW6432Node\CLSID\ path.
Change the value of the registry to the path of the copied file (Python installation folder\Pythoncom310.dll).
(Python Default Path : C:\Users\["UserName"]\AppData\Local\Programs\Python\Python310-32\Pythoncom310.dll)
Xshell Configuration
Turn on the ‘Do not use Xshell’s embedded Python' option in the global options (Tools → Options → Advanced).
Run your Python script.
If the installation or settings are not configured properly, the following error can occur.