Hi, Couple of things:
- Slave “about” dialog empty. Go to “help\about” and the window usually displaying information is empty. All other apps are OK.
- The monitor\scripts\install submission scripts interface, click on any install button and python error appears…“main()” takes no arguments (1 given)…
Both my CPython & Python.net are configured to “c:\python26\libs”
In fact, I’m getting an error on quite a few of my scripts where the “os” module is missing…
Mike
(Oops. This thread needs to be moved to the bugs section)
Thanks for reporting these!
-
Weird! How the heck did that happen? I’m sure it’s an easy fix.
-
I’ve logged this as a bug too.
Note that IronPython is still used by default. You need to add “#Python.NET” as the first line of a script to use the Python.NET interpreter.
To confirm, is that for existing scripts of yours, or new ones you’re testing out?
Cheers,
- OK, after much fun and games, got the bottom of the issue (I think…)
I had to change the repository global setting for “CPython” search path to “c:\python26\Lib” instead of “c:\python26\Libs”, then the OS module is found which quite a few of my scripts depend on. To confirm, all the scripts that were failing were my own code which had all been working fine previously in v4.1 / v5.0. Perhaps you should add this python path by default to the vanilla install of v5.1?
On top of this issue, I had a general script which before the “def main( args ):" line in the script, I had set some global values such as this in the example below, where I set the path to an custom ".exe” before declaring the “def main”:
[code]import os
import clr
import sys
from System.Diagnostics import *
from System.IO import *
from System.Text.RegularExpressions import *
from System.Collections.Specialized import *
from Deadline.Scripting import *
########################################################################
Globals
########################################################################
scriptDialog = None
ProgressBar = None
exe = ( Path.Combine( GetRootDirectory(), “scripts/General/customTool/customTool.exe” ) )
########################################################################
Main Function Called By Deadline
########################################################################
def main( *args ):
global scriptDialog
global ProgressBar[/code]
So, I just needed to move the “exe = …bla bla…” line to be under the def main line.
However, I do kind of consider this a regression as this worked fine before v5.1
Finally, I tested loads of different scripts and they all seem ok now, but your “Install Submission Scripts” interface is still broken, when you press the “Install” button on say, the “3dsMax” line or on various other “Install” buttons.
It as like this new Python setup isn’t calling scripts in a “global namespace” or something else initially is going wrong/different from before?
Mike
Since Deadline is being bundled with Python (starting with Alpha 3), maybe we should just have IronPython add this search path automatically (it’s already done this way for Python.NET). We can probably do this for Alpha 4, since Alpha 3 is almost out the door.
Having “exe = …” above main should work, but then you would have to add “global exe” to any function that you refer to “exe” in. For example:
########################################################################
## Globals
########################################################################
scriptDialog = None
ProgressBar = None
exe = ( Path.Combine( GetRootDirectory(), "scripts/General/customTool/customTool.exe" ) )
########################################################################
## Main Function Called By Deadline
########################################################################
def __main__( *args ):
global scriptDialog
global ProgressBar
global exe
Does this not work for you? I’ve always understood that to be the standard way of working with globals in Python, and thus wouldn’t appear to be a regression. Maybe I’m missing something…
Yup, we have a bug logged for this, which is targeting 5.1. We did refactor how our internal script engine worked so that it could support both IronPython and Python.NET, and I think the “initialization” order may have changed.
Cheers,
Thanks Ryan.
Adding any paths which just makes both IronPython & Python.Net both work straight out of the box would be good.
To confirm, previously I didn’t have to declare the “exe” as a global, it just worked! However, this example of mine has illustrated that my code layout in this instance could do with some improvement/cleaning up, so declaring it within the main function is the better way to go. I’m just pointing out that maybe the order of initialisation should be double-checked in your script engine, just in case something is slightly out?
Bundling Python with Deadline. Is that installed to just the repository or to all the clients?
It will be installed with the clients and the repository. We have it set up so that python has it’s own auto-update system. We’ll be shipping with python 2.6.7, but if we were to bump up that version number in 5.2, you could still just upgrade the repository and then restart the slaves, and they will automatically copy over the new binaries and the new python version.
Cheers,
Cool.
I assume if I make my own py module and dump it in the repository it will be copied to all clients?
Actually, no, it currently doesn’t work that way. It’s actually a pretty simple system, unlike the binary update system. All the client does is check if there is a new version folder in \your\repository\python, and if there is, it just copies the whole thing over. Maybe we could look at using a ‘Version’ file like we currently do to trigger a python update. I’ve added this to the wish list.
Cheers,