Re: Python3 issue with Tkinter (Was: Bug#938447: scoary: Python2 removal in sid/bullseye)

2019-09-13 Thread Andrey Rahmatullin
On Fri, Sep 13, 2019 at 10:04:12PM +0200, Andreas Tille wrote:
> try:
> ttk
> Tkinter
> except NameError:
> sys.exit("Need the following installed: Tkinter, tkFileDialog, ttk")
> 
> 
> I have no idea what the call to tkk is supposed to do 
Checking that the name exists.

> and why it ends up in a NameError.
The name doesn't exist, most likely because one of the ImportErrors
didn't happen. And it didn't happen because you ran 2to3 on code that
already supports both 2 and 3, thus turning the py2 parts into the py3
ones...

-- 
WBR, wRAR


signature.asc
Description: PGP signature


Python3 issue with Tkinter (Was: Bug#938447: scoary: Python2 removal in sid/bullseye)

2019-09-13 Thread Andreas Tille
Hi,

I think I ported scoary successfully to Python3 in Git[1].  The
command line applications seem to work but the GUI is just ending
with

   Need the following installed: Tkinter, tkFileDialog, ttk

For the more simple inspection I copy here the beginning which leads to
this:


import sys, os
import threading

try:
import tkinter
except ImportError:
#Python 3 issues
try:
import tkinter as Tkinter
except:
sys.exit("Need to have Tkinter / tkinter installed")

try:
import tkinter.filedialog
except ImportError:
# Python 3 issues
try:
from tkinter import filedialog
tkFileDialog = filedialog
except:
sys.exit("Could not find tkFileDialog / filedialog")

try:
import tkinter.ttk
except ImportError:
# Python 3 issues
try:
from tkinter import ttk as ttk
except:
sys.exit("Could not find ttk / tkinter.ttk")

try:
ttk
Tkinter
except NameError:
sys.exit("Need the following installed: Tkinter, tkFileDialog, ttk")


I have no idea what the call to tkk is supposed to do and why it ends up
in a NameError.  Any hints?

Kind regards

 Andreas.

[1] https://salsa.debian.org/med-team/scoary

-- 
http://fam-tille.de