Hi All,

There seems to be a problem using Python for "External Source
Control", CC.NET Version - 1.4.1.3795 :-(

What I have done to try this out:

PYTHON SCRIPT (The essentials) - sourceControl.py:

    # The modules entry point when executed as a command line script.

    def main( args ):
        print args

        cmdLine = ""

        for a in args:
                cmdLine = cmdLine + a + " "

        debugFile = open ( 'C:\\automation\\SC-Debug.txt', 'a' )
        debugFile.write( '\n--> ' + cmdLine )
        debugFile.close()

        return 0

    # Ensure we only run command line functionality when we are the
__main__ module .

    if __name__ == "__main__":
        sys.exit( main( sys.argv[0:] ) )

As you can see, it doesn't do much... it simply prints the
applications call arguments to STDIO and at the same time appends
(creates if necessary) the arguments to a file in case I miss STDIO.
But the script will never get called!

The ccnet.config has this section:

                <!-- External Source Control, Calls Python Script to retrieve 
the
#NEXT Changelist not #HEAD -->
                <sourcecontrol type="external">
                        <executable>python</executable>
                        <args>C:\automation\sourceControl.py</args>
                        <autoGetSource>true</autoGetSource>
                        <labelOnSuccess>false</labelOnSuccess>
                        <timeout units="minutes">5</timeout>
                </sourcecontrol>

Here's the catch! Looking at the server log, see if you can spot the
problem:

      [projectSample:DEBUG] Preparing to run source control command:
python GETMODS "2009-01-27 09:04:56" "2009-01-26 14:12:52" C:
\automation\sourceControl.py

      [projectSample:DEBUG] python: can't open file 'GETMODS': [Errno
2] No such file or directory

      [projectSample:ERROR] Exception: Source control operation
failed: python: can't open file 'GETMODS': [Errno 2] No such file or
directory


PYTHON requires the format: PYTHON <PYTHON_SCRIPT.PY> [ARGS]

Changing the ccnet.config like so, does not fix the problem:

                        <executable>c:\python26\python 
C:\automation\sourceControl.py</
executable>
                        <args></args>

Also does not work the server log reports:


      [projectSample:DEBUG] Preparing to run source control command: c:
\python26\python C:\automation\sourceControl.py GETMODS "2009-01-27
09:25:00" "2009-01-26 14:12:52"

      [projectSample:ERROR] INTERNAL ERROR: Unable to execute file [c:
\python26\python C:\automation\sourceControl.py].  The file may not
exist or may not be executable.

This starts out looking promising but then fails, "Unable to execute
file", (incidentally, this same problem happens with <EXEC/> tasks).



:-(

One for the issue tracker I think!

Has anyone got around this?

Regards,
Shaun

Reply via email to