Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] Third Party Tools
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-14-2006, 11:12 AM
craiga craiga is online now
Registered User
 
Join Date: 08-14-2006
Posts: 2
Problem running Python script

I am trying to run a Python script and I am getting a couple different errors.

First I just try a simple 2-line script:

import marshal, os, re, sys, time
print "test"

I get this error:

8/14/2006 10:45:37 AM: --------------------Starting Build: test.bld'--------------------
8/14/2006 10:45:37 AM: Building project step 'Run Python script'...
Failed to instantiate script engine 'Python': Invalid class string
8/14/2006 10:45:37 AM: Step 'Run Python script' failed
8/14/2006 10:45:37 AM: Build ended.


When I run a more substantial script (pasted in below) I get this error, which I assume has to do with the brackets. I tried doubling up the brackets for accessing the Python dictionary object but then I get the "invalid class string" error.

8/14/2006 10:40:03 AM: --------------------Starting Build: 'Test.bld'--------------------
8/14/2006 10:40:03 AM: Building project step 'Check for opened P4 files under '...
Error expanding macros or script in property Script: <Error parsing macros: Unrecoverable Parse Error at position 373 - expecting macro_name>
8/14/2006 10:40:03 AM: Build ended.

By the way giving the character position of the parse error is not very helpful, since the script editor does not display the character position, only the row and column of the cursor.


Below is the script that gets the Unrecoverable Parse error. If I double up the brackets, then I get the first error ("Failed to instantiate script engine 'Python': Invalid class string"). Both these scripts run fine when run directly from Python.

import marshal, os, re, sys, time

p4changes = 'p4 -G opened'
stream = os.popen(p4changes, 'rb')
nReturn = 0;

try:
while 1:
dict = marshal.load(stream)
if(dict["depotFile"].find("//somedepot/somefile/")):
print dict["depotFile"]
nReturn = 1;
except EOFError: pass

sys.exit(nReturn)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 11:28 PM.


Copyright © 1999-2023 Kinook Software, Inc.