Deadline plugins, System.NullReferenceException

Sorry for so many questions today. The thing is I’m writing a plugin for Deadline and since Deadline is a pain to debug I just have to ask for every stupid mistake I make that I don’t obviously see in my code.

So, here is:

I’m trying to create a WinRAR plugin that’ll support some little more advanced features such as checking for whther package files already exist etc… anywyas, I came up with an idea to always compress/unpack files into a temp folder and only after this is done the files will get copied over to the user specified folder.

The thing is, I’ll need to override the PreRenderTasks(), as well as PostRenderTasks() methods. Which is fine and working. But, I’ll need to pass a ton of variables among the various methods. So, I added a def init method to the plugin class definition in which I initialize the variables I’ll need in all the methods in the class, like so:

def __init__( self ): #setup the plugin variables etc... self.version = GetPluginInfoEntry( "Version" ) self.exeList = GetConfigEntry( "WinRAR_Executable_" + self.version.replace( ".", "_" ) ) self.file = GetPluginInfoEntryWithDefault( "File", GetDataFilename() ) self.method = GetPluginInfoEntryWithDefault( "Method", "" ) self.dropFolder = GetPluginInfoEntryWithDefault( "DropFolder", GetDataFilename() ) self.overwriteFiles = GetPluginInfoEntry( "OverwriteFiles" ) self.tempPath = "" self.tempArchiveFile = ""

The problem arises when I try to access these in any of the methods, for example:

[code]def PreRenderTasks( self ):
self.file = CheckPathMapping( self.file )
self.dropFolder = CheckPathMapping( self.DropFolder )

rndFileName = ( Path.GetFileNameWithoutExtension(Path.GetRandomFileName) + ".rar" )
self.tempPath = Path.Combine(Path.GetTempFile(), "WinRARTemp")
self.tempArchiveFile = Path.Combine(tempPath, rndFileName)[/code]

When I submit the job to Deadline, I’m getting this error:

An error occurred in function "GetDeadlinePlugin" the plugin script file C:\Documents and Settings\Administrator\Local Settings\Application Data\Thinkbox\Deadline\slave\plugins\WinRAR.py: Python Error: Object reference not set to an instance of an object. (System.NullReferenceException)

Since it doesn’t provide any line number or anything specific, I’m lost. I really don’t know what’s bugging Deadline so much, but I just can’t go on with scripting. Maybe I’m just way too tired and not seeing my mistake, but I just don’t.

I’ve already spent half a day debugging the code (let me say it again: scripting for Deadline is A HUGE PAIN IN THE A**!), now I need to introduce the more advanced functionality and without debugging tools I just don’t feel like doing this anymore. I wanted to release the plugin to the public (hence the safety features), because I already got it working internally for my specific needs, but if I can’t get over these issues, I’ll probably give up as time is really a pricey commodity.

I’ll appretiate any help/hints. Thanks a lot in advance! Cheers…

I think I got it working from you Nuke plugin script.

It seems that I can’t assign to the top level variables using Deadline’s methods. When I create the variables as placeholders and assign to them inside the overridden methods, that seems to work.

Is this correct?

Hi,
I think this line is wrong:

self.tempArchiveFile = Path.Combine(tempPath, rndFileName)

should be:

self.tempArchiveFile = Path.Combine(self.tempPath, rndFileName)

Mike

Thanks Mike, it wasn’t just that.

I think it was mainly the fact I was calling Deadline methods inside the init method.

It was all weird. But I managed to solve it finally and the plugin works. I’ll be posting it up soon :slight_smile:

Thanks again!