I have a bevy of print()
statements throughout my Script DATs, Parameter Execute DATs, etc. Is there a holistic way to figure out wherefrom something is printed on the console? cmd-f
only seems to search node names.
Hi,
The debug()
function prints to the console and cites the place where it was issued (ie: the DAT, function and line number)
See Also:
Debug Module
edited: grammar issues
Yeah, gonna use that from now on! I did find the tscript find
command which does let you search through the entire operators so I was able to track all my print()
's down.
Oh,
if you want to search through all the DATs in your project for a string you can use (working from memory here, sorry for errors):
for dat in op('/').findChildren(type=DAT):
line = 1
for l in dat.text.split('\n'):
if 'print()' in l:
print(dat.path,' ',line)
line+=1
edit: nevermind all that @snaut 's is way better
Hello @flowb and @antoinedurr,
just to add to it:
there is also the OP Find DAT with the ability to specify the search string on the DAT Text
parameter. (just make sure to enclose it with *
: *print(*
)
Otherwise also the Search/Replace Dialog might come in handy which you can find under Edit>Search/Replace. (Alt+s
)
cheers
Markus
Another quick option is to stick with findChildren:
root.findChildren(text='print(')
But this won’t give you the line numbers as the other solutions
Great options, thanks!