python scripts

Blender's implementation of Python, the scripting language used by Blender.

python scripts

Postby djallalnamri » Fri Mar 05, 2010 5:20 pm

and btw...what's the situation with blender scripts?
djallalnamri
 
Posts: 12
Joined: Fri Mar 05, 2010 4:13 pm

Re: python scripts

Postby irakrakow » Fri Mar 05, 2010 8:13 pm

I'm not sure what you're asking. Python scripts written in Blender 2.4x will run in Blender 2.4x. They just won't run in Blender 2.5. However, Python 3 scripts written for Blender 2.5 will run in Blender 2.5. The Blender 2.5 Python development environment is really slick, a good way to learn Python 3.
User avatar
irakrakow
Site Admin
 
Posts: 438
Joined: Fri Jan 22, 2010 9:01 pm

Re: python scripts

Postby djallalnamri » Fri Mar 05, 2010 9:26 pm

well this is what i wanted to know
sorry for not having made myself understood
now i know that i should not be looking for some well hidden scripts'folder in 2.5!
thanks for the reply!
djallalnamri
 
Posts: 12
Joined: Fri Mar 05, 2010 4:13 pm

Re: python scripts

Postby irakrakow » Sat Mar 06, 2010 6:46 am

The scripts I found are the ones in the scripts folder. By the way, there are tons of scripts in the Python folder, and they're great for learning Python 3 (I'm planning a series of tutorials on learning Python 3, by the way), but as for Blender 2.5 scripts, they have to be rewritten.

By the way, if you go to the Scripting view in Alpha 2, or the Python console, the developers added a big warning, in red, that the Python API is subject to change. The changes could be at a very basic level, such as how RNA properties are defined. That means that right now, if you have a 2.4x script, you should hold off on converting. It's simply too early.
User avatar
irakrakow
Site Admin
 
Posts: 438
Joined: Fri Jan 22, 2010 9:01 pm

Re: python scripts

Postby djallalnamri » Sat Mar 06, 2010 9:05 am

i guess i should go back to 2.49 everytime the use of a script is required or needed
so scripts have to be rewritten
it doesn't only take a "translation" like translating a language into another
thanks for detailed reply!
djallalnamri
 
Posts: 12
Joined: Fri Mar 05, 2010 4:13 pm

Re: python scripts

Postby irakrakow » Sat Mar 06, 2010 9:06 am

Yes, that's the best approach.
User avatar
irakrakow
Site Admin
 
Posts: 438
Joined: Fri Jan 22, 2010 9:01 pm

Re: python scripts

Postby djallalnamri » Sat Mar 06, 2010 9:53 pm

while surfing the web i bumped into this:
http://docs.python.org/library/2to3.html
automated python 2to3 translation
djallalnamri
 
Posts: 12
Joined: Fri Mar 05, 2010 4:13 pm

Re: python scripts

Postby irakrakow » Sat Mar 06, 2010 10:04 pm

That will do part of the job, the part where the Python syntax changed. There's still the work of changing the code to match the new Blender 2.5 API. For example, the Blender module, which is imported in just about all Blender 2.4x scripts, is not supported. You need to find the equivalent functionality in Blender 2.5.
User avatar
irakrakow
Site Admin
 
Posts: 438
Joined: Fri Jan 22, 2010 9:01 pm

Re: python scripts

Postby Savage » Mon Mar 08, 2010 12:18 pm

I have a few Python 2x scripts that I desperately need converted to Python 3x and I have tried converting with the 2to3 method but no dice. Any suggestions? I would go line by line but I still have much to learn about Python and frankly, it would take forever. I figured that out changing print statements to functions in an unrelated program I was working on. Thanks in advance and happy Blendering!
Savage
 
Posts: 9
Joined: Wed Jan 27, 2010 9:24 am

Re: python scripts

Postby irakrakow » Mon Mar 08, 2010 4:25 pm

Could you post one or two? I'd like for us to come up with some guidelines for 2.4x script conversion. There's no purely automated way to convert, that I can see, because the conversion involves both changing the Python 2 syntax to Python 3, and changing the Blender 2.4x API to the 2.5 API. The user interface has totally changed, the Blender module is totally unsupported in 2.5, and even something really fundamental like property assignments is totally different.

Furthermore, there's a big pink message on the Alpha 2 Python console warning us that the API is subject to change. We're trying to hit a moving target, in my opinion.

However, some guidelines as to how to do the conversion manually would help anyone who wants to convert. At least there would be some sort of roadmap. But to paraphrase Euclid, "There is no royal road to 2.4x to 2.5 Python script conversion.".

Ira
User avatar
irakrakow
Site Admin
 
Posts: 438
Joined: Fri Jan 22, 2010 9:01 pm

Next

Return to BlenderPython

Who is online

Users browsing this forum: No registered users and 1 guest