Xfce Forum

Sub domains
 

You are not logged in.

#1 2016-10-30 22:32:36

yanlolot
Member
Registered: 2016-10-30
Posts: 11

thunar refuses to open files .py

Hello

When I double-click on a file with .py extension, it refuses to open it (with geany or vim...). But when I right-click and choose geany (or vim), it opens the file.
When I double-click, it says that I have the wrong permissions.

Thanks for help.

Offline

#2 2016-10-30 23:10:36

Jerry3904
Member
Registered: 2013-11-09
Posts: 863

Re: thunar refuses to open files .py

You need to open a terminal where the file is (make sure it is executable), and type:

python <yourfile>.py

Compare this similar thread about jar files. This is not a problem specific to Xfce.


MX-23 (based on Debian Stable) with our flagship Xfce 4.18.

Offline

#3 2016-10-31 00:24:08

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

thanks for the reply and sorry for my english, but you didn't understand my problem:
I don't want to execute the file when I double-click: I want to open it with geany. And thunar doesn't open it because of the permissions (whereas user and group are mine). But when I right-click and choose open it with geany, thunar open the file without any problem.
I've got the same pb if I want to open it with an other text editor.
This pb appears only with the .py files.

Thanks for help.

PS: I can execute the file in a console, but this is not my problem: I just want to open it with geany when I double-click
      I'm on debian jessie.

Last edited by yanlolot (2016-10-31 00:37:27)

Offline

#4 2016-10-31 00:52:28

Jerry3904
Member
Registered: 2013-11-09
Posts: 863

Re: thunar refuses to open files .py

Have you tried the standard method already? Right-click the file > Open with > navigate to the geany entry and check the box > scroll down and check to always use it.


MX-23 (based on Debian Stable) with our flagship Xfce 4.18.

Offline

#5 2016-10-31 01:08:29

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

yes, I did that. But this didn't solve the problem.

Offline

#6 2016-10-31 03:10:44

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

Thunar execute by default the .py files.
I've tried to change this comportment with:

--> the hidden settings misc-exec-shell-scripts-by-default :

$ xfconf-query --channel thunar --property /misc-exec-shell-scripts-by-default --create --type bool --set false
$ cat .config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml
<?xml version="1.0" encoding="UTF-8"?>

<channel name="thunar" version="1.0">
  <property name="last-view" type="string" value="ThunarIconView"/>
  <property name="last-icon-view-zoom-level" type="string" value="THUNAR_ZOOM_LEVEL_NORMAL"/>
  <property name="last-window-maximized" type="bool" value="false"/>
  <property name="last-separator-position" type="int" value="170"/>
  <property name="last-window-width" type="int" value="1029"/>
  <property name="last-window-height" type="int" value="508"/>
  <property name="last-show-hidden" type="bool" value="false"/>
  <property name="misc-single-click" type="bool" value="false"/>
  <property name="misc-exec-shell-scripts-by-default" type="bool" value="false"/>
</channel>

But there is no effect: thunar tries to execute my .py files.

--> change the type mime: the default application for  application/x-python-bytecode is geany.
No effect.


How can I change this comportment ? (Wich configuration file ?)

Thanks for help

Offline

#7 2016-10-31 10:09:41

onkelho
Member
Registered: 2010-07-28
Posts: 21

Re: thunar refuses to open files .py

create a thunar-custom-action,
example is "open terminal" in the configure user action or so by menu, add a new and give as execute geany %f
then apply this to files with *.py  in next tab
restart thunar after safing and all should be fine with "right-clicking" on .py files

Offline

#8 2016-10-31 10:36:12

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: thunar refuses to open files .py

@yanlolot, what happens when you use exo-open in a terminal to open the *.py file, like:

exo-open FILE.py

...where FILE.py is the name of your py file? What is displayed in the terminal?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#9 2016-10-31 12:33:44

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

@ Toz
when I use exo-open in a terminal to open the *.py file, it opens it with geany without any problem. And the terminal displays nothing.

Offline

#10 2016-10-31 14:20:08

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: thunar refuses to open files .py

What is the exact wording of the error message that you are getting?

Edit: Can you also confirm the versions of Xfce and thunar that you are using?

xfce4-about -V
thunar -V

And finally, create a secondary account and log in using that account and test whether the same is happening there.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#11 2016-10-31 17:43:34

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

@ToZ

-> with a new account: exactly the same pb.

-> The version of xfce and thunar
$ xfce4-about -V
xfce4-about 4.10.0 (Xfce 4.10)
$ thunar -V
Thunar 1.6.3 (Xfce 4.10)



->

ToZ wrote:

What is the exact wording of the error message that you are getting?

The message is in french:

Échec à l'exécution du fichier « File.py »
L'exécution du processus fils « File.py » a échoué (Permission non accordée).

The reason of this message is that: - thunar try to execute the file and not to open it.
                                                    - this file is not authorised to be executed like a script (it's my choice, I just want to edit it with geany by double-click)

Last edited by yanlolot (2016-10-31 17:53:14)

Offline

#12 2016-11-01 00:12:22

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: thunar refuses to open files .py

If the following returns true or false:

xfconf-query -c thunar -p /misc-exec-shell-scripts-by-default

...then try this:

xfconf-query -c thunar -p /misc-exec-shell-scripts-by-default --type bool --set false

If that makes no difference, try resetting it:

xfconf-query -c thunar -p /misc-exec-shell-scripts-by-default -r

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#13 2016-11-01 01:04:23

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

It seems to be the same command I did in post 6 ( the hidden settings misc-exec-shell-scripts-by-default ), but let's try:
$xfconf-query -c thunar -p /misc-exec-shell-scripts-by-default
false
$xfconf-query -c thunar -p /misc-exec-shell-scripts-by-default --type bool --set false

no effect.

Offline

#14 2016-11-01 01:35:58

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: thunar refuses to open files .py

Did you try the last one? Resetting it?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#15 2016-11-01 14:12:27

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

Yes I tried the last one, and there is no effect.

Offline

#16 2016-11-01 21:21:11

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: thunar refuses to open files .py

Not sure what else to suggest. It works fine on my Jessie box so it must be a system-wide configuration somewhere on your system that is interfering.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#17 2016-11-01 22:05:45

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

Thanks for your help. I keep searching (I'll try to trace the double-click and see...)
Thanks again.

Offline

#18 2016-11-01 22:24:57

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

Just one question: When I do a "ps aux |grep Thunar", the output is:
Thunar --sm-client-id .....
I dont find this option ( sm-client-id) in the man of Thunar. What is this ?

Offline

#19 2016-11-02 01:56:23

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,494

Re: thunar refuses to open files .py

It's related to session management. If you save your sessions, then thunar is saved with a session id and then re-opened later using the same session id so it can keep track of certain state items such as current folder. Look for the session information in ~/.cache/sessions.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#20 2016-11-02 18:26:16

yanlolot
Member
Registered: 2016-10-30
Posts: 11

Re: thunar refuses to open files .py

I've renamed the .py in .py3 to solve the pb. It works, thunar opens the .py3 with geany.
But look at this:
$ file --mime-type File.py
File.py: text/plain
$ file --mime-type File_bis.py3
File_bis.py3: text/x-python

So, the mime-type for .py file isn't python (??), and the mime-type for .py3 is python (???)
Strange isn't it ?

Last edited by yanlolot (2016-11-02 18:27:03)

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.016 seconds, 7 queries executed - Memory usage: 617.43 KiB (Peak: 634.71 KiB) ]