exception

Close multi threaded application with KeyboardInterrupt

丶灬走出姿态 提交于 2020-01-15 07:07:16
问题 I have an app with two threads. One is a pygame thread which runs a simple game, the other thread is a listening server which accepts messages which are used to control the game. Here is the stripped down pseudo code: class ServerThread(threading.Thread): def run(self): class SingleTCPHandler(SocketServer.BaseRequestHandler): try: while(1): ... #Receive messages from socket. Add them to pygame event queue ... except KeyboardInterrupt: sys.exit(0) ... ... class PygameThread(threading.Thread):

Close multi threaded application with KeyboardInterrupt

送分小仙女□ 提交于 2020-01-15 07:05:08
问题 I have an app with two threads. One is a pygame thread which runs a simple game, the other thread is a listening server which accepts messages which are used to control the game. Here is the stripped down pseudo code: class ServerThread(threading.Thread): def run(self): class SingleTCPHandler(SocketServer.BaseRequestHandler): try: while(1): ... #Receive messages from socket. Add them to pygame event queue ... except KeyboardInterrupt: sys.exit(0) ... ... class PygameThread(threading.Thread):

Exceptions ignored in form_load for x64

删除回忆录丶 提交于 2020-01-15 06:56:06
问题 When I throw an exception from form_load in my C# application it doesn't work when the platform is x64. (it acts as expected for x86) When I step through the code, I get to the line where the exception it thrown, then it immediately jumps to timer_Tick. When I create a new project and add this line to form_load: throw new System.Exception("oops!"); For x86 it crashes as expected. For x64 it doesn't crash. Is there some way to get an application to actually throw from form_load on 64-bit? 回答1:

how to serialise exception object as xml string

你。 提交于 2020-01-15 06:09:08
问题 I want something like try { //code here } catch (Exception ex) { stringXML = Exception.toXML(); } so that the value of stringXML would be <exception><message></message><innerException></innerException></exception> For example... How is this possible? 回答1: It depends how much code you want to write. One simple approach would be to write your own object and use XmlSerializer : [XmlRoot("exception"), XmLType("exception")] public class SerializableException { [XmlElement("message")] public string

Can't Catch NetworkOnMainThreadException

帅比萌擦擦* 提交于 2020-01-15 06:07:10
问题 I know what causes a NetworkOnMainThreadException, as well as how to fix it, but for the purposes of improving the development experience, I'd like to be able to catch the exception and at least log the event or alert the user (who is still the developer at this point)... Strangely, I'm not having any luck with this code (which sends and receives over my TCP socket): try { toServer.println (msg.trim()); resp = fromServer.readLine(); } catch (android.os.NetworkOnMainThreadException nex) { ...

Disable all html exception rendering in rails

与世无争的帅哥 提交于 2020-01-15 05:59:17
问题 I develop a rest webservice that answers in json. But when some (not all) exceptions are thrown, I am unable to catch them, and rails render an htlm, which is not a valid response for all my clients. The problem comes if an exception is raised in a method called by this catch all: rescue_from Exception, with: :render_unkown_error I have to admit, raising an exception in a last chance catch all is very very critical, but I wonder: Is there a way to totally dismiss all rails response in case of

Disable all html exception rendering in rails

南笙酒味 提交于 2020-01-15 05:58:23
问题 I develop a rest webservice that answers in json. But when some (not all) exceptions are thrown, I am unable to catch them, and rails render an htlm, which is not a valid response for all my clients. The problem comes if an exception is raised in a method called by this catch all: rescue_from Exception, with: :render_unkown_error I have to admit, raising an exception in a last chance catch all is very very critical, but I wonder: Is there a way to totally dismiss all rails response in case of

exception when installing setuptools on python 2.7.6

坚强是说给别人听的谎言 提交于 2020-01-15 05:37:09
问题 I'm installing setuptools for Python 2.7.6 on Windows 7 64-bit machine and get the following error C:\Python27\install_scripts>python ez_setup.py Extracting in c:\users\p\appdata\local\temp\tmpqhpyyh Now working in c:\users\p\appdata\local\temp\tmpqhpyyh\setuptools-2.1 Installing Setuptools Traceback (most recent call last): File "setup.py", line 17, in <module> exec(init_file.read(), command_ns) File "<string>", line 8, in <module> File "c:\users\p\appdata\local\temp\tmpqhpyyh\setuptools-2.1

rmi class can not found exception

做~自己de王妃 提交于 2020-01-15 04:16:45
问题 I wrote an simple project using java rmi and exported to an executable jar file. When I tries to run it, sometimes i got exceptions and sometimes it works. When I specify -Djava.rmi.server.codebase=file:serverClasses/, it seems it didn't create the jar file correctly. Here is the stacktrace: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException:

rmi class can not found exception

非 Y 不嫁゛ 提交于 2020-01-15 04:15:08
问题 I wrote an simple project using java rmi and exported to an executable jar file. When I tries to run it, sometimes i got exceptions and sometimes it works. When I specify -Djava.rmi.server.codebase=file:serverClasses/, it seems it didn't create the jar file correctly. Here is the stacktrace: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: