Re: [Tutor] Logging exceptions, but getting stderr output instead

2016-05-25 Thread Alex Hall
You're not missing anything; I wasn't clear. I wasn't sure if raise or sys.exit(1) were the preferred ways, or if there was some other way I didn't know about. I've never had to force a script to halt before, at least not one I mean to schedule to run on its own once a day, so wanted to check that

Re: [Tutor] Logging exceptions, but getting stderr output instead

2016-05-25 Thread Alex Hall
Well, I found the major problem: I had logging.exception() not logger.exception() All I can say is, with the screen reader I'm using, they sound similar. Things are now working as expected. I'm still wondering about stopping execution, though: call exit(), raise, or some other way? On Wed, May 25

Re: [Tutor] Logging exceptions, but getting stderr output instead

2016-05-25 Thread Peter Otten
Alex Hall wrote: > Hello again list, > I didn't expect to be back so soon. :) I'm trying to log my new script, > and logger.info() works fine. However, logger.exception() doesn't; I see > the exception print to stderr, and it never appears in the log. Oddly, > info messages after that appear in th

Re: [Tutor] Logging exceptions, but getting stderr output instead

2016-05-25 Thread Alan Gauld via Tutor
On 25/05/16 19:11, Alex Hall wrote: > As a quick aside, is there an easy way to halt script execution for some > exceptions? Right now, catching them means that execution continues, but I > sometimes want to log the problem and then abort the script, as the error > means it shouldn't continue. Tha

[Tutor] Logging exceptions, but getting stderr output instead

2016-05-25 Thread Alex Hall
Hello again list, I didn't expect to be back so soon. :) I'm trying to log my new script, and logger.info() works fine. However, logger.exception() doesn't; I see the exception print to stderr, and it never appears in the log. Oddly, info messages after that appear in the shell and in my log, where

Re: [Tutor] Fwd: Re: I've subscribed to your service, no confirmation yet. I'm looking for a tutor and I need help with some code.

2016-05-25 Thread Alan Gauld via Tutor
On 25/05/16 17:19, Alan Gauld via Tutor wrote: > Here is an actual session using a public telnet site: > import telnetlib tn = telnetlib.Telnet('telehack.com') response = tn.read_some() b'\r\nConnected to TELEH' Oops! a cut n paste error. That line should be: >>> print(respo

Re: [Tutor] Baffling problem with a list of objects sharing a property

2016-05-25 Thread Alan Gauld via Tutor
On 25/05/16 17:05, Alex Hall wrote: > Python for a while so eventually unsubscribed. Welcome back Alex :-) > Now I'm using Python for work, and have run into a problem that has me > baffled. It's as though a bunch of class instances in a list are sharing a > single property. They are. You've s

Re: [Tutor] Baffling problem with a list of objects sharing a property

2016-05-25 Thread Peter Otten
Alex Hall wrote: > class Test(object): > def __init__(self, name, paths=[]): https://docs.python.org/2/faq/programming.html#why-are-default-values-shared-between-objects ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription o

Re: [Tutor] Fwd: Re: I've subscribed to your service, no confirmation yet. I'm looking for a tutor and I need help with some code.

2016-05-25 Thread Alan Gauld via Tutor
On 25/05/16 14:11, Angelia Spencer wrote: > in your code below you're telnet-ing to a website, No, I'm telnetting to a server with the IP address mysite.com (which is obviously fictitious, but could be any valid IP address). There is nothing that says it's a web site. (And even some web sites migh

[Tutor] Baffling problem with a list of objects sharing a property

2016-05-25 Thread Alex Hall
Hello all, I've used Python off and on for years, and consider myself pretty good with it. I was on this list quite a while ago and learned a lot, but hadn't used Python for a while so eventually unsubscribed. Now I'm using Python for work, and have run into a problem that has me baffled. It's as

Re: [Tutor] Fwd: Re: I've subscribed to your service, no confirmation yet. I'm looking for a tutor and I need help with some code.

2016-05-25 Thread Alan Gauld via Tutor
> I do get the >>> in the python IDLE but within my python script/file can > I telnet to my controller? Keep in mind when I do log into my controller > it's command line driven. One thing that occurred to me is that you may be better off using the subprocess module to start an interactive telnet