#1 Le 25/09/2019, à 21:05
- lynn
[RÉSOLU] Traduire script python2 en python3
Bonjour,
J'utilise un script écrit en python2. Sachant que les jours de ce dernier sont comptés, j'aimerais l'avoir en python3 pour pouvoir continuer à l'utiliser sans avoir à installer - juste pour ça, des éléments python2.
N'y connaissant pas grand chose, je fais une demande ici, si quelqu'un a les compétences et/ou le temps (ou les deux ) pour le traduire.
J'en avais parlé ici il y a quelques temps. Cette petite application sert à lancer des scripts perso ou autres binaires.
Le script original (cappind.py) :
#!/usr/bin/python
import pygtk
pygtk.require('2.0')
import gtk
import appindicator
import sys
import subprocess
import argparse
import gobject
ICON_THEME = gtk.icon_theme_get_default()
# cappindicator, command line generic appindicator
# by reda_ea <reda.ea@gmail.com>
# license is do whatever you want with this code i don't care
# accepts input in forms of multiple lines
# of the form menu:submenu:...:entry:command
# empty command means separator
# implied parent menus are automatically created
# entries in the same path appear in the same order as in the input
# undefined behaviour on wrong input
class CmdAppIndicator:
def __init__(self, persist, icon, label):
# parameters
self.persist = persist #True
self.icon = icon #'terminal'
self.status = appindicator.STATUS_ATTENTION # ACTIVE
self.label = label
# indicator
self.ind = appindicator.Indicator ("c-indicator", self.icon, appindicator.CATEGORY_OTHER)
self.ind.set_label(self.label)
#self.ind.set_attention_icon (self.icon)
self.ind.set_status(self.status)
# menu
self.menu = gtk.Menu()
self.submenus = dict()
for line in sys.stdin:
line = line[0:len(line)-1] # removing last '\n'
self.add_menu(self.menu, line, line)
if self.persist:
self.add_quit()
self.menu.show()
self.ind.set_menu(self.menu)
def add_entry(self, parent, name, path):
ent = gtk.MenuItem(name)
ent.connect("activate", self.say, path)
ent.show()
parent.append(ent)
def add_sep(self, parent):
sepr = gtk.SeparatorMenuItem()
sepr.show()
parent.append(sepr)
def add_quit(self):
self.add_sep(self.menu)
ent = gtk.ImageMenuItem(gtk.STOCK_QUIT)
ent.connect("activate", gtk.main_quit)
ent.show()
self.menu.append(ent)
def run(self, w, cmd):
subprocess.Popen(cmd, shell=True)
if not self.persist:
gtk.main_quit()
def say(self, w, name):
print(name)
sys.stdout.flush()
if not self.persist:
gtk.main_quit()
def get_child(self, parent, name):
if parent not in self.submenus:
self.submenus[parent] = dict()
children = self.submenus[parent]
if name not in children :
child = gtk.Menu()
child.show()
item = gtk.MenuItem(name)
item.set_submenu(child)
item.show()
parent.append(item)
children[name] = child
return children[name]
def add_menu(self, parent, line, path):
s = line.split(':', 1)
if len(s) > 1:
child = self.get_child(parent, s[0])
self.add_menu(child, s[1], path)
else:
if len(s[0]) == 0:
self.add_sep(parent)
else:
self.add_entry(parent, line, path)
if __name__ == "__main__":
# command line params
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description='Command line generic appindicator.\n\n'
'Menu elements are given in standard input as lines in the form:\n\n'
'\tmenu:submenu:subsubmenu:entry\n\n'
'Menu structure is automatically built, selecting a leaf '
'will print the associated input line (the whole path).')
parser.add_argument('-i', '--icon', default='terminal', help='the indicator icon name')
parser.add_argument('-l', '--label', default='', help='optional label (not recommended)')
parser.add_argument('-p', '--persist', action='store_true', default=False,
help='keep the indicator running after a selection (an additional "Quit" entry will be added)')
parser.add_argument('-t', '--timeout', type=int, default=-1,
help='a timeout in seconds after which the indicator will be closed')
args = parser.parse_args()
if args.timeout >= 0:
gobject.timeout_add(args.timeout*1000, gtk.main_quit)
indicator = CmdAppIndicator(args.persist, args.icon, args.label)
gtk.main()
Merci pour votre aide.
Edit : Le script traduit en python3
#!/usr/bin/env python3
#
# cappindicator, command line generic appindicator
# by reda_ea <reda.ea@gmail.com>
# license is do whatever you want with this code i don't care
# accepts input in forms of multiple lines
# of the form menu:submenu:...:entry:command
# empty command means separator
# implied parent menus are automatically created
# entries in the same path appear in the same order as in the input
# undefined behaviour on wrong input
#
#
# Dependencies required : gir1.2-appindicator3-0.1
# For Gnome Shell Ubuntu users, nothing to do !
# For Gnome Shell no Ubuntu users, install KStatusNotifierItem/AppIndicator Support extension - https://extensions.gnome.org/extension/615/appindicator-support
#
import gi, sys, subprocess, argparse, gobject
gi.require_version('Gtk', '3.0')
gi.require_version('AppIndicator3', '0.1')
from gi.repository import Gtk
from gi.repository import AppIndicator3 as appindicator
ICON_THEME = Gtk.IconTheme.get_default()
class CmdAppIndicator:
def __init__(self, persist, icon, label):
# parameters
self.persist = persist
self.icon = icon
self.status = appindicator.IndicatorStatus.ATTENTION
self.label = label
# indicator
self.ind = appindicator.Indicator.new("c-indicator", self.icon, appindicator.IndicatorCategory.OTHER)
self.ind.set_label(self.label, "")
self.ind.set_icon_theme_path(self.icon)
self.ind.set_status(self.status)
# menu
self.menu = Gtk.Menu()
self.submenus = dict()
for line in sys.stdin:
line = line[0:len(line)-1] # removing last '\n'
self.add_menu(self.menu, line, line)
if self.persist:
self.add_quit()
self.menu.show()
self.ind.set_menu(self.menu)
def add_entry(self, parent, name, path):
ent = Gtk.MenuItem.new_with_label(name)
ent.connect("activate", self.say, path)
ent.show()
parent.append(ent)
def add_sep(self, parent):
sepr = Gtk.SeparatorMenuItem()
sepr.show()
parent.append(sepr)
def add_quit(self):
self.add_sep(self.menu)
item = Gtk.MenuItem()
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
icon = Gtk.Image().new_from_icon_name('application-exit-symbolic', Gtk.IconSize.MENU)
label = Gtk.Label(label="Quitter")
box.add(icon)
box.add(label)
item.add(box)
item.connect('activate', Gtk.main_quit)
item.show_all()
self.menu.append(item)
def run(self, w, cmd):
subprocess.Popen(cmd, shell=True)
if not self.persist:
Gtk.main_quit()
def say(self, w, name):
print(name)
sys.stdout.flush()
if not self.persist:
Gtk.main_quit()
def get_child(self, parent, name):
if parent not in self.submenus:
self.submenus[parent] = dict()
children = self.submenus[parent]
if name not in children :
child = Gtk.Menu()
child.show()
item = Gtk.MenuItem.new_with_label(name)
item.set_submenu(child)
item.show()
parent.append(item)
children[name] = child
return children[name]
def add_menu(self, parent, line, path):
s = line.split(':', 1)
if len(s) > 1:
child = self.get_child(parent, s[0])
self.add_menu(child, s[1], path)
else:
if len(s[0]) == 0:
self.add_sep(parent)
else:
self.add_entry(parent, line, path)
if __name__ == "__main__":
# command line params
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description='Command line generic appindicator.\n\n'
'Menu elements are given in standard input as lines in the form:\n\n'
'\tmenu:submenu:subsubmenu:entry\n\n'
'Menu structure is automatically built, selecting a leaf '
'will print the associated input line (the whole path).')
parser.add_argument('-i', '--icon', default='terminal', help='the indicator icon name')
parser.add_argument('-l', '--label', default='', help='optional label (not recommended)')
parser.add_argument('-p', '--persist', action='store_true', default=False,
help='keep the indicator running after a selection (an additional "Quit" entry will be added)')
parser.add_argument('-t', '--timeout', type=int, default=-1,
help='a timeout in seconds after which the indicator will be closed')
args = parser.parse_args()
if args.timeout >= 0:
gobject.timeout_add(args.timeout*1000, Gtk.main_quit)
indicator = CmdAppIndicator(args.persist, args.icon, args.label)
Gtk.main()
Dernière modification par lynn (Le 08/10/2019, à 20:18)
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#2 Le 25/09/2019, à 21:07
- pingouinux
Re : [RÉSOLU] Traduire script python2 en python3
Bonsoir,
La commande 2to3 fera le travail (voir le man).
Hors ligne
#3 Le 25/09/2019, à 21:12
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
Bonsoir pingouinux,
J'avais bien vu cette commande mais elle ne traduit rien... ou je ne sais pas l'utiliser correctement (ce qui est plus que probable... )
Voici ce que ça donne :
2to3 cappind.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: No changes to cappind.py
RefactoringTool: Files that need to be modified:
RefactoringTool: cappind.py
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#4 Le 25/09/2019, à 21:20
- pingouinux
Re : [RÉSOLU] Traduire script python2 en python3
Dans ton script cappind.py, il semble qu'il n'y ait rien à changer.
Sinon, pour convertir un script, c'est :
2to3 -w script.py
script.py est converti sur place, et l'ancien est sauvé sous le nom script.py.bak.
Hors ligne
#5 Le 25/09/2019, à 21:31
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
J'ai essayé également avec -w mais ça ne donne rien de plus.
Edit : l'option w doit être en majuscule ( -W ).
2to3 -w cappind.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: No changes to cappind.py
RefactoringTool: Files that need to be modified:
RefactoringTool: cappind.py
Dans le fichier cappind.py, si je mets #!/usr/bin/python3, voici ce que ça me réponds :
Traceback (most recent call last):
File "./cappind.py", line 3, in <module>
import pygtk
ModuleNotFoundError: No module named 'pygtk'
Dernière modification par lynn (Le 25/09/2019, à 21:36)
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#6 Le 25/09/2019, à 22:00
- pingouinux
Re : [RÉSOLU] Traduire script python2 en python3
Cette vieille discussion va peut-être t'aider : Why can't I import “pygtk” with Python 3.2 from PyDev?
Il semble qu'il faille notamment installer le paquet python3-gi, et importer le module ainsi
from gi.repository import Gtk
Mais est-ce toujours d'actualité ?
Hors ligne
#7 Le 25/09/2019, à 22:09
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
Le paquet python3-gi est déjà installé. Après je ne sais pas quoi faire de la ligne suivante :
from gi.repository import Gtk
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#8 Le 25/09/2019, à 22:21
- pingouinux
Re : [RÉSOLU] Traduire script python2 en python3
En fait, j'ai l'impression qu'il suffit de remplacer
import pygtk
pygtk.require('2.0')
par
import gi
gi.require_version('Gtk', '3.0')
mais on a ensuite cette erreur
ImportError: No module named 'appindicator'
J'ai souvent utilisé 2to3 pour convertir mes scripts, sans tomber sur ce genre de problème. Je suis désolé de ne pouvoir t'aider.
Hors ligne
#9 Le 05/10/2019, à 18:02
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
Bon, j'ai réussi laborieusement à faire quelque chose qui fonctionne... Si il y a des trucs à corriger, changer ou moderniser, vous êtes les bienvenus.
J'ai un DeprecationWarning quand je lance dans un terminal. Si quelqu'un a une idée pour corriger ça...
cappind.py:61: DeprecationWarning: Gtk.ImageMenuItem.new_from_stock is deprecated
ent = gtk.ImageMenuItem.new_from_stock(gtk.STOCK_QUIT)
#!/usr/bin/env python3
#
# cappindicator, command line generic appindicator
# by reda_ea <reda.ea@gmail.com>
# license is do whatever you want with this code i don't care
# accepts input in forms of multiple lines
# of the form menu:submenu:...:entry:command
# empty command means separator
# implied parent menus are automatically created
# entries in the same path appear in the same order as in the input
# undefined behaviour on wrong input
#
import gi, sys, subprocess, argparse, gobject
gi.require_version('Gtk', '3.0')
gi.require_version('AppIndicator3', '0.1')
from gi.repository import Gtk as gtk
from gi.repository import AppIndicator3 as appindicator
ICON_THEME = gtk.IconTheme.get_default()
class CmdAppIndicator:
def __init__(self, persist, icon, label):
# parameters
self.persist = persist
self.icon = icon
self.status = appindicator.IndicatorStatus.ATTENTION
self.label = label
# indicator
self.ind = appindicator.Indicator.new("c-indicator", self.icon, appindicator.IndicatorCategory.OTHER)
self.ind.set_label(self.label, "")
self.ind.set_icon_theme_path(self.icon)
self.ind.set_status(self.status)
# menu
self.menu = gtk.Menu()
self.submenus = dict()
for line in sys.stdin:
line = line[0:len(line)-1] # removing last '\n'
self.add_menu(self.menu, line, line)
if self.persist:
self.add_quit()
self.menu.show()
self.ind.set_menu(self.menu)
def add_entry(self, parent, name, path):
ent = gtk.MenuItem.new_with_label(name)
ent.connect("activate", self.say, path)
ent.show()
parent.append(ent)
def add_sep(self, parent):
sepr = gtk.SeparatorMenuItem()
sepr.show()
parent.append(sepr)
def add_quit(self):
self.add_sep(self.menu)
ent = gtk.ImageMenuItem.new_from_stock(gtk.STOCK_QUIT)
ent.connect("activate", gtk.main_quit)
ent.show()
self.menu.append(ent)
def run(self, w, cmd):
subprocess.Popen(cmd, shell=True)
if not self.persist:
gtk.main_quit()
def say(self, w, name):
print(name)
sys.stdout.flush()
if not self.persist:
gtk.main_quit()
def get_child(self, parent, name):
if parent not in self.submenus:
self.submenus[parent] = dict()
children = self.submenus[parent]
if name not in children :
child = gtk.Menu()
child.show()
item = gtk.MenuItem.new_with_label(name)
item.set_submenu(child)
item.show()
parent.append(item)
children[name] = child
return children[name]
def add_menu(self, parent, line, path):
s = line.split(':', 1)
if len(s) > 1:
child = self.get_child(parent, s[0])
self.add_menu(child, s[1], path)
else:
if len(s[0]) == 0:
self.add_sep(parent)
else:
self.add_entry(parent, line, path)
if __name__ == "__main__":
# command line params
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description='Command line generic appindicator.\n\n'
'Menu elements are given in standard input as lines in the form:\n\n'
'\tmenu:submenu:subsubmenu:entry\n\n'
'Menu structure is automatically built, selecting a leaf '
'will print the associated input line (the whole path).')
parser.add_argument('-i', '--icon', default='terminal', help='the indicator icon name')
parser.add_argument('-l', '--label', default='', help='optional label (not recommended)')
parser.add_argument('-p', '--persist', action='store_true', default=False,
help='keep the indicator running after a selection (an additional "Quit" entry will be added)')
parser.add_argument('-t', '--timeout', type=int, default=-1,
help='a timeout in seconds after which the indicator will be closed')
args = parser.parse_args()
if args.timeout >= 0:
gobject.timeout_add(args.timeout*1000, gtk.main_quit)
indicator = CmdAppIndicator(args.persist, args.icon, args.label)
gtk.main()
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#10 Le 05/10/2019, à 18:17
- Roschan
Re : [RÉSOLU] Traduire script python2 en python3
c'est juste un warning tu peux t'en fiche
sinon : https://lazka.github.io/pgi-docs/Gtk-3. … uItem.html (résumé : utilise un menuitem normal)
Hors ligne
#11 Le 05/10/2019, à 19:06
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
J'avais bien vu cette page mais pour l'instant, je ne vois pas comment faire...
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#12 Le 05/10/2019, à 19:11
- Roschan
Re : [RÉSOLU] Traduire script python2 en python3
certainement
ent = Gtk.MenuItem.new_with_label("Quitter")
Hors ligne
#13 Le 05/10/2019, à 20:03
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
Effectivement, c'est simple. Dans mon cas, c'est "gtk" en minuscule :
ent = gtk.MenuItem.new_with_label("Quitter")
Question subsidiaire : Dans un temps pas si lointain, toujours dans le menu, à gauche du mot "Quitter", s'affichait l'icône idoine. Que dois-je ajouter pour l'afficher à nouveau ?
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#14 Le 05/10/2019, à 20:46
- Roschan
Re : [RÉSOLU] Traduire script python2 en python3
Dans mon cas
ton cas t'éloigne sans raison valable de l'ensemble de la doc en ligne, importe Gtk normalement et le tour sera joué
Pour l'image :
def add_quit(self):
self.add_sep(self.menu)
item = Gtk.MenuItem()
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
icon = Gtk.Image().new_from_icon_name('application-exit-symbolic', Gtk.IconSize.MENU)
label = Gtk.Label(label="Quitter")
box.add(icon)
box.add(label)
item.add(box)
item.connect('activate', Gtk.main_quit)
item.show_all()
self.menu.append(item)
Dernière modification par Roschan (Le 06/10/2019, à 14:07)
Hors ligne
#15 Le 06/10/2019, à 07:04
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
J'ai importé Gtk normalement. Ça fonctionne mais pas toujours pas d'image...
#!/usr/bin/env python3
#
# cappindicator, command line generic appindicator
# by reda_ea <reda.ea@gmail.com>
# license is do whatever you want with this code i don't care
# accepts input in forms of multiple lines
# of the form menu:submenu:...:entry:command
# empty command means separator
# implied parent menus are automatically created
# entries in the same path appear in the same order as in the input
# undefined behaviour on wrong input
#
import gi, sys, subprocess, argparse, gobject
gi.require_version('Gtk', '3.0')
gi.require_version('AppIndicator3', '0.1')
from gi.repository import Gtk
from gi.repository import AppIndicator3 as appindicator
ICON_THEME = Gtk.IconTheme.get_default()
class CmdAppIndicator:
def __init__(self, persist, icon, label):
# parameters
self.persist = persist
self.icon = icon
self.status = appindicator.IndicatorStatus.ATTENTION
self.label = label
# indicator
self.ind = appindicator.Indicator.new("c-indicator", self.icon, appindicator.IndicatorCategory.OTHER)
self.ind.set_label(self.label, "")
self.ind.set_icon_theme_path(self.icon)
self.ind.set_status(self.status)
# menu
self.menu = Gtk.Menu()
self.submenus = dict()
for line in sys.stdin:
line = line[0:len(line)-1] # removing last '\n'
self.add_menu(self.menu, line, line)
if self.persist:
self.add_quit()
self.menu.show()
self.ind.set_menu(self.menu)
def add_entry(self, parent, name, path):
ent = Gtk.MenuItem.new_with_label(name)
ent.connect("activate", self.say, path)
ent.show()
parent.append(ent)
def add_sep(self, parent):
sepr = Gtk.SeparatorMenuItem()
sepr.show()
parent.append(sepr)
def add_quit(self):
self.add_sep(self.menu)
item = Gtk.MenuItem.new()
box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=6)
icon = Gtk.Image.new_from_icon_name ('application-exit-symbolic', Gtk.IconSize.MENU)
label = Gtk.Label(label="Quitter")
box.add(icon)
box.add(label)
item.add(box)
item.connect('activate', Gtk.main_quit)
item.show_all()
self.menu.append(item)
def run(self, w, cmd):
subprocess.Popen(cmd, shell=True)
if not self.persist:
Gtk.main_quit()
def say(self, w, name):
print(name)
sys.stdout.flush()
if not self.persist:
Gtk.main_quit()
def get_child(self, parent, name):
if parent not in self.submenus:
self.submenus[parent] = dict()
children = self.submenus[parent]
if name not in children :
child = Gtk.Menu()
child.show()
item = Gtk.MenuItem.new_with_label(name)
item.set_submenu(child)
item.show()
parent.append(item)
children[name] = child
return children[name]
def add_menu(self, parent, line, path):
s = line.split(':', 1)
if len(s) > 1:
child = self.get_child(parent, s[0])
self.add_menu(child, s[1], path)
else:
if len(s[0]) == 0:
self.add_sep(parent)
else:
self.add_entry(parent, line, path)
if __name__ == "__main__":
# command line params
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
description='Command line generic appindicator.\n\n'
'Menu elements are given in standard input as lines in the form:\n\n'
'\tmenu:submenu:subsubmenu:entry\n\n'
'Menu structure is automatically built, selecting a leaf '
'will print the associated input line (the whole path).')
parser.add_argument('-i', '--icon', default='terminal', help='the indicator icon name')
parser.add_argument('-l', '--label', default='', help='optional label (not recommended)')
parser.add_argument('-p', '--persist', action='store_true', default=False,
help='keep the indicator running after a selection (an additional "Quit" entry will be added)')
parser.add_argument('-t', '--timeout', type=int, default=-1,
help='a timeout in seconds after which the indicator will be closed')
args = parser.parse_args()
if args.timeout >= 0:
gobject.timeout_add(args.timeout*1000, Gtk.main_quit)
indicator = CmdAppIndicator(args.persist, args.icon, args.label)
Gtk.main()
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#16 Le 06/10/2019, à 13:36
- Roschan
Re : [RÉSOLU] Traduire script python2 en python3
j'ai édité
Hors ligne
#17 Le 06/10/2019, à 13:53
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
Toujours pas d'image...
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#18 Le 06/10/2019, à 14:09
- Roschan
Re : [RÉSOLU] Traduire script python2 en python3
j'ai re-édité, et si après ça l'image ne marche toujours pas, mais que tu ne fournis pas de trace pour connaître le problème, et bah tant pis pour cette image si essentielle au fonctionnement du script
Hors ligne
#19 Le 06/10/2019, à 14:21
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
Ça ne fonctionne toujours pas. Pour être sûre que l'on parle bien de ma même chose, je poste un visuel de ce que je souhaite obtenir (c'est une image pour l'exemple, peu importe les icônes qui sont montrées).
Pour la trace, je veux bien mais je poste quoi ?
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#20 Le 06/10/2019, à 14:26
- Roschan
Re : [RÉSOLU] Traduire script python2 en python3
pas de trace pour connaître le problème
tant pis pour cette image si essentielle au fonctionnement du script
Hors ligne
#21 Le 06/10/2019, à 14:32
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
Moi aussi je peux me citer :
Pour la trace, je veux bien mais je poste quoi ?
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#22 Le 06/10/2019, à 14:40
- Roschan
Re : [RÉSOLU] Traduire script python2 en python3
si ya des erreurs quand tu lances depuis un terminal, tu postes les erreurs, c'est tout.
n'ayant pas le moindre "appindicator" ni autre truc de cet acabit avec GNOME, j'ai testé le code en l'ajoutant au clic droit de Gedit et ça marchait très bien (bon, cliquer dessus ne faisait rien, mais j'avais l'image)
Si il n'y a pas d'erreur, c'est que les appindicator ne te laissent pas utiliser n'importe quoi dans leur menu, auquel cas reviens juste à la classe dépréciée utilisée jusqu'à présent, un warning n'est pas un drame.
Hors ligne
#23 Le 06/10/2019, à 15:41
- lynn
Re : [RÉSOLU] Traduire script python2 en python3
Rien ne s'affiche dans le terminal... le script fonctionne tout à fait bien mais pas d'icône même avec la classe dépréciée.
Si il n'est pas possible d'afficher une image dans un menu, tant pis, je ferais sans ça.
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne