Forum

Author Topic: Python Syntax Error- (Newbie mistake?)  (Read 2184 times)

depprussell

  • Newbie
  • *
  • Posts: 5
    • View Profile
Python Syntax Error- (Newbie mistake?)
« on: June 14, 2018, 11:03:27 AM »
Hello,

When I originally installed Blender a few years ago, I installed python at the same time and never had any issues. Last august however, my computer burnt and I had to get a new one. I installed blender, but never bothered with python.
Today i decided to try out some of the scripts, so i downloaded and installed python (latest version, 2.6.something)
Blender did not recognize it, so I uninstalled and reinstalled Blender
It worked, and gave me the "Got it!" message in the console
My problem though, is that every single script I try to run from the scripts window gives me an error that reads
File "<string>" line 1
execfile(r'C:\ Documents and Settings\Shawn's World\Application Data\Blender FOundation\Blender\.blender\scripts\wizard_bolt_factory.py')
SyntaxError: invalid syntax
(If it helps any, when I uninstalled Blender I opted to keep my old scripts folder when it prompted me)
This is probably just a dumb mistake on my part, but can some kind soul please help me out? It gives me the same error for every script I try (replacing the name of the script in the filename of course)

Please help

I didn't find the right solution from the internet.

References:
https://www.blender.org/forum/viewtopic.php?t=15238

Thank you

« Last Edit: June 14, 2018, 01:13:56 PM by Alexey Pasumansky »

depprussell

  • Newbie
  • *
  • Posts: 5
    • View Profile
Python (caching?) issues....
« Reply #1 on: June 14, 2018, 11:04:47 AM »
Hello,

currently using blender to develop a small game. I'm using blender 2.54 with python 3.1.1 on Ubuntu.
I experience the following weird issue:
It appears like some changed lines of python scripts are not used properly when I change them.
Example:
1) I renamed an object from Sphere.002 to Haptik
2) I changed the python code that operates on it to use objects["Haptik"] instead of objects["Sphere.002"]
...it worked - but only for a while
3) I added a new object to the scene and wrote some more lines of code
4) I tried to launch it again and get the following error:
Python module can't be imported - controller "And4#CONTR#6":
Traceback (most recent call last):
File "/home/*username*/stab/blender/latest.blend/wall1force.py", line 16, in <module>
hapticPosition=hapticScene.objects["Haptik"].position
KeyError: "CList[key]: ''Sphere.002'' key not in list"
Python module can't be imported - controller "Python Script1#CONTR#2":
The python-error does not match the line that causes the error. Before my change this line contained the word Sphere.002 - which leads me to the assumption that it might be some kind of caching issue.
I even tried deleting the .pyc but it did not help.
Any ideas for a workaround for this bug?

Please help

I didn't find the right solution from the internet.

References:
https://www.blender.org/forum/viewtopic.php?t=18379

Thank you

« Last Edit: June 14, 2018, 01:14:04 PM by Alexey Pasumansky »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Python Syntax Error- (Newbie mistake?)
« Reply #2 on: June 14, 2018, 01:15:25 PM »
Unfortunately, these messages are considered as spam :(
Best regards,
Alexey Pasumansky,
Agisoft LLC