NameError : global name 'deadlinePlugin' is not defined?

Hi
Running Deadline Version: 7.2.1.0 R on osx
I’m making a simple JobPreLoad script for some of our plugins that write to a server that keeps dropping off the network. But i keep getting “NameError : global name ‘deadlinePlugin’ is not defined” when i try to run jobs that use the script. Any ideas?
Script looks lik this:

[code]import os
import subprocess
from System import *
from System.IO import *

def check_remote_dir_is_mounted( remote_dir, local_dir ):
if os.path.lexists(local_dir):
deadlinePlugin.LogInfo(“RACECAR: %s exists” % local_dir)
else:
deadlinePlugin.LogInfo(“RACECAR: %s doesn’t exists. Trying to create it” % local_dir)
os.makedirs(local_dir)

if os.path.ismount(local_dir):
    deadlinePlugin.LogInfo("RACECAR: %s in mounted" % local_dir)
else:
    deadlinePlugin.LogInfo("RACECAR: %s in not mounted. Trying to mount it" % local_dir)
    retcode = subprocess.call(["/sbin/mount", "-t", "smbfs", remote_dir, local_dir])

def main( deadlinePlugin ):

user = "**********"
psw = "**********"

pitlane_remote = "//%s:%s@10.0.0.104/PITLANE" % (user,psw)
repo_remote = "//%s:%s@10.0.0.101/DeadlineRepository7" % (user,psw)

deadlinePlugin.LogInfo("Checking if PITLANE is mounted")
check_remote_dir_is_mounted( pitlane_remote , "/Volumes/PITLANE")

deadlinePlugin.LogInfo("Checking if Repository is mounted")
check_remote_dir_is_mounted( repo_remote , "/Volumes/DeadlineRepository7")[/code]

Error looks like this:

2016-03-09 21:22:00: 0: INFO: Executing job preload script /Users/bonsak/Library/Application Support/Thinkbox/Deadline7/slave/bonsaks-mac-pro/plugins/56e085d50750bc31cceb1fda/JobPreLoad.py 2016-03-09 21:22:00: 0: INFO: Checking if PITLANE is mounted 2016-03-09 21:22:01: Scheduler Thread - Render Thread 0 threw a major error: 2016-03-09 21:22:01: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2016-03-09 21:22:01: Exception Details 2016-03-09 21:22:01: RenderPluginException -- Error: Job preload script "/Users/bonsak/Library/Application Support/Thinkbox/Deadline7/slave/bonsaks-mac-pro/plugins/56e085d50750bc31cceb1fda/JobPreLoad.py": NameError : global name 'deadlinePlugin' is not defined (FranticX.Scripting.PythonNetException) 2016-03-09 21:22:01: File "none", line 25, in __main__ 2016-03-09 21:22:01: File "none", line 10, in check_remote_dir_is_mounted 2016-03-09 21:22:01: at Deadline.Plugins.ScriptPlugin.PreLoadJob (System.String scriptFilename) [0x00000] in <filename unknown>:0 2016-03-09 21:22:01: at Deadline.Plugins.ScriptPlugin.StartJob (Deadline.Jobs.Job job, System.String& outMessage, FranticX.Processes.AbortLevel& abortLevel) [0x00000] in <filename unknown>:0 2016-03-09 21:22:01: RenderPluginException.Cause: JobError (2) 2016-03-09 21:22:01: RenderPluginException.Level: Major (1) 2016-03-09 21:22:01: RenderPluginException.HasSlaveLog: True 2016-03-09 21:22:01: RenderPluginException.SlaveLogFileName: /Library/Logs/Thinkbox/Deadline7/deadlineslave_renderthread_0-bonsaks-mac-pro-0000.log 2016-03-09 21:22:01: Exception.HResult: -2146233088 2016-03-09 21:22:01: Exception.Source: deadline 2016-03-09 21:22:01: Exception.TargetSite: Void StartJob(Deadline.Jobs.Job) 2016-03-09 21:22:01: Exception.Data: ( ) 2016-03-09 21:22:01: Exception.StackTrace: 2016-03-09 21:22:01: at Deadline.Plugins.Plugin.StartJob (Deadline.Jobs.Job job) [0x00000] in <filename unknown>:0 2016-03-09 21:22:01: at Deadline.Slaves.SlaveRenderThread.RenderCurrentTask (Deadline.IO.TaskLogWriter tlw) [0x00000] in <filename unknown>:0

-b

Ok. Figured this out myself. I had to put the “check_remote_dir_is_mounted” method inside the “main method”.

-b

Hey Bonsak,

Glad to see you worked it out, and a good education for anyone else who light make the same mistake.