Troubleshooting Error : Not enough ressources specified

Hello Everyone,

First of all I want to warn people that this is my first post here and maybe my first post on a forum for a least 10 years Haha. Also English is not my main language but I will try to be as clear as possible.I am a total beginner in TouchDesigner

So, I am trying to follow this circular texture slicing tutorial from the Interactive HQ.

I can follow the tutorial up to a certain point.

After writing this code :

# me - this DAT
# 
# comp - the replicator component which is cooking
# allOps - a list of all replicants, created or existing
# newOps - the subset that were just created
# template - table DAT specifying the replicator attributes
# master - the master operator
#

import random

scaleVal = 0.8 / op('par1')['Numreplicants']
speedStr = "op('../speed_null')['Rotationspeed']"

def onRemoveReplicant(comp, replicant):
	
	replicant.destroy()
	return

def onReplicate(comp, allOps, newOps, template, master):

	for c in newOps :
		# connect uv_null to input
		c.inputconnectors[0].connect(op('uv_null'))
		
		# connect output to comp1
		c.outputconnectors[0].connect(op('comp1'))
		
		# set circle size based on digits
		c.op('circle1').par.radiusx = c.digits * scaleVal
		c.op('circle1').par.radiusy = c.digits * scaleVal
		
		#generate and assign random rotation values
		randomVal = 2 * random.random() - 1
		c.op('comp1').par.r.expr = '{} * {}'.format(speedStr,randomVal)
		
	return

I keep having the same error on my comp1 : the error says “Not enough sources specified”. I tried a bit of everything but asking for help is my last resort right now.

I hope that I have been clear enough, thanks in advance for any help or advice.

Hi @143Jode,

welcome to the community and this is the right place to ask questions :slight_smile:
Just a quick note, when you post code in the forum, you can format the code so it looks like it is now after I edited your post a bit. If you need to post code in line, encapsulating your code in single quotes like this
`op('someOp').something` gives it proper formatting.

For codeblocks, use triple quotes like this:

```
#my function comes here
def myFunction(someArg):
    return someArg + 1
```

The error you are mentioning though usually appears on operators that have an input but no input is supplied. As it is a bit hard to tell what is going on, could you post the file you are working on as an example for everyone to look at?

cheers
Markus

Hi, @snaut,

Thank you so much for cleaning up my post. and thank you for your advice, now I know how to properly post code on the forum !

I checked if I my operator had a proper input and I couldn’t find something wrong.

here is the file I’m working on, thank you for having a look at it :
Circular_Slicing.24.toe (5.1 KB)

Best Regards

Hi @143Jode,

there is a syntax error in the replicator script I didn’t catch when looking at it. It can be helpful to have the Textport open so you can catch script errors when they happen. The Textport is accessible via the menu “Dialogs>Textport and DATs”.
Hitting “Recreate All” then reveals the error:

Traceback (most recent call last):
  File "/project1/circular_uv_generator/replicator1_callbacks", line 24, in onReplicate
td.AttributeError: 'td.baseCOMP' object has no attribute 'inputconnectors' Context:/project1/circular_uv_generator/item1

Now we know that Base COMPs do have a python member called inputConnectors - we can always verify this by checking the documentation here:

and then double checking the script I saw that you are using inputconnectors and outputconnectors without the capital C. As a rule of thumb, python members and functions in TouchDesigner use a “camelcase” standard - so when you change your script to

# connect uv_null to input
c.inputConnectors[0].connect(op('uv_null'))
		
# connect output to comp1
c.outputConnectors[0].connect(op('comp1'))

everything should start working.
The error you are describing for the TOP “comp1” then was an effect of this - it errors if no inputs are connected with the message Not enough sources specified. With the corrected script, the created Base COMPs will connect to it and the error disappears.

Cheers
Markus

1 Like

Wow,

Thank you so much ! I could fix the error thanks to you !

Also thank you for showing me the Textport, this will definitely help in the future.