doc Posted June 12, 2006 Share Posted June 12, 2006 I'm trying to embed my python scripts inside my otl and I'm having a bit of trouble. I made a section in the "edit contents" editor called fat.py here's the code for that section: #!/usr/local/bin/python print("yes this works!\n") my otl has a button with the following callback: unix opdef:/Object/foo?fat.py The problem is whenever I hit my button I get the following error in my shell: opdef:/Object/foo?fat.py: No match. anybody know how to get around this? thanks Luca Quote Link to comment Share on other sites More sharing options...
TheUsualAlex Posted June 12, 2006 Share Posted June 12, 2006 I don't think the 'unix' command can execute scripts embedded within oplib, can it...? IF my memory is correct, I remember running into this issue more than a year ago and George told me you'd have to have the script sits outside the oplib... I could wrong tho... I'd be interested in knowing about it. George? Jason? -Alex Quote Link to comment Share on other sites More sharing options...
RickWork Posted June 12, 2006 Share Posted June 12, 2006 If memory serves me right I recall something about having to dump the python script to the /tmp directory first and then call the python script from there. I was fighting with this a while back as well and found the answer on the odwiki. I think JC posted this: Python Script in HDA Cheers, /Rick Quote Link to comment Share on other sites More sharing options...
doc Posted June 12, 2006 Author Share Posted June 12, 2006 thanks for the input guys. I've just confirmed with sesi, I'd have to write the python out to a temp file. yuck. Luca Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted June 13, 2006 Share Posted June 13, 2006 thanks for the input guys. I've just confirmed with sesi, I'd have to write the pythonout to a temp file. yuck. Luca 28547[/snapback] Does Python allow to use a single line programs like Perl? If so you can write a Python code inside expression function in this manner string SomeFunc(string SomeParam) { ... code += "foreach my $text (@text) { "; code += "chomp($text); "; code += "$text =~ s/\\t/$spacestr/g; "; ... return system("perl -e \"" + code + "\""); } That function then can be embed into OTL. Terrible but there is no need to use external temporary files Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.