Forum Coordinators: RedPhantom
Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 26 1:43 pm)
a python error normally gives the line number of the errors. I dont see anything very obvious in the script, I dont like the suffix = " bit I prefer suffix = "" for a null string.
I would check that there are no stray characters at the end of the script and put in a few print statements to check the suffix value. any string containing a will treat it as an escape character so if you have a X in any of your names that may be an issue.
suffix = Filename[13:] should get you the string, I dont think you need the len() part.
The error occurs when x is in a string, without the correct characters following it, apparently. The x indicates a hex character. The documentation gives the example, xhh = hex character hh.
If the script isn't handling any strings containing x, it does seem likely that there's some problem with the formatting of the document. I would try copying the text from the above post and putting it into a fresh text file, then saving it as .py. Or something similar, to start with a clean file.
What Python editor are you using? Perhaps it's formatting your text in some unexpected way?
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.
I was using " in the script instead of '. I changed them thinking it was the problem.
Somehow, I'm getting funky characters in the script, or whatever. I wrote up this test.py script in TextPad.
import poser print "Hello World"
Then I ran it. What I got was this:
ValueError: invalid x escape Hello World
So, something odd is going on. I wish I could figure out what. test.py is a very simple script, that should not give a error.
Do you have another text editor you can try? And are you saving as plain text and not rich text, or something?
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.
Tried wordpad, and notepad using plain text. Same error. Scratches head. It's got to be something in the test.py script file. I've ran a couple of python scripts from the Poser 2010 directory. Some scripts work perfect, no ValueError invalid x escape message. Then some don't, and I get the damn message. This is driving me bonkers.
Have you re-started Poser since you first encountered the error message? Poser may have thrown a rod, in which case re-starting it might help.
Have any of the scripts you tested worked in the past without an error?
===========================sigline======================================================
Cage can be an opinionated jerk who posts without thinking. He apologizes for this. He's honestly not trying to be a turkeyhead.
Cage had some freebies, compatible with Poser 11 and below. His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.
Runnig other scripts? Can't remember. I don't use Python that much except for Bagginsbills's vss scripts. I just reloaded Poser, and ran vss.... no problem. Then my test.py script, with various encodings..... no luck. I'm going to find, and download a dedicated python editor, and see what happens. First, I'm going to take a python script from poser that works, and erase a line of code, and then retype it in, and the run it. Just to see what happens. I'll save a backup first of course.
Damn.... this is so strange. I went, and loaded vssmainbuttons.py into textpad. I then erased one line, and then retyped it in. Saved in ansi format. Then ran it..... no error.
I then erased all the code but, import poser. I then typed in print "hello world". Saved file in ansi format. Then ran it. It worked no error message.
I then went, and then created test.py again from scratch with import poser, etc in it. Saved in ansi format. Ran it, and got my error again.
I'm thinking I'm getting this ValueError: invalid x escape error, due to a end of file character mix up, or a character that indicates a start of file.... something like that.
Ok, I figured out why this was not working. When writing a python program in notepad, or any other text editor, you have to save the program as *.txt. Then rename the program as *.py. Saving the file as *.py to begin with causes odd characters to be placed in the file, which causes the poser python interpreter to do strange things.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
I'm runing a python script I made, and I keep getting this damn error:
ValueError invalid X escape
I have a cable crossover weight machine figure with a weight stack on it. The script (one of 13), allows one to parent a weight on the stack, to the weight bar (part that goes up, and down), or to the machine frame.
The Python script works fine. However a window pops up, and gives me the error. The script takes in account of having more that one machine in a scene (suffix). FigureName = scene.CurrentFigure().Name() should allways be "cable machine" plus a suffix if any. Like cable machine_1, etc. If just one cable machine is in the scene then it's just "cable machine" Before running the script, one must make a cable machine figure the current figure, or the script will bomb.
How do I get of the error?
This is the script:
20 lbs weight select
set variables
import string
import poser
scene = poser.Scene()
Suffix = ''
FigureName = scene.CurrentFigure().Name()
Suffix = FigureName[13:len(FigureName)]
Parent_1 = 'cable frame' + Suffix
Parent_2 = 'cable sel bar' + Suffix
ActorParent_1 = scene.Actor(Parent_1)
ActorParent_2 = scene.Actor(Parent_2)
Actor_20_lbs = scene.Actor('cable20 lbs' + Suffix)
Actor_40_lbs = scene.Actor('cable40 lbs' + Suffix)
Actor_60_lbs = scene.Actor('cable60 lbs' + Suffix)
Actor_80_lbs = scene.Actor('cable80 lbs' + Suffix)
Actor_100_lbs = scene.Actor('cable100 lbs' + Suffix)
Actor_120_lbs = scene.Actor('cable120 lbs' + Suffix)
Actor_140_lbs = scene.Actor('cable140 lbs' + Suffix)
Actor_160_lbs = scene.Actor('cable160 lbs' + Suffix)
Actor_180_lbs = scene.Actor('cable180 lbs' + Suffix)
Actor_200_lbs = scene.Actor('cable200 lbs' + Suffix)
Actor_220_lbs = scene.Actor('cable220 lbs' + Suffix)
Actor_240_lbs = scene.Actor('cable240 lbs' + Suffix)
Actor_260_lbs = scene.Actor('cable260 lbs' + Suffix)
Actor_280_lbs = scene.Actor('cable280 lbs' + Suffix)
parent weight to cable sel bar
Actor_20_lbs.SetParent(ActorParent_2,0,0)
parent weight to cable frame
Actor_40_lbs.SetParent(ActorParent_1,0,0)
Actor_60_lbs.SetParent(ActorParent_1,0,0)
Actor_80_lbs.SetParent(ActorParent_1,0,0)
Actor_100_lbs.SetParent(ActorParent_1,0,0)
Actor_120_lbs.SetParent(ActorParent_1,0,0)
Actor_140_lbs.SetParent(ActorParent_1,0,0)
Actor_160_lbs.SetParent(ActorParent_1,0,0)
Actor_180_lbs.SetParent(ActorParent_1,0,0)
Actor_200_lbs.SetParent(ActorParent_1,0,0)
Actor_220_lbs.SetParent(ActorParent_1,0,0)
Actor_240_lbs.SetParent(ActorParent_1,0,0)
Actor_260_lbs.SetParent(ActorParent_1,0,0)
Actor_280_lbs.SetParent(ActorParent_1,0,0)