Previously, I had Python 3.7.4 installed & working great on Win10. Then, a 3rd party installer (unbeknownst to me) installed Python 2.7...which completely hosed my Python environment (ugh). After removing Python 2.7 and running a repair-reinstall of Python 3.7.4, it's mostly back up and running - except for the ability to drag and drop onto .py files.
Per Drag and drop onto Python script in Windows Explorer and Python Drag-and-drop broken, I've tried:
regedit:
HKCR\.py=Python.File (when I first checked, it was set to py_auto_file, so I did have to change this)
HKCR\Python.File\shell\open\command="C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\python.exe" "%1"
HKCR\Python.File\shellex\DropHandler= I've tried {60254CA5-953B-11CF-8C96-00AA00B8708C}, {86C86720-42A0-1069-A2E8-08002B30309D}, and {BEA218D2-6950-497B-9434-61683EC065FE}
With the above changes, I was able to get Python to launch when dragging-and-dropping onto .py files, but sys.argv does not contain the filename (only argv[0] is set, not argv[1]). Obviously I'm restarting Windows Explorer between each test. I've spent the past several hours searching & reading, but everything I've found pretty much contains some variation of the 3 changes above.
Any ideas why argv[1] would not be set when launching Python by dragging a file onto a .py script?
I managed to solve this by:
Do a repair-reinstall of Python 3
Do a repair-reinstall of Python Launcher
Create HKCU\Software\Classes\Python.File\shellex\DropHandler, with default={BEA218D2-6950-497B-9434-61683EC065FE}
Modify HKLM\Software\Classes\Python.File\shell\open\command, to set default="C:\Users\my_user_name\AppData\Local\Programs\Python\Python37-32\python.exe" "%1" %*
Related
I am learning Python and came across this problem. I know that i can put "input()" at the bottom of the program, but the problem is that it IS there, but console terminates nevertheless. It seems like the programm never starts at all. I am using the 3.5 version of Python.
Open a terminal, navigate to the directory of your file, and type python myfile.py. If you just double click the file in your system explorer it will run and close when it finishes, which is often too fast to see what's going on.
I think you are starting the programme by clicking on it don't do that to run your programme follow following steps
1.open command prompt
2. go to the path where you have your python programme
3. use command for python for eg: python programme.py in linux
4. if it says python command not recognised probably because the path to python executable is not present in system path add it to environment variable and that should work fine
Phyton was working fine, until one day IDLE refused to open (nothing happened when I double clicked it), so I decided to reinstall it. After I was done (I installed Python 3.5), IDLE was working again, however all of my scripts had blank icons instead of a Python icon (even though Windows was set to open it with "python launcher for windows (console)"). I tried to open thouse but they would instead open in command line and close after a fraction of a second (which is strange, since some of those scripts were supposed to create applications that should stay put until the "x" (close) button is pressed).
I tried to delete python in path variables and then add it back again, but it didn't work. I also tried to assign other python executables (like "python.exe" and "pythonw") to open those files, whithout success...
Every time I'm trying to use Emmet's Expand Abbreviation it gives me errors. First a pop up with Unknown Exception and then another pop up with python script plugin did not accept the script.
I tried reinstalling Notepad++ but that didn't help.
I'm running Windows 8 x64 & Notepad++ 6.6.9. This is the first time I'm using Emmet, after recently used the old Zen Coding. (Which works flawlessly.)
I have python 2.7 installed, if that necessary too.
I had the same problem as you.
This is the solution which worked for me:
emmetio/npp Bug ID #12: python script plugin did not accept the script
Basically, the problem lies in the Python Script plugin which will be automatically installed with Emmet.
Go to this link:
http://sourceforge.net/projects/npppythonscript/files/Python%20Script%200.9.2.0/
and download PythonScript_full_0.9.2.0 package.
Replace Notepad++'s Python package with PythonScript_full_0.9.2.0 and unpack the archive in Notepad++'s MAIN directory. (This is where notepad++.exe is.)
(Do NOT unpack the archive inside the plugins directory. That will not work. The python27.dll file needs to be in the same directory where notepad++.exe is.)
I am using Notepad++ v6.6.9 and it works now.
There is a newer version (PythonScript_1.0.8.0.msi ) available here:
http://sourceforge.net/projects/npppythonscript/files/latest/download?source=files
I had the exact same issue on two different computers, one Windows 7 and one Windows 8, both 64bit. I installed the MSI on the Win8 computer and it fixed the problem.
Check to see if it might be just the shortcut keys that aren't working by going to menuBar>plugins>emmet>expandAbbreviation. If clicking on that works after typing in some emmet syntax, but not when you type the shortcut key, reassign the shortcut keys. Here's what I did:
Look specifically at
menuBar>settings>shortcutMapper
under Main Menu-> "Insert Blank Line Above Current"
and see that ctrl+alt+enter is already assigned there.
Change that to something else (I did ctrl+alt+up), and you'll see that your shortcut keys are working for emmet.
You have 4 objects (2 files and 2 directories) that you have to sort:
Put the python27.dll file into the MAIN directory like so: %ProgramFiles(x86)%\notepad++\python27.dll
Put the others (doc directory, PythonScript directory, PythonScript.dll file) into %ProgramFiles(x86)%\notepad++\plugins\.
This works for Windows 8.
Also change the key shorcut by ctrl + E or some other.
So I've been working with Python on my computer for about the last 2 months with no issues. Just recently however, something went wrong with IDLE. I am running python 2.5
I used to be able to right-click and select "Edit with IDLE" for a python program. That option no longer is available. When I try "open with" and navigate to the idlelib in python, I can select idle.bat, idle.py, or idle.py (no console). I've tried each option and each fails to open and returns an error that either it is not a valid Win32 application or that "Windows cannot find idle.pyw"
I am able to open IDLE on its own and use the open function in IDLE to open files, but can't open files directly using IDLE as I could before.
There was formerly the White background icon with the python logo, which is now replace by windows' logo for no program (white square, blue and red dots). I have tried to repair-install and unistall-re-install both with no success. There is no firewall or antivirus, and it was installed with permissions for all users.
Any help is much appreciated, this has been maddeningly difficult to figure out.
The native one that comes with python on windows is problematic at times, so you could uninstall and reinstall it as a solution, or open it from its directory instead of a shortcut, or get another IDE. I recommend the Ninja IDE very nice and light looking, or if you're on linux you could just use vim from terminal.
Also, if it's extremely necessary, try upgrading your python version and IDE. I think the IDE included for windows looks like a modified emacs to be honest.
The fact that Windows changed the right-context menu for .py files has nothing to do with Idle, and probably nothing to do with Python either. You are not the first to have this problem. You can potentially restore 'Edit with Idle' but without directly editing the registry (an expert option) I only knew how to do so in XP. You might also be able to fix it be going back to a restore point before it changed, but you would lose all updates since, so I would not do that.
I am surprised that re-installing did not restore it. The line was once gone for me, too, and was restored by a recent install.
I have Win7. I just now tried 'Open with', navigated to 3.4 idlelib, and selected idle.bat (the .py files were not offered as a choice). The .py file opened in an Idle editor just fine. It is now a permanent option for Open with, without having to navigate.
Idle has gotten perhaps 150 patches since 2.5. Even if you have to edit programs to run on 2.5, I strongly recommend installing a current version of Python and Idle.
I have no ideal what your comment "the programs still can't find anything associated with it, like Tkinter for example " means.
I recently tried to convert one of my python scripts (used for file-systems I/O) to a executable file by using py2exe. However, after successfully generating the .exe file from my python script, I am no longer able to copy and paste any text(or anything for that matter) from other windows apps to my python app console (when I run the script/app from the .exe file). When right click the mouse now, the access window does not pop up any longer. Does anyone know how I can get around this issue?
Thanks,
A.L.
Right-clicking a console window is a "special feature" of the command line interpreter of Windows Vista and above. It doesn't work on any other command-line tool, so it doesn't longer works for your converted script. You can still access it using the windows menu (small icon in the title bar or Alt+Space).
You could try to get the right-click feature back by messing around with Windows API calls - but the more convenient possibility would be to enable pasting using Ctrl+V and forget about the window menu. A good candidate is PyReadline - install the package and run this at the beginning of your script:
import readline
readline.parse_and_bind("control-v: paste")