Bugs and Issues - LSS

Patroneo: urlparse().hostname does not return the exact hostname

append delete optical_disc

I'm in a rare situation where case sensitivity in the hostname actually matters. I know it's weird, but bear with me.

I really like Patroneo, but for some reason I could never get it to work in an NSM session without crashing immediately. While investigating this, I found the following code.

%
#osc.udp://hostname:portnumber/
o = urlparse(nsmOSCUrl)
return o.hostname, o.port
%

For whatever reason, urlparse was fetching all of the correct information, but `o.hostname` was always set to all lowercase no matter what.
I checked the docs of urlparse, and sure enough, *urlparse().hostname always uncapitalizes hostnames by design.*

(see here) https://docs.python.org/3/library/urllib.parse.html

This is what ended up being the cause of my crashes. The program would check for the running NSM server, but it would find nothing because the hostname wasn't capitalized correctly.

The code below is a modified version of the block above. It's functionally the same, except it preserves uppercase letters in the hostname. This simple change fixes the crash I was experiencing before.

%
#osc.udp://hostname:portnumber/
o = urlparse(nsmOSCUrl)
return o.netloc.split(":")[0], o.port
%

Reply RSS

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.