Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turning off errors? (Python, no console, py2exe'd)
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Justin_




PostPosted: Wed Apr 05, 2006 2:20 pm   Post subject: Turning off errors? (Python, no console, py2exe'd)

I'm working on a Gmail API. Since it uses TSL encryption I needed a library to deal with that so I turned to Python. The problem I have is that my (no console) .exe after it has been py2exe'd gives a big warning and that annoying trumpet sound. It would normally pipe these errors to the console, but since its no console it creates a log and gives a big warning.

I imagine this question won't get answered, but here goes: how can I tell it to ignore errors?

EDIT: the errors come from the precompiled module's so I can't fix them and they don't compromise functionality.

EDIT:

Traceback (most recent call last):
File "eddfx.py", line 28, in ?
File "smtplib.pyc", line 712, in quit
File "smtplib.pyc", line 374, in docmd
File "smtplib.pyc", line 348, in getreply
File "smtplib.pyc", line 160, in readline
socket.sslerror: (8, 'EOF occurred in violation of protocol')

that is the error I get, I just need to make it ignore the error.
Sponsor
Sponsor
Sponsor
sponsor
Justin_




PostPosted: Wed Apr 05, 2006 5:18 pm   Post subject: (No subject)

Yay! I figured it out.

So all you do when you get gay errors is you put your code in a try block and then except it with no arguments to except, and it catches all exceptions.
wtd




PostPosted: Wed Apr 05, 2006 5:48 pm   Post subject: (No subject)

You really should work to get a better understanding of the fundamentals. You'd be in a much better position to find answers to questions like these if you did.

The solution to exceptions cropping up is to figure out what's raising the exception. Simply silently catching all exceptions is akin to fixing the engine in your car by covering the "Check Engine" light with electrical tape.
Justin_




PostPosted: Wed Apr 05, 2006 7:15 pm   Post subject: (No subject)

Good analogy, yes its precisely that. But, it works like a chain reaction. You see, there's a lot of software out there that doesn't follow TLS protocol when closing a connection, but since this falls through and ends it with TCP everything works fine, thus the reason why there is so much software that doesn't follow TLS protocol. Rather than go through the smtplib and try to figure out if it's a bug there or find out many months from now that it was Gmail, I would instead fix the problem with electrical tape. Wouldn't you?

And the reason I didn't know how to deal with the damn warning dialogue was because it's python and I've never seen python code until yesterday.
wtd




PostPosted: Wed Apr 05, 2006 7:18 pm   Post subject: (No subject)

Well, You might still use the electrical tape, but I'd suggest trying to figure out exactly what exception is being thrown that you can ignore. That way you don't accidentally overlook an exception that you should be recovering from in some meaningful way.
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: