Re: Difficulty in generating .exe from .py file

2020-02-25 Thread Abdur-Rahmaan Janhangeer
Can you share your codes? Thank you! On Wed, 26 Feb 2020, 00:45 Aakash Jana, wrote: > I have made a simple web scraper that scrapes Wikipedia and prints some > info on to the command line using requests and BeautifulSoup. Whenever I > execute pyinstaller it gives an error "expected integer got t

Python 3.8.2 and 3.9.0a4 are now available

2020-02-25 Thread Łukasz Langa
On behalf of the entire Python development community, and the currently serving Python release team in particular, I’m pleased to announce the release of two of the latest Python editions. Python 3.8.2 Python 3.8.2 is the second maintenance release of Python 3.8 and contains two months worth o

Re: encapsulating a global variable

2020-02-25 Thread Greg Ewing
On 26/02/20 3:56 am, BlindAnagram wrote: Does that not have the advantage of preventing the global directory being directly fiddled with elsewhere? That depends on what you mean by "prevent". There is nothing to stop any code from directly accessing the .seen attribute of the class. It might m

Re: encapsulating a global variable

2020-02-25 Thread Greg Ewing
On 26/02/20 4:06 am, BlindAnagram wrote: My interest in this stems from wanting to keep the dictionary only available to the function that uses it and also a worry about being called from threaded code. Doing this won't make any difference to the way threaded code behaves. Threading problems ne

Difficulty in generating .exe from .py file

2020-02-25 Thread Aakash Jana
I have made a simple web scraper that scrapes Wikipedia and prints some info on to the command line using requests and BeautifulSoup. Whenever I execute pyinstaller it gives an error "expected integer got type bytes" although the code runs perfectly. I am using python 3.8 -- https://mail.python.or

Re: Tkinter layout designer

2020-02-25 Thread mm0fmf
I don't claim to be an expert on Windows Forms, I inherited the support role and have added the odd widget over the years. The apps work but scream that their UI has been incrementally arrived at by someone who was just tinkering. :-) Thanks for the suggestions, I'll give Page a try. -- https

Re: encapsulating a global variable (BlindAnagram)

2020-02-25 Thread BlindAnagram
On 25/02/2020 17:16, Christman, Roger Graydon wrote: >> On Tue, 25 Feb 2020 3:06 PM BlindAnagram wrote: > >> My interest in this stems from wanting to keep the dictionary only >> available to the function that uses it and also a worry about being >> called from threaded code. > > It seems like t

Re: Tkinter layout designer

2020-02-25 Thread jfong
mm0fmf於 2020年2月25日星期二 UTC+8上午5時29分33秒寫道: > Can anyone recommend a graphic layout designer for Tkinter programs. I > have a number of older C# Windows Forms apps that need porting so they > can run on Linux and Windows and this is the chance to re-write them in > Python. However, after using the

Re: encapsulating a global variable

2020-02-25 Thread Dieter Maurer
BlindAnagram wrote at 2020-2-25 12:38 +: >I would appreciate advice on whether it is possible to avoid the use of >a global variable used in a function by encapsulating it in a class >without maaking any changes to the call interface (which I cannot change). > >I have: > > >seen

Re: encapsulating a global variable (BlindAnagram)

2020-02-25 Thread Christman, Roger Graydon
> On Tue, 25 Feb 2020 3:06 PM BlindAnagram wrote: > My interest in this stems from wanting to keep the dictionary only > available to the function that uses it and also a worry about being > called from threaded code. It seems like the simplest solution for this is to make a completely new file

Re: encapsulating a global variable

2020-02-25 Thread BlindAnagram
On 25/02/2020 16:36, Rhodri James wrote: > On 25/02/2020 15:20, BlindAnagram wrote: >>> class GetIt: >>>    seen = dict() >>> >>>    def __call__(self, piece): >>> return GetIt.seen[piece] >>> >>> get_it = GetIt() >>> >>> but then you have a global class instance hanging around, which is not >

Re: encapsulating a global variable

2020-02-25 Thread Rhodri James
On 25/02/2020 15:20, BlindAnagram wrote: class GetIt:   seen = dict()   def __call__(self, piece):     return GetIt.seen[piece] get_it = GetIt() but then you have a global class instance hanging around, which is not actually any better than a global dictionary. This doesn't work for me sin

Re: encapsulating a global variable

2020-02-25 Thread BlindAnagram
On 25/02/2020 14:14, Rhodri James wrote: > On 25/02/2020 12:38, BlindAnagram wrote: >> I would appreciate advice on whether it is possible to avoid the use of >> a global variable used in a function by encapsulating it in a class >> without maaking any changes to the call interface (which I cannot

Re: encapsulating a global variable

2020-02-25 Thread BlindAnagram
On 25/02/2020 14:13, Chris Angelico wrote: > On Wed, Feb 26, 2020 at 12:11 AM BlindAnagram > wrote: >> >> On 25/02/2020 12:56, Chris Angelico wrote: >>> On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram >>> wrote: I would appreciate advice on whether it is possible to avoid the use of >>>

Re: encapsulating a global variable

2020-02-25 Thread BlindAnagram
On 25/02/2020 14:14, Rhodri James wrote: > On 25/02/2020 12:38, BlindAnagram wrote: >> I would appreciate advice on whether it is possible to avoid the use of >> a global variable used in a function by encapsulating it in a class >> without maaking any changes to the call interface (which I cannot

Re: time.localtime add a parameter for timezone

2020-02-25 Thread Peter J. Holzer
On 2020-02-24 17:43:58 +, Rhodri James wrote: > On 24/02/2020 17:21, Dieter Maurer wrote: > > qbit wrote at 2020-2-24 05:18 -0800: > > > How about adding a time zone parameter to time.localtime? > > > > > > A offset just like the form: ± hh[:mm[:ss]]. > > > > Why should this be necessary? `l

Re: encapsulating a global variable

2020-02-25 Thread Rhodri James
On 25/02/2020 12:38, BlindAnagram wrote: I would appreciate advice on whether it is possible to avoid the use of a global variable used in a function by encapsulating it in a class without maaking any changes to the call interface (which I cannot change). I have: seen = dict()

Re: encapsulating a global variable

2020-02-25 Thread Chris Angelico
On Wed, Feb 26, 2020 at 12:11 AM BlindAnagram wrote: > > On 25/02/2020 12:56, Chris Angelico wrote: > > On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram > > wrote: > >> > >> I would appreciate advice on whether it is possible to avoid the use of > >> a global variable used in a function by encapsul

Re: encapsulating a global variable

2020-02-25 Thread BlindAnagram
On 25/02/2020 12:50, Musbur wrote: > > Am 25.02.2020 13:38 schrieb BlindAnagram: >> and I am wondering if it is possible to use a class something like >> >> class get_it(object): >> >>   seen = dict() >> >>   def __call__(piece): >>     return seen[piece] > > What happened when you tried it? The

Re: encapsulating a global variable

2020-02-25 Thread BlindAnagram
On 25/02/2020 12:56, Chris Angelico wrote: > On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram > wrote: >> >> I would appreciate advice on whether it is possible to avoid the use of >> a global variable used in a function by encapsulating it in a class >> without maaking any changes to the call inter

Re: encapsulating a global variable

2020-02-25 Thread Musbur
Am 25.02.2020 13:38 schrieb BlindAnagram: and I am wondering if it is possible to use a class something like class get_it(object): seen = dict() def __call__(piece): return seen[piece] What happened when you tried it? -- https://mail.python.org/mailman/listinfo/python-list

Re: encapsulating a global variable

2020-02-25 Thread Chris Angelico
On Tue, Feb 25, 2020 at 11:41 PM BlindAnagram wrote: > > I would appreciate advice on whether it is possible to avoid the use of > a global variable used in a function by encapsulating it in a class > without maaking any changes to the call interface (which I cannot change). Why bother? If you ar

encapsulating a global variable

2020-02-25 Thread BlindAnagram
I would appreciate advice on whether it is possible to avoid the use of a global variable used in a function by encapsulating it in a class without maaking any changes to the call interface (which I cannot change). I have: seen = dict() def get_it(piece): ... return seen[p

Re: Tkinter layout designer

2020-02-25 Thread Sibylle Koczian
Am 25.02.2020 um 07:32 schrieb Christian Gollwitzer: Am 24.02.20 um 22:29 schrieb mm0fmf: Can anyone recommend a graphic layout designer for Tkinter programs. I have a number of older C# Windows Forms apps that need porting so they can run on Linux and Windows and this is the chance to re-wri