Page 2 of 12

Re: Converting Python Scripts to meet PEP-8

PostPosted: Tue Jul 16, 2013 3:43 pm
by Tsar Hoikas
It's none of the above. The problem is that Cyan's tech artists added some SDL strings with trailing whitespace ("nb01ReaderBoardVis ") :roll: I fixed this bug a few days ago by adding code to squelch any whitespace in SDL strings.

Re: Converting Python Scripts to meet PEP-8

PostPosted: Tue Jul 16, 2013 5:05 pm
by johnsojc
Deleted the <TAB> that was on the end of the line and stripped any trailing white space out of the SDL file. Still getting the error on the same SDL variable.

Re: Converting Python Scripts to meet PEP-8

PostPosted: Tue Jul 16, 2013 5:08 pm
by Tsar Hoikas
Sorry, I wasn't very clear above. I mean that the trailing whitespace is in the max file, and therefore the PRP file. This is another case of Cyan artist fail (the SDL files are fine). Here's my fix.

Re: Converting Python Scripts to meet PEP-8

PostPosted: Tue Jul 16, 2013 5:49 pm
by johnsojc
Great! It worked!

I implemented your patches in the files I'm reformatting to PEP-8.

EDIT: Oops! spoke too soon. Going to my Neighborhood and the city works. Going to the watcher's pub still gives this error:
Code: Select all
(07/16 21:20:34) cPythDayNight2 - Traceback (most recent call last):
(07/16 21:20:34)   File ".\python\xAgeSDLBoolRespond.py", line 95, in OnServerInitComplete
(07/16 21:20:34)     self._Setup()
(07/16 21:20:34)   File ".\python\xAgeSDLBoolRespond.py", line 129, in _Setup
(07/16 21:20:34)     self._Execute(ageSDL[sdlName.value][0], initFastFwd.value)
(07/16 21:20:34) KeyError: 'SDL key boolTreeDayLights not found'

It appears that all the pubs are affected, Greeters, Writers, etc..
Code: Select all
(07/16 21:28:39) cPythBallHallDoorVis_0 - Traceback (most recent call last):
(07/16 21:28:39)   File ".\python\xAgeSDLBoolShowHide.py", line 81, in OnServerInitComplete
(07/16 21:28:39)     self._Setup()
(07/16 21:28:39)   File ".\python\xAgeSDLBoolShowHide.py", line 114, in _Setup
(07/16 21:28:39)     self.sdl_value = ageSDL[sdlName.value][0]
(07/16 21:28:39) IndexError: tuple index out of range
(07/16 21:28:39) islmGZBeamBrain.OnServerInitComplete:  ERROR!  Can't find the boolGZBeamVis sdl, doing nothing.

Re: Converting Python Scripts to meet PEP-8

PostPosted: Wed Jul 17, 2013 2:48 pm
by johnsojc
No matter what I do, the code ageSDL[sdlName.value][0] triggers a traceback in both xAgeSDLBoolRespond.py and xAgeSDLBoolShowHide.py. I know this code is in the original scripts.. go figger.

On the extraneous spaces in SDL names... I know you said the problem was in the PRP file exported from Max but then I cleaned up the SDL files on my server, wiped the vault and rebuilt it. The original problem that you provided the patch for not longer occurs. Either it's magic or dirtsand sucked in the bad names from the SDL files when the server was initialized. This could only be true if the server actually sucks in the SDL files when started the first time. Am I crazy or does this really happen?

Re: Converting Python Scripts to meet PEP-8

PostPosted: Wed Jul 17, 2013 3:15 pm
by tachzusamm
I have no clue about which version of the scripts you are talking, but in a version I have there's no such line containing a string like "ageSDL[sdlName.value][0]" in it; instead, it reads "ageSDL[stringVarName.value][0]".

But could be we have completely different versions of course.
So if that's the case - which would mean the max wiring parameters have already been renamed in the top of the files - just ignore my comment. ;)

EDIT: Yes, forget it. My version was quite old. :/

Re: Converting Python Scripts to meet PEP-8

PostPosted: Wed Jul 17, 2013 3:29 pm
by johnsojc
It lloks like you have version 1. I am working with version 2.

These are equivalent. sdlName in V2 is the same value as stringVarName in V1 which looks something like this... <PlasmaTypes.ptAttribString instance at 0x18AE95A8>. These are equal to the first value in the max file... ptAttribString(1, "Age SDL Var Name")

Re: Converting Python Scripts to meet PEP-8

PostPosted: Wed Jul 17, 2013 3:32 pm
by tachzusamm
In my opinion, that renaming of parameters is a bit problematic though. In the OnSDLNotify method, there's a parameter called SDLname, which could easily be confused with the max wiring parameter sdlName. Sure, Python does take care of lower/uppercase, but for humans maintaining the code it's confusing.
So, are you sure you used the correct variable everywhere?

Re: Converting Python Scripts to meet PEP-8

PostPosted: Wed Jul 17, 2013 3:35 pm
by johnsojc
LOL, It's not my code... I'm just trying to figure out why it's failing in my test bed. There could be a conflict somewhere else affecting this but I have no idea where to look.

Re: Converting Python Scripts to meet PEP-8

PostPosted: Wed Jul 17, 2013 3:40 pm
by tachzusamm
johnsojc wrote:LOL, It's not my code...

I know ;)

Does it still complain about index out of range, or only about missing SDL variables?
If the latter is true, you could check if it's correct, and the SDLs are really not there (if you did not already).