Job.JobDependencyIDs Breaking Scripts

I’m working up a script to look for job dependencies based on a naming convention (other jobs with a specific prefix plus the same file name)
I have it working with the following code:

[code]def main():
Job = MonitorUtils.GetSelectedJobs()[0]

deadlineCommand = "C:/Program Files/Thinkbox/Deadline7/bin/deadlinecommand.exe"
response = subprocess.Popen([deadlineCommand, "-GetJobIdsFilter", "Name=ASP_" + Job.JobName], stdout=subprocess.PIPE)
dependencies = response.communicate()[0].rstrip().split('\n')

for i,dependency in enumerate(dependencies):
    dependencies[i] = dependency.rstrip('\r')

Job.SetJobDependencyIDs( dependencies )[/code]

However I don’t want it to overwrite all the job dependencies, in case there’s one that no longer follows the naming convention but should be a dependent.
Any time I’ve attempted to use Job.JobDependencyIDs though, I’ve been unable to get any results out of it. It never returns any IDs and it seems to break the script. I’ve used other attributes like JobName and Comment just fine, so I don’t know why this one in particular is giving trouble.

Here’s the kind of thing I was trying to do with it:

[code]def main():
Job = MonitorUtils.GetSelectedJobs()[0]

deadlineCommand = "C:/Program Files/Thinkbox/Deadline7/bin/deadlinecommand.exe"
response = subprocess.Popen([deadlineCommand, "-GetJobIdsFilter", "Name=ASP_" + Job.JobName], stdout=subprocess.PIPE)
dependencies = response.communicate()[0].rstrip().split('\n')

for i,dependency in enumerate(dependencies):
    dependencies[i] = dependency.rstrip('\r')
    
dependencyIDs = JobDependencyIDs

for i,dependency in enumerate(dependencies):
    if dependency not in dependencyIDs
        dependencyIDs.append(dependency)

Job.SetJobDependencyIDs( dependencyIDs )[/code]

In case anyone else happens upon this and is confused, I believe I found the answer.

I had actually forgotten that when I declared Job.JobDependencyIDs as a variable I was only referencing it, so I wasn’t allowed to append anything to it and that was what made the script stop running.
Once I instead copied Job.JobDependencyIDs w hen assigning it to a new variable, I was able to append to it just fine and the script ran without issue.

Hello Gary,

Thanks for the update! Sorry no one touched base on this post, it was a weird few days with the holiday here at the office. Hopefully your answer will help others.