3

As the title states, I'm trying to use Windows python on linux,
which already has worked flawlessly for what I've needed to run.

however .py files open with gedit instead of python, meaning I actually have to open python directly before I can do anything.

I've read an example that told me about a desktop entry for pdf files, but of course I don't know what I'm doing and nothing's explained for noobs, so I tried rewriting it to work with python:

[Desktop Entry]
Name=Python
Exec=wine python.exe %F
Icon=python
Type=Application
Categories=Viewer StartupNotify=false
Terminal=true
MimeType=application/py

the terminal just appears then disappears

what am I doing wrong??

Tcll
  • 735
  • 1
  • 7
  • 15

1 Answers1

4

managed to get it working:

for noobs, open your terminal and input:

gedit ~/.local/share/applications/OpenWithPython.desktop

once open, copy and paste this in the file and save:

[Desktop Entry]
Name=Python
Exec=wine C:/python27/python.exe %F
Icon=python
Type=Application
Categories=Viewer
StartupNotify=false
Terminal=true
MimeType=application/py

now just R-click > Open With Other Application > Show Other Applications > Python


for pyw files:

gedit ~/.local/share/applications/OpenWithPythonw.desktop


[Desktop Entry]
Name="Python - no console"
Exec=wine C:/python27/pythonw.exe %F
Icon=python
Type=Application
Categories=Viewer
StartupNotify=false
Terminal=false
MimeType=application/py

^ it really doesn't matter if you use python.exe or pythonw.exe here


I've also gotten IDLE working properly:

gedit ~/.local/share/applications/EditWithIDLE.desktop


[Desktop Entry]
Name=IDLE
Exec=wine C:/python27/python.exe C:/Python27/Lib/idlelib/idle.pyw %F
Icon=python
Type=Application
Categories=Viewer
StartupNotify=false
Terminal=false
MimeType=application/py

^ just associate it with the "Open With" menu


also, if you use a different python version, you can always change the python27 directory to python34 or whatever version you use.

Tcll
  • 735
  • 1
  • 7
  • 15