Re: [Tutor] Exception not working as expected?

2019-03-01 Thread Cameron Simpson
On 02Mar2019 00:05, Alan Gauld wrote: On 01/03/2019 19:23, Chip Wachob wrote: I'm not sure what you mean by putting the except close to the int(). He means you should have a try/except for the int conversion, typically something like: # wait for it... try: num_items = int(raw_input(": "))

Re: [Tutor] Exception not working as expected?

2019-03-01 Thread Alan Gauld via Tutor
On 01/03/2019 19:23, Chip Wachob wrote: > I'm not sure what you mean by putting the except close to the int(). He means you should have a try/except for the int conversion, typically something like: # wait for it... try: num_items = int(raw_input(": ")) except ValueError: # try a sec

Re: [Tutor] Exception not working as expected?

2019-03-01 Thread Chip Wachob
Eryk Thank you for the in-depth explanation and code sample. I was able to use the sample code to create a functional script. Now, I'm still not completely following what you mean in the last couple of paragraphs about the except ValueError. I realized that I am never actually trapping on the e

Re: [Tutor] Exception not working as expected?

2019-03-01 Thread Chip Wachob
Alan, Thanks. Once again, a case of not finding a tree in the forest... One of these days I'll remember to KISS and try some SIMPLE experimentation... So I did your experiment with just the single line raw_input('>'), ran it, and used Ctrl-C to exit. Traceback shown below. C:\Temp_Python\Ex

Re: [Tutor] Exception not working as expected?

2019-03-01 Thread Alan Gauld via Tutor
I don't have python2 on my win10 PC and it works as expected on python 3. I suspect study of Eryk's post is your best bet. When it comes to the innards of Windows he is our local guru. On 1 Mar 2019 2:24 pm, Chip Wachob wrote: Alan, Thanks.** Once again, a case of not findin

Re: [Tutor] Remove soft line break

2019-03-01 Thread Peter Otten
Valerio Pachera wrote: [Me:] >> def merge_lines(lines): >> lines = (line.rstrip("\n") for line in lines) >> accu = [next(lines)] >> for line in lines: >> if line.startswith(" "): >> accu.append(line[1:]) >> else: >> yield "".join(accu) + "\n" >>

Re: [Tutor] schedulers

2019-03-01 Thread nathan tech
Hopefully I am doing this right, wanted to reply to the tutor list, not a specific person... Anyway. Thanks Steven and Alan for your help. I'll look into the windows scheduler and go from there. The code given in the original email was just an example, but none the less I appreciate you guys