Re: Single line if statement with a continue

2022-12-15 Thread Cecil Westerhof via Python-list
terribly dogmatic about the go to statement. I have the uncomfortable feeling that others are making a religion out of it, as if the conceptual problems of programming could be solved by a simple trick, by a simple form of coding discipline! -- Cecil Westerhof Senior Software Engineer

Re: How to get the needed version of a dependency

2022-12-14 Thread Cecil Westerhof via Python-list
DFS writes: > On 12/14/2022 3:55 AM, Cecil Westerhof wrote: >> If I want to know the dependencies for requests I use: >> pip show requests >> And one of the lines I get is: >> Requires: certifi, charset-normalizer, idna, urllib3 >> But I want (i

How to get the needed version of a dependency

2022-12-14 Thread Cecil Westerhof via Python-list
If I want to know the dependencies for requests I use: pip show requests And one of the lines I get is: Requires: certifi, charset-normalizer, idna, urllib3 But I want (in this case) to know with version of charset-normalizer requests needs. How do I get that? -- Cecil Westerhof Senior

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Alan Bawden writes: > Cecil Westerhof writes: > >Yes, I try to select a random element, but it has also to be removed, >because an element should not be used more as once. > > Instead of using pop to do that why not something like: > >

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
ot be a lot more expensive? Especially because I do >> not eat the whole list. >> > You won't know until you time it. A first indication is that it doubles the needed time. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Roel Schroeven writes: > Cecil Westerhof via Python-list schreef op 27/07/2022 om 17:43: >> "Michael F. Stemper" writes: >> >> > This is orthogonal to your question, but might be of some use to you: >> > >> > The combination of using len

Re: More efficient code, but slower program

2022-07-27 Thread Cecil Westerhof via Python-list
2qdxy4rzwzuui...@potatochowder.com writes: > On 2022-07-27 at 17:48:47 +0200, > Regarding "Re: More efficient code, but slower program," > Cecil Westerhof via Python-list wrote: > >> r...@zedat.fu-berlin.de (Stefan Ram) writes: >> >> > Cecil W

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
MRAB writes: > On 27/07/2022 16:43, Cecil Westerhof via Python-list wrote: >> "Michael F. Stemper" writes: >> >>> This is orthogonal to your question, but might be of some use to you: >>> >>> The combination of using len(to_try) a

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Dennis Lee Bieber writes: > On Wed, 27 Jul 2022 10:45:47 +0200, Cecil Westerhof > declaimed the following: > > >>What do you mean with where the python version is from? > > Base Python.org download, ActiveState package download, Anaconda > package download, nati

More efficient code, but slower program

2022-07-27 Thread Cecil Westerhof via Python-list
with the copy a little bit better, so I kept it. But I am curious why the effect is the opposite of what I expected. It does not hurt to understand optimisation better, so I can do a better job when I need it. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Dennis Lee Bieber writes: > On Tue, 26 Jul 2022 23:47:59 +0200, Cecil Westerhof > declaimed the following: > > >>The new code: >>from random import SystemRandom >>system_random = SystemRandom() >>index = system_random.randint(0, len(to_try

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
dbelow(len(to_try)) index = randrange(len(to_try)) found = permutation[to_try.pop(index)] -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Wed, 27 Jul 2022 at 08:18, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> > On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list >> > wrote: >> >> >> >> Chris A

Re: More efficient code, but slower program

2022-07-27 Thread Cecil Westerhof via Python-list
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Cecil Westerhof writes: >>values = [*range(100)] > > In many cases, any iterable is just fine and a list is not > required, just as peudo-random numbers often are just fine and > real-world entropy is not required. In

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
Barry writes: >> On 26 Jul 2022, at 16:07, Cecil Westerhof via Python-list >> wrote: >> >> I need to get a random integer. At first I tried it with: >>from secrets import randbelow >>index = randbelow(len(to_try)) >> >> This works perf

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Cecil Westerhof via Python-list
be used more as once. This is the code I use: # index = randbelow(len(to_try)) index = randrange(len(to_try)) found = permutation[to_try.pop(index)] -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Wed, 27 Jul 2022 at 06:06, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list >> > wrote: >> >> >> >> I need

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Wed, 27 Jul 2022 at 01:06, Cecil Westerhof via Python-list > wrote: >> >> I need to get a random integer. At first I tried it with: >> from secrets import randbelow >> index = randbelow(len(to_try)) >> >> This wo

random.SystemRandom().randint() inefficient

2022-07-26 Thread Cecil Westerhof via Python-list
indication is that the second version would take about two times as much time as the first. Is there a reason for this, or should this not be happening? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python

Re: Functionality like local static in C

2022-04-15 Thread Cecil Westerhof via Python-list
and Eastern. Cecil Westerhof writes: > In C when you declare a variable static in a function, the variable > retains its value between function calls. > The first time the function is called it has the default value (0 for > an int). > But when the function changes the value in a call (fo

Functionality like local static in C

2022-04-14 Thread Cecil Westerhof via Python-list
the variable does not have the default value, but the value it had when the function returned. Does python has something like that? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Sharing part of a function

2022-04-07 Thread Cecil Westerhof via Python-list
Cecil Westerhof writes: > To show why it is often easy, but wrong to use recursive functions I > wrote the following two Fibonacci functions: > def fib_ite(n): > if not type(n) is int: > raise TypeError(f'Need an integer ({n})') > if n < 0

Re: Sharing part of a function

2022-04-03 Thread Cecil Westerhof via Python-list
memo[n] > > > print(100, fib(100)) > print(memo) No, it is not. It is the answer on a completely different question. Nice, but not what I was asking about. And there is even an error in the solution. By the way: it is better to do it iterative. Try (when not done a calculation before

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-31 Thread Cecil Westerhof via Python-list
these versions. Any security fixes and other critical bug fixes > were back-ported to these versions. Are you sure? In the past this was not the case, but it is possible that this has changed. (I do not really follow other distributions. I am quite happy with Debian.) -- Cecil Westerhof S

Temporally disabling buffering

2022-03-31 Thread Cecil Westerhof via Python-list
unbuffered for the current run and buffered for other runs where the output goes to a pipe. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-31 Thread Cecil Westerhof via Python-list
"Peter J. Holzer" writes: > On 2022-03-28 15:35:07 +0200, Cecil Westerhof via Python-list wrote: >> "Loris Bennett" writes: >> > Ubuntu is presumably relying on the Debian security team as well as >> > other volunteers and at least one compan

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-28 Thread Cecil Westerhof via Python-list
ntu for servers is that Ubuntu wants to be up to date. So Ubuntu starts very close to Debian security wise, but will shift rapidly. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Openning Python program

2022-02-08 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Tue, 8 Feb 2022 at 06:51, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> >> > How difficult would it be to get people to read those lines, though? >> >> >> >> That

Re: Openning Python program

2022-02-07 Thread Cecil Westerhof via Python-list
f you do indeed want to cancel those transfers, click > "Cancel", but if you actually don't want to, click "Cancel" instead. His dialog was crystal clear. The problem was that most users just click OK without reading the message. And that was what his little experim

Re: Openning Python program

2022-02-07 Thread Cecil Westerhof via Python-list
le to read those lines, though? That does remind me about a system administrator who wanted to make a point. He changed something on the server so all the Windows computers started up and gave a message: If you want to continue: click Cancel The help-desk became flooded with calls. I think h

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Sat, 5 Feb 2022 at 04:33, Cecil Westerhof via Python-list > wrote: >> >> Ethan Furman writes: >> >> > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: >> > >> >> It was already not a good name, but I am

RuntimeError, or user defined exception

2022-02-04 Thread Cecil Westerhof via Python-list
I am creating a class that will call a user defined function on user defined intervals. In my opinion it is an error when the function takes more as 10% of interval, or more as half a second. What is better: just using RuntimeError, or creating two exception classes for this? -- Cecil Westerhof

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Igor Berger writes: > On Friday, February 4, 2022 at 12:28:53 PM UTC-5, Cecil Westerhof wrote: >> Ethan Furman writes: >> >> > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: >> > >> >> It was already not a good name, but I am rewriting

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Ethan Furman writes: > On 2/4/22 6:28 AM, Cecil Westerhof via Python-list wrote: > >> It was already not a good name, but I am rewriting the class >> completely, so now the name is a complete bumper. (No more timer.) I >> am thinking about naming the class repeating_

Re: Waht do you think about my repeated_timer class

2022-02-04 Thread Cecil Westerhof via Python-list
Cecil Westerhof writes: It was already not a good name, but I am rewriting the class completely, so now the name is a complete bumper. (No more timer.) I am thinking about naming the class repeating_thread, but I cannot say that I find it a very good name. So if someone has a good idea

Re: Waht do you think about my repeated_timer class

2022-02-03 Thread Cecil Westerhof via Python-list
Barry writes: >> On 3 Feb 2022, at 04:45, Cecil Westerhof via Python-list >> wrote: >> >> Have to be careful that timing keeps correct when target takes a 'lot' >> of time. >> Something to ponder about, but can wait. > > You have noticed that your

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
Chris Angelico writes: > On Thu, 3 Feb 2022 at 15:43, Cecil Westerhof via Python-list > wrote: >> >> Chris Angelico writes: >> >> >> > (Side point: The OP's code is quite inefficient, as it creates a new >> >> > thread for each reiteration,

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
Cecil Westerhof writes: > I need (sometimes) to repeatedly execute a function. For this I wrote > the below class. What do you think about it? I wrote some unit test for the class. Is this the correct way to do this? For example in test_correct_params_no_start I check four things. Some

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
2qdxy4rzwzuui...@potatochowder.com writes: > FWIW, I'd find some way to tell users the units (seconds, milliseconds, > fortnights, etc.) instead of making them wade through your code to find > the call to (and possibly the [broken] help text of) Timer. You mean with docstring?

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
ay "class X(object)"), which will > automatically give your object all the methods of a timer. Of-course. I should have thought about that. :'-( -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
al, (int,float)): > > which handles subclasses of these types (but note that bool subclasses > int :-) Done, thanks. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
Cecil Westerhof writes: >> (regardless of your OS). The same could be done with this timer; an >> __exit__ method would make a lot of sense here, and would allow the >> timer to be used in a with block to govern its execution. (It also >> isn't really necessary, but if

Re: Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
want a good Pythonic way to show > the beginning and end of its use area, a 'with' block is the way to > go.) I will look into that. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Waht do you think about my repeated_timer class

2022-02-02 Thread Cecil Westerhof via Python-list
elf): if not self._is_running: self._next() self._is_running = True def stop(self): if self._is_running: self._timer.cancel() self._timer = None self._is_running = False -- Cecil Wester

Re: Big jump in version

2021-10-07 Thread Cecil Westerhof via Python-list
Grant Edwards writes: > On 2021-10-04, Cecil Westerhof via Python-list wrote: >> When I run: >> pip3 list --outdated >> >> I get: >> Package Version Latest Type >> --- -- - >> cryptography 3.4.8 35.0.0

Big jump in version

2021-10-05 Thread Cecil Westerhof via Python-list
not updated pyzstd for a long time, because that breaks py7zr which needs a version lower as 0.15.0. Any chance that py7zr is going to be updated? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Cannot update parso

2020-11-21 Thread Cecil Westerhof via Python-list
iction is active. Why is jedi not updated. (I cannot uninstall jedi, because it is used by ipython.) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Why does super(bool) give None

2020-04-24 Thread Cecil Westerhof
Cecil Westerhof writes: >> I've never actually looked at the repr of a super object - I've always >> just called a method on it immediately after constructing it. Never >> seen a need to hang onto one :) > > Well, maybe I will never need it, but I am just curious. And

Re: Why does super(bool) give None

2020-04-24 Thread Cecil Westerhof
Chris Angelico writes: > On Fri, Apr 24, 2020 at 4:16 PM Cecil Westerhof wrote: >> >> issubclass(bool, int) gives True >> but >> super(bool) gives >> >> Do I not understand the meaning of super, or is this inconsistent? >> >> (Until n

Why does super(bool) give None

2020-04-24 Thread Cecil Westerhof
issubclass(bool, int) gives True but super(bool) gives Do I not understand the meaning of super, or is this inconsistent? (Until now I have not down much work with classes in Python.) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https

Re: What about idea of making a "Pythonic Lisp"...i.e. a Lisp that more closely resembles the syntax of Python?

2019-09-19 Thread Cecil Westerhof
== sum(b) > True > >>> sum(b) == sum(a) > False Why does this happen? By the way, when you change the last statement to: sum(a) == sum(b) you also get False. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Use global, or not

2019-06-29 Thread Cecil Westerhof
DL Neil writes: > On 29/06/19 1:44 AM, Cecil Westerhof wrote: >> I have written a GUI program where I have quit a few global variables. >> I did not like this, so I now use one global dict. Something like: >> global global_dict > ... > >>

Use global, or not

2019-06-28 Thread Cecil Westerhof
']['warning'], global_dict['messages']['nofiles']) Is that an acceptable way to do this? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Only a message at the highest exception

2019-06-28 Thread Cecil Westerhof
Cameron Simpson writes: > On 28Jun2019 12:17, Cecil Westerhof wrote: >>Chris Angelico writes: >>> On Fri, Jun 28, 2019 at 7:33 PM Cecil Westerhof wrote: >>>> I have a tkinter program where I have a function generate_report >>>> which >>

Re: Only a message at the highest exception

2019-06-28 Thread Cecil Westerhof
Chris Angelico writes: > On Fri, Jun 28, 2019 at 7:33 PM Cecil Westerhof wrote: >> >> I have a tkinter program where I have a function generate_report which >> in a try block calls the function append_row. This function has also a >> try block. When they get an

Re: Hiding a progressbar in tkinter

2019-06-28 Thread Cecil Westerhof
MRAB writes: > On 2019-06-26 16:47, Cecil Westerhof wrote: >> I just started with GUI stuff in tkinter. I have a progressbar, but I >> want it to be only visible when it is used. So I tried the following: >> window = Tk() >> window.title(window_str) &g

Only a message at the highest exception

2019-06-28 Thread Cecil Westerhof
r should I do it differently? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a Windows executable on a Linux system

2019-06-28 Thread Cecil Westerhof
Cecil Westerhof writes: > Cecil Westerhof writes: > >> I need to write a Python desktop program. I create it on a Linux >> system, but it has to run on a Windows system. When looking at how to >> create an executable it seems that you need to be on a Windows syste

Re: Copying a row from a range of Excel files to another

2019-06-28 Thread Cecil Westerhof
MRAB writes: > On 2019-06-26 22:14, Cecil Westerhof wrote: >> MRAB writes: >> >>> Does Workbook support the 'with' statement? >>> >>> If it does, then that's the best way of doing it. >>> >>> (Untested) >>> >&

Re: Creating a Windows executable on a Linux system

2019-06-28 Thread Cecil Westerhof
Cecil Westerhof writes: > I need to write a Python desktop program. I create it on a Linux > system, but it has to run on a Windows system. When looking at how to > create an executable it seems that you need to be on a Windows system > to create a Windows executable.

Re: Make sure the window title is visible in tkinter

2019-06-28 Thread Cecil Westerhof
Cecil Westerhof writes: > Wildman writes: > >> On Wed, 26 Jun 2019 13:25:15 +0200, Cecil Westerhof wrote: >> >>> I need to write a desktop program. I choose to use tkinter. How can I >>> make sure the window title is visible? For example when I have the >

Re: Copying a row from a range of Excel files to another

2019-06-26 Thread Cecil Westerhof
load_workbook(filepath) as wb_in: > for cell in wb_in.active[src_row]: > current_row.append(cell.value) > > wb_out.active.append(current_row) > > wb_out.save(report_start + datetime.now().strftime('%Y-%m-%d') + > report_end) It

Hiding a progressbar in tkinter

2019-06-26 Thread Cecil Westerhof
ot hide the progressbar. What am I doing wrong? I could use pack_forget, but that will change the dimensions of the window. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Make sure the window title is visible in tkinter

2019-06-26 Thread Cecil Westerhof
Wildman writes: > On Wed, 26 Jun 2019 13:25:15 +0200, Cecil Westerhof wrote: > >> I need to write a desktop program. I choose to use tkinter. How can I >> make sure the window title is visible? For example when I have the >> following code: >> from tkinter

Re: Copying a row from a range of Excel files to another

2019-06-26 Thread Cecil Westerhof
Cecil Westerhof writes: > Is it necessary to close the workbooks to circumvent a resource > leak? Still like to know. When not necessary it is better not to cloes them I think. > Is it a problem when a workbook is closed two times? If so I need to > make sure that this is

Re: Creating a Windows executable on a Linux system

2019-06-26 Thread Cecil Westerhof
"Peter Heitzer" writes: > Cecil Westerhof wrote: >>I need to write a Python desktop program. I create it on a Linux >>system, but it has to run on a Windows system. When looking at how to >>create an executable it seems that you need to be on a Windows system &

Re: Copying a row from a range of Excel files to another

2019-06-26 Thread Cecil Westerhof
Cecil Westerhof writes: > I was asked to copy a certain line from about 300 Excel lines to a new > Excel file. That is not something I would like to do by hand and I > immediately thought: that should be possible with Python. > > And it is. I was surprised how fas

Re: What type of error is it

2019-06-26 Thread Cecil Westerhof
Cecil Westerhof writes: > I am writing a GUI program with tkinter. One function I have is: > def select_dir(): > try: > directory = filedialog.askdirectory() > if directory == '': > messagebox.showinfo(info_str, canceled_report) &g

What type of error is it

2019-06-26 Thread Cecil Westerhof
was. That works, because tkinter takes over again. This works for me when I run it from the command-line, but it has to become a stand-alone executable. Is there a way to find out what the cause of the exception was, so I can put it in the error message? -- Cecil Westerhof Senior Software Engineer LinkedIn

Make sure the window title is visible in tkinter

2019-06-26 Thread Cecil Westerhof
(window, text = 'Short text').pack() window.mainloop() I see only a part of the 'A', but I would like to see the complete: 'A long window title' -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python

Creating a Windows executable on a Linux system

2019-06-26 Thread Cecil Westerhof
executable on a Linux system? Any pointers about best practice creating a standalone executable are welcome. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Copying a row from a range of Excel files to another

2019-06-26 Thread Cecil Westerhof
, 4, 5, 7, 8, 9 and 10. Should I catch every exception alone, or all together, or something in between? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Handling an connection error with Twython

2019-06-01 Thread Cecil Westerhof
"Peter J. Holzer" writes: > On 2019-05-25 13:46:40 +0200, Cecil Westerhof wrote: >> Just changing the while loop to a for loop did not make sense to me, >> but this does. I now have: >> max_tries = 5 >> for current_try in range(1, max_tries):

Re: Handling an connection error with Twython

2019-05-25 Thread Cecil Westerhof
MRAB writes: > On 2019-05-24 09:25, Cecil Westerhof wrote: >> Dennis Lee Bieber writes: >> >>> On Fri, 24 May 2019 07:49:23 +0200, Cecil Westerhof >>> declaimed the following: >>> >>>> >>>>I did not do that consciously, because

Re: Handling an connection error with Twython

2019-05-24 Thread Cecil Westerhof
Dennis Lee Bieber writes: > On Fri, 24 May 2019 07:49:23 +0200, Cecil Westerhof > declaimed the following: > >> >>I did not do that consciously, because I have to try until it is >>successful an I return, or I reached the max tries and re-raise the >>except

Re: Handling an connection error with Twython

2019-05-24 Thread Cecil Westerhof
MRAB writes: > On 2019-05-23 22:55, Cecil Westerhof wrote: >> Cecil Westerhof writes: >> >>> I am using Twython to post updates on Twitter. Lately there is now and >>> then a problem with my internet connection. I am using: >>> poste

Re: Handling an connection error with Twython

2019-05-23 Thread Cecil Westerhof
Cecil Westerhof writes: > I am using Twython to post updates on Twitter. Lately there is now and > then a problem with my internet connection. I am using: > posted = twitter.update_status(status = message, >in_reply_to_status_id

Handling an connection error with Twython

2019-05-23 Thread Cecil Westerhof
= True) What would be the best way to catch a connection error and try it (for example) again maximum three times with a delay of one minute? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Twython has a problem with latest urllib3

2018-10-19 Thread Cecil Westerhof
Cecil Westerhof writes: > I use Twython to post on Twitter. Yesterday I upgraded urllib3 from > 1.23 to 1.24. Since then when I do: > from twython import Twython > > I get: > /usr/local/lib/python3.5/dist-packages/requests/__init__.py:91: > RequestsDependencyW

Twython has a problem with latest urllib3

2018-10-18 Thread Cecil Westerhof
a supported version! RequestsDependencyWarning) Should I rollback urllib3, or hope that Twython is updated soon? It looks like that the functionality is not broken. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman

ipython and prompt-toolkit

2018-09-27 Thread Cecil Westerhof
For a long time I cannot update prompt-toolkit, because ipython requires a version lower as 2. That is why I still use 1.0.15 instead of 2.0.4. Any chance that ipython will be updated concerning this dependency? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com

Getting installed version

2018-07-20 Thread Cecil Westerhof
I can get the installed version of a package with: pip2 show cryptography | awk '/^Version: / { print $2 }' But I was wondering if there is a better way. -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman

How to get the versions of dependecies

2018-06-16 Thread Cecil Westerhof
onsole = IPython.lib.lexers:IPythonConsoleLexer -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

urllib3 1.23 breaks API

2018-06-05 Thread Cecil Westerhof
I had installed urllib3 1.22 for Python3. I upgraded it to 1.23. This broke the requirements for requests 2.18.4: requests 2.18.4 has requirement urllib3<1.23,>=1.21.1, but you'll have urllib3 1.23 which is incompatible I downgraded to 1.22, but this should not happen I think. --

Re: ipython does not work with latest version of prompt-toolkit

2018-06-03 Thread Cecil Westerhof
Chris Warrick writes: > On Sun, 3 Jun 2018 at 10:32, Cecil Westerhof wrote: >> >> When executing: >> pip3 list --no-cache-dir --outdated >> >> I got: >> prompt-toolkit 1.0.152.0.1wheel >> PyGObject 3.28.23.28.3 sdist &

ipython does not work with latest version of prompt-toolkit

2018-06-03 Thread Cecil Westerhof
ation, create_eventloop, create_prompt_layout, create_output ImportError: cannot import name 'create_prompt_application' When I now execute: pip3 list --no-cache-dir --outdated I do not get output. So pip3 thinks everything is OK. How do I fix this? Or is the expected that ipython3 will be updated

Re: After update to pip 10 I get: Cache entry deserialization failed, entry ignored

2018-04-26 Thread Cecil Westerhof
tart...@gmail.com writes: > On Wednesday, April 18, 2018 at 1:59:14 AM UTC-5, Cecil Westerhof wrote: >> After I updated pip2/3 to 10 from 9 I sometimes get: >> Cache entry deserialization failed, entry ignored >> >> For example when I execute:

After update to pip 10 I get: Cache entry deserialization failed, entry ignored

2018-04-18 Thread Cecil Westerhof
After I updated pip2/3 to 10 from 9 I sometimes get: Cache entry deserialization failed, entry ignored For example when I execute: pip3 list --outdated But not always. What could be happening here? And how would I solve this? -- Cecil Westerhof Senior Software Engineer LinkedIn: http

Strange problem with pip2

2018-03-01 Thread Cecil Westerhof
ed with error code 1 in /tmp/pip-build-vY4LXH/pycairo/ What could be happening here? And how do I solve this? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Replying on a tweet with Twython

2018-02-17 Thread Cecil Westerhof
Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes: > On Sat, 17 Feb 2018 12:53:08 +0100, Cecil Westerhof wrote: > >> Cecil Westerhof <ce...@decebal.nl> writes: >> >>> I just found Twython. I managed to post a tweet with: >>> from

Re: Replying on a tweet with Twython

2018-02-17 Thread Cecil Westerhof
Cecil Westerhof <ce...@decebal.nl> writes: > I just found Twython. I managed to post a tweet with: > from twython import Twython > twitter = Twython(APP_KEY, APP_SECRET, > OAUTH_TOKEN, OAUTH_TOKEN_SECRET) > posted = twitter.update_status(stat

Replying on a tweet with Twython

2018-02-17 Thread Cecil Westerhof
: posted = twitter.update_status(status = follow_up, in_reply_id = posted['id_str']) But that does not work. How could I make it work? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: From recovery.js to recoveryjsonlz4

2018-02-06 Thread Cecil Westerhof
breamore...@gmail.com writes: > On Monday, February 5, 2018 at 1:28:16 PM UTC, Cecil Westerhof wrote: >> I have a script to get the number of windows and tabs that firefox >> uses. It always used a file recovery.js, but it changed to >> recovery.jsonlz4. >> >>

From recovery.js to recoveryjsonlz4

2018-02-05 Thread Cecil Westerhof
with this file? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

How to use a regexp here

2017-12-08 Thread Cecil Westerhof
I have a script that was running perfectly for some time. It uses: array = [elem for elem in output if 'CPU_TEMP' in elem] But because output has changed, I have to check for CPU_TEMP at the beginning of the line. What would be the best way to implement this? -- Cecil Westerhof Senior

Re: How to use a regexp here

2017-12-08 Thread Cecil Westerhof
of the string, then > it is the best choice. Yes, I am sure it is always at the beginning of the line. (It is output from the Linux sensors command.) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: How to use a regexp here

2017-12-08 Thread Cecil Westerhof
Neil Cerutti <ne...@norwich.edu> writes: > On 2017-12-04, Cecil Westerhof <ce...@decebal.nl> wrote: >> Joel Goldstick <joel.goldst...@gmail.com> writes: >> >>> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder <n...@nedbatchelder.com> >>>

Re: How to use a regexp here

2017-12-08 Thread Cecil Westerhof
Joel Goldstick <joel.goldst...@gmail.com> writes: > On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder <n...@nedbatchelder.com> > wrote: > >> On 12/4/17 4:36 AM, Cecil Westerhof wrote: >> >>> I have a script that was running perfectly for some time. It uses:

Re: How to use a regexp here

2017-12-08 Thread Cecil Westerhof
Ned Batchelder <n...@nedbatchelder.com> writes: > On 12/4/17 4:36 AM, Cecil Westerhof wrote: >> I have a script that was running perfectly for some time. It uses: >> array = [elem for elem in output if 'CPU_TEMP' in elem] >> >> But because output has chan

Re: How to use a regexp here

2017-12-04 Thread Cecil Westerhof
Neil Cerutti <ne...@norwich.edu> writes: > On 2017-12-04, Cecil Westerhof <ce...@decebal.nl> wrote: >> Joel Goldstick <joel.goldst...@gmail.com> writes: >> >>> On Mon, Dec 4, 2017 at 5:21 AM, Ned Batchelder <n...@nedbatchelder.com> >>>

  1   2   3   4   5   >