Passing and returning values from outside program

New releases and general discussions.

Post » Sat Aug 22, 2009 10:46 pm

The Python features aren't documented well, so its hard to determine exactly what you can do with them. However, what I would like to do is find a way to pass some text to an outside program (python or whatever) for processing and then have the result stored back into a global variable. The execfile function will run an external python script, but I don't believe execfile returns anything.

Any ideas on the best way to do this?
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Mon Aug 24, 2009 12:56 pm

You could have the out side program write into a text file and then read the text file to get the return. then just delete the text file.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Sat Aug 29, 2009 12:08 pm

great idea! I'll have to give it a shot.

I'd still love to see one of the developers show a simple example of how the python scripting additions are useful. I have programmed in Python before (lots of Pygame especially) so its not like I don't know what Python can do. The only value I see in scripting is doing things that you can't do in events. I'll mess around with it more as well and if I come up with anything interesting I'll let you know.
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Wed Sep 02, 2009 8:58 am

seconded.

We need a Python API section on the wiki.
Im not sure if there is one already, Sourceforge is being slow again. Grr.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Wed Sep 02, 2009 11:39 am

The python documentation is a complete reference to the python API, and has code examples.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Thu Sep 03, 2009 12:24 am

[quote="Rich":2qe8f351]The python documentation is a complete reference to the python API, and has code examples.[/quote:2qe8f351]

I agree, we don't need a Python API. I was thinking more of a Python Construct API. Maybe they are one and the same. If so are you saying then that I can use ANY Python code in Construct? Any Python API can be imported and used? If that is the case it is not clear from the scripting interface. Like I said before I have programmed many Python programs and have plenty of Python code examples. What I would like to know is if there is any limitation to what Python code can be used with Construct and if so generally what is it.

I would be more than happy to help show Python scripting examples with Construct, but it would be nice to have one reference on how it would be helpful is all I'm saying...
B
8
S
3
G
7
Posts: 835
Reputation: 5,313


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests