Jun-22-2022, 11:03 AM
Jun-22-2022, 12:13 PM
Both pywin32 and winshell shortcut can do this.
Can do quick test with to see in work with newest Python 3.10.5 as winshell is old.
Can do quick test with to see in work with newest Python 3.10.5 as winshell is old.
import os, sys import winshell link_filepath = os.path.join(winshell.desktop(), "python.lnk") with winshell.shortcut(link_filepath) as link: link.path = sys.executable link.description = "Shortcut to python"Work fine create a working shortcut to Python on the Desktop.
Jun-23-2022, 08:07 AM
(Jun-22-2022, 12:13 PM)snippsat Wrote: [ -> ]Both pywin32 and winshell shortcut can do this.
Can do quick test with to see in work with newest Python 3.10.5 as winshell is old.
import os, sys import winshell link_filepath = os.path.join(winshell.desktop(), "python.lnk") with winshell.shortcut(link_filepath) as link: link.path = sys.executable link.description = "Shortcut to python"Work fine create a working shortcut to Python on the Desktop.
Throws this error:
Error:Traceback (most recent call last):
File "d:\1. Oshadha\2. Code\Python\Test.py", line 2, in <module>
import winshell
File "C:\Users\DELL\AppData\Local\Programs\Python\Python310\lib\site-packages\winshell.py", line 30, in <module>
import win32con
ModuleNotFoundError: No module named 'win32con'
When I try pip install win32con
It gives another error:
Error:ERROR: Could not find a version that satisfies the requirement win32con (from versions: none)
ERROR: No matching distribution found for win32con
Im using the newest version of python: 3.10.5 64BitI found many websites using this
winshell
module and I gave up because it gave the same error.EDIT: I solved the error.
pip install pywin32
solves the issue!Thanks for everyone's help!