[python-win32] shortcut creation during installation
tamike at noos.fr
tamike at noos.fr
Tue Sep 14 14:26:28 CEST 2004
Hello everyone,
I don't know much about the windows environment.
I want to distribute my program for windows users and create
shortcuts on desktop and in the start menu :
For this I wrote a script setup.py and a post-installation script (used by the win32 executable) which creates links with the function
create_shortcut( target, description, filename[, arguments[, workdir[, iconpath[, iconindex]]]])
The first link try to launch python with a script as argument, so values are :
target=os.path.join(sys.exec_prefix,"python.exe")
description="..."
shortcut=os.path.join(some_dir,"mylink.lnk")
arguments="path_to_myscript.py"
and finally
create_shortcut(target,description,shortcut,arguments)
This creates a link but when it is activated, it tells
"C:\Python23\python.exe is not a valid Win32 application."
This sounds like the problem is coming from the file C:\Python23\python.exe and not from the shortcut I just create. Is something wrong with the way I make the link ?
My second link starts Acrobat reader with a file as argument. This time, values are :
target=os.path.join(
"C:\\Program Files\\Adobe\\Acrobat 5.\\Acrobat",
"Acrobat.exe")
description="..."
shortcut=os.path.join(some_dir,"Mydocumentpdf.lnk")
arguments="path_to_doc.pdf"
create_shortcut(target,description,shortcut,arguments)
This works fine! :)
But my path to acrobat reader (i.e. in target) may not be the same for an other windows user.
Is there a way to find the path to the executable of a program ? (something similar to get_special_folder_path ...)
Thanks,
Mike
More information about the Python-win32
mailing list