Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 26 days ago.
Improve this question
I am saving my emails on a strutured way in a structure of folders, depending on the email content.
For Example, if an email contains the tag "project123" i save this email in the project folder subfolder 123...
herefor i made a python application,
This application works with the win32com & tkinter.
It looking for the tags and proposes a folder + name. ( it also can open the local file explorer, save config file ..., it runs locally).
In outlook i added a macro on a button,
This macro activates the python application and the python application opens a tkinter window with the proposal where to save this email.
Nowdays some collegues want alo to use this.
I am looking to roll this out to multiple people.
I made an executable of the python script, so they can run the code whitout python installed.
I am looking for a button in the outlook ribbon to activate this exe file.
First i was looking to write a general plugin ( need an xml), but if i read correct this xml can only run web based, a javascript, it is not possible to go this way?
Second option was for me to work with a COM -plugin, but if i want to add the exe file as plugin, it executes the program, and not add this plugin... So i'm confused
Now the general question :
Is there a way to start an executable with a button from on the taskbar?
Our should i look for another way of working?
I prefer not to work with a macro, for an easy rollout...
Thank you for the help
COM addin would be the easiest way. If you write it in C#, you can use any Windows API, so you can launch any Windows executable. But then I am not sure why you'd want to use Python for that instead of doing everything in C#.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 11 months ago.
Improve this question
I just finished my app and I would like to convert my script/file into an executable file. I've used some text files, images and stuff to build it.
Once I convert my py file into exe file, it will only work if it is on the same folder where the images, text files and the actual py file are.
I created a zip file and it works, but as I said, when you wanna run it you will see all the images, information... It does not look good for anyone who downloaded it
I also wanted to say thank you for the people who helped me with my other questions about fixing my program. I dont know how to tag them, but thank you.
I would reccommend using auto-py-to-exe, a wrapper program that simplifies a lot of the tasks of using pyinstaller, a program that bundles python and the scripts into an executable.
pip install auto-py-to-exe
it can then be run with
auto-py-to-exe
It should open a new window where you can configure options (such as if you want to have a single executable file or if averything is in a folder. If your assets (images, etc.) are in a different folder, then you may have to add them to the bundle by configuring the options in the auto-py-to-exe window.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am on Windows 7. I have Python 2.7.8 (64 bit) installed. Today, I changed the default program that opens .py files from IDLE to Windows Command Processor and stupidly selected the checkbox that said "always use the selected program to open this kind of file".
What I want to do is change my default program back to IDLE.
When I attempt to change it back to IDLE, I go to Control Panel\Programs\Default Programs\Set Associations and select the .py name and click Change Program. I do see python.exe but selecting that does nothing. I then use the "Browse" button to navigate to C:\Python27\Lib\idlelib but don't know if I should select idle.py, idle.pyw, idle.bat or some other IDLE program that will force the default program to be IDLE!
Nothing happens after I select one of these.
How do I make IDLE be the default program that opens .py files and now disassociate Windows Command Processor from being the default?
If the "always use the selected program to open this kind of file" checkbox is grayed out, ungray it by:
Open regedit Go to
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
Find the .py extension among the list
Delete the UserChoice key (folder)
Then you can navigate to:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Python XX and choose IDLE...
or
navigate to C:\...\PythonXX\Lib\idlelib\idle.bat and select that.
---- If You are updating from a previous version of Python ----
I just updated from Python 3.4 to Python 3.5 and it was a nightmare setting IDLE as my default program. I wasted so much time. I finally got it to where I no-longer have to right-click and select IDLE. Instead, I just click on a .py file and it opens IDLE by default... and it has a legit-looking Python icon (not an ugly .bat icon).
I'm posting this so mainly I'll remember how I did this!
Uninstalled Python 3.4 using control panel (Windows).
Deleted remaining C:\Python34 folder entirely.
Went into registry:
Windows "start" orb (bottom-left) > type "run" > type "regedit" in Run dialog box.
Looked in the following areas and deleted python keys entirely:
HKEY_CURRENT_USER\Software
HKEY_LOCAL_MACHINE\SOFTWARE
HKEY_USERS.DEFAULT\Software
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
(Optional, do with caution) In left pane of Registry Editor, right-click and select "Find". I looked in keys, values and data but looking in just keys might be enough. I deleted the ones that looked very specific to start-up procedures. You can press F3 to find again each time.
I ran CCleaner specifically to remove / clean-up the registry, but also to clean up temp folders and just general maintenance. Run it several times.
Restart computer
Install new version of Python. If installation fails first time, consider un-checking some of the "Advanced Options" during installation. Ex: "download debug binaries".
After you install, .py files may not be associated to a program. You can go to your control panel and set file associations.
Look for .py file extension and click "Change program" button in the top-right. Browse to the location of idle.bat. Example: C:\Python35\Lib\idlelib. Click the idle.bat file and press OK.
At this point, you should be able to click a python file (file with .py extension) and it will open using IDLE's idle.bat program. I've read that sometimes this doesn't work for some people.
But now, the icon of .py files look like the icon of the .bat program. This looks like crap so I did the next steps to associate a Python icon with .py files.
Start > run > regedit (to launch Registry Editor)
In Registry Editor, navigate to: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.py\UserChoice and make note of the Progid (Applications\idle.bat in my example).
If UserChoice is not there, navigate to HKEY_CLASSES_ROOT\.py and make note of the (Default) value (ex: py_auto_file).
I didn't know which to change so I changed BOTH.
Go to: HKEY_CLASSES_ROOT\Applications\idle.bat. A "DefaultIcon" folder didn't exist so I right-clicked idle.bat and chose New > Key and named it "DefaultIcon". For the (Default) data, I put C:\Python35\Lib\idlelib\Icons\idle.ico to reference the .ico image that's within the IDLE icons folder.
Go to: HKEY_CLASSES_ROOT\py_auto_file and did the exact same steps as step 12.1.
Restart your computer.
End-result
After all these steps, I am now able to double-click a .py file in Windows and it launches the file in Python IDLE.
Right click on any .py file
Click Open With...
Click Choose a default program...
IfIDLEis on the list, click it.
else
Click Browse, and find the IDLE program
Click OK and voila!
I have written a python script with a Tkinter GUI. I would like to create a desktop icon that will execute this script so that the end-user (not myself) will be able to double-click the icon and have the GUI load, rather than 'run' the script from the terminal or python shell and then have to F5 from there.
Is there a way to do this? I have googled many arrangements of my question but most answers seem to be normal python scripts, not ones which are Tkinter based.
I am using a Raspberry Pi with Wheezy and Python 2.7
Thanks in advance.
I create executables(icons that I click to start the programs I write) using 'py2exe'. I use windows 7 and I am not sure if it would work for you with Raspberry Pi, but a google search may clear that up for you. I will provide the link below. Basically you end up with a folder with the executable(icon) and also some files, without which the executable won't work. It's unfortunate that you get this extra 'baggage', but it's still handy and the best solution I have come across. I don't think there is a much better way, but I am not 100% on that. Interestingly, I found that you could delete most of these baggage files and the executable would still work, it was trial and error, but it didn't take long. If I want to send the folder to someone, I zip it first.
py2exe is here
If you need a 64 bit binary you can get it here, along with, actually, pretty much every other version. get py2exe here also
Besides creating executable file other option is create simple .bat file:
Open notepad
Enter "C:\ProgramData\Anaconda3\python.exe" "C:\Users\Your ID\script.py"
First part is path to python.exe, second to your python script
save file as .bat file, ex. "open_program.bat"
Now simply double click on saved .bat file icon should open your script.
I like using cx-freeze to convert python scripts to exe.
There is very easy to follow documentation to do this. In short, you create a setup.py script that specifies what libraries and packages you want to include or exclude in your application.
You can then run the build in the console and it will create a build folder, in which will be an Application File. You can create a Desktop short cut using send to and selecting desktop.
Documentation link
You can save the script as a .pyw file so the user can click on the file and the GUi would open
Hi i want to build an install creator for my programs in Python.
I have made code for the information gathering, PATHS, FILES, PICS etc.
Now i need to:
Compress the files for the program.
make a config file with install paths ect.
make code for the INSTALLER (i have that to)
Finally i need to "pack" it all in an .exe file that will run the first window in my INSTALLER CODE, so that it will work as my own custom made installer.
Does anybody have any idea how to go about this EASY??
My biggest problem is to collect it all in ONE .exe file that will run my windows(TK code) and of course install my program when clicked...
I have a few ideas how to go about it, BUT in my head these ideas seem to be BIG and NOT EASY, so need ideas for easier solutions.
Update. If i have a program build in python(Tkinter) that will gather the information and save this info as a config file. Then i can build a program that can read this information and extract files ect. accordingly to the info. But how will i combine these configfiles/programs in ONE .exe file that when clicked will run MY program and then accordingly extract my files to the paths in config file. And last use my own icon for the single .exe
If you want to have everything in one exe file, its code needs to be aware of it's content and extract them. This is a problem that has been solved by various tools, eg. see this SO question and its answers.
The answers in this question didn't get to the heart of the problem. In a CLI-based Python program, I want the user to be able to edit a file and then return to the program. Before returning, I want them to be able to cancel their edits. This should feel like the commit-note-editing feature in Subversion.
What are the current best practices for this type of task?
You could try looking through the sources to Mercurial, which is written in Python.
They use os.environ to read the value of environment variables HGEDITOR, VISUAL, and EDITOR, defaulting to vi. Then they use os.system to launch the editor on a temp file created with tempfile.mkstemp. When the editor is done, they read the file. If it has any real content in it, the operation continues, otherwise, it is aborted.
If you want to see how Mercurial does it, the details are in ui.py and util.py.
Subversion, et al use the $EDITOR environment variable to determine which program to use to edit text files. Of course, $EDITOR will only work if you're on a unixy platform in a shell. You'll have to do something different for Windows (cmd /c start tempfile.txt) or Mac OS X (open tempfile.txt).
But, this is essentially what the answers and related answers to your other question said.
If you just want to be able to "cancel" edits, then make a temporary copy of the file, and invoke your editor on that. Your program can then copy the contents of the temporary file into the real file or, if the user cancels, don't. This is basically how Subversion does it.