skribb wrote:I thought EG used Python2
Maybe it does. Not sure.
skribb wrote:anyway I checked and the message sent from my tabelt is t1.reboot_in_2hours
Well, that's not the one that caused the issue.
skribb wrote:now, I tried sending it manually from my tablet and it was received in EG without error now, so I dunno what the hell that was.

I would expect not.
skribb wrote:But as with my other message that choked on 0xc3, the UDP messages that I send to EG do not contain that actual character...
The 0xc3 indicates that the special character was not decoded. We've fixed that now, which is why you get the correct 0xef character, which is ï. Are you never intentionally sending "'ï'" to that UDP port? Something is, just as something periodically sent some screwy characters to mine (causing identical exceptions). Do you run VoxCommando by any chance?
Cranky has no technical meaning.

As for the 111,000 results, they are mostly related to Python programmers having trouble with Unicode encoding and decoding. It's a common problem, but there's always a reasonable explanation. I'm going to swap out by Broadcaster plugin tomorrow and try sending some non-Ascii characters, but after testing TriggerEvent manually, I'm not expecting an exceptions on passing those characters for the event name or the payload. Please try out the tests I posted on your system.
skribb wrote:Is the crux of the matter that EG/asyncore tries to encode the received message and then decode it again?
No, your second exception (with the 0xef) confirms that Broadcaster is correctly decoding the character and passing it to TriggerEvent, which is choking on the non-Ascii character, just as it did the encoded version.
Consider this console output:
Code: Select all
>>> u"\xfe".encode("utf8")
'\xc3\xbe'
...It's what you were receiving before (0xc3 being the first non-Ascii character).
Now consider the reverse:
Code: Select all
>>> b"\xc3\xbe".decode("utf8")
u'\xfe'
...That's what TriggerEvent is getting now, which is correct. However, if you didn't send the "'ï'" on purpose, that's one mystery, particularly if you only ever send ASCII characters. I suppose it's possible Asynccore has some crazy bug that periodically turns plain old Ascii into bytes representing UTF-8 encoded Unicode, but I doubt it. The other mystery is why TriggerEvent is throwing that exception. That's beyond the scope of Broadcaster and we need to concentrate on implementing logging and exception handling in EventGhostEvent.py at this point.
edit: here is the entire Def thingy from my EventGhostEvent.py:
Code: Select all
def __init__(self, suffix="", payload=None, prefix="Main", source=eg):
self.string = prefix + "." + suffix
self.prefix = prefix
self.suffix = suffix
self.payload = payload
self.source = source
self.time = clock()
self.isEnded = False
self.shouldEnd = Event()
self.upFuncList = []
[/quote]
On mine, line 84 (which also throws exceptions once in a blue moon for no apparent reason) is:
...Which doesn't seem like it could be the culprit. Can anyone in a forum read a Python stack trace with confidence? If so, how in hell could that line throw such an exception? Could the line count be off somehow as I would think the concatenation would be the only possible cause (assuming the error happened here at all). Maybe I miscounted as I had it in an editor without line numbers. I'll check again tomorrow, but it's got to be this:
Code: Select all
self.string = prefix + "." + suffix
...So we need to add this above it:
...As I can't come up with anything for suffix (or prefix) that would cause that line to fail in any way. I've tried repeatedly calling TriggerEvent with all sorts of Unicode and byte combinations and nothing breaks it at all. Have also played around in the console with that expression and gotten nowhere. Only clue is that if you change it to:
Code: Select all
self.string = prefix + u"." + suffix
...It's easy to get the very exception we are looking for, but only if you had NOT applied my fix as prefix or suffix would have to be bytes rather than a Unicode string (for obvious reasons). That is what would happen if you edited the file but didn't restart the plugin, but then there's no "u" prefix in the above line. Just grasping for straws there.
Maybe this has something to do with Python's default system encoding or some such. Afraid I'm no expert in this area. Apparently nobody involved with this project is.
Regardless, that line is going to need a try-except until we can pinpoint just what can be sent to TriggerEvent to cause it to throw an exception (and fix it). Near as I can tell, there's nothing wrong with Broadcaster at this point, just that the fixes that decoded the characters didn't appear to fix the TriggerEvent error.
I'll know more once I try all this myself tomorrow. I'll make VC send various non-Ascii characters and see what happens. At least that thing is good for something.
