Dont understand any of that. Lets go risky. This thing seemed to do it… all corrupted Maybe not possible?
append corrupts it too
updating the path manually does too
Dont understand any of that. Lets go risky. This thing seemed to do it… all corrupted Maybe not possible?
append corrupts it too
updating the path manually does too
Yep I’m not going to even pretend I understand how to modify Dynamo in a text editor. Hopefully someone else has some ideas…
You can probably look into python json module to read and write dyn files. There are some good tutorials on YouTube.
yeah theres lots of stuff on the web. But I wouldnt know how to figure it out. Can turn the data into JSON after adjusting the text but not sure how I’d write that back to the file as theres no nodes for it
import json
aList = [{"a":54, "b":87}, {"c":81, "d":63}, {"e":17, "f":39}]
jsonString = json.dumps(aList)
jsonFile = open("data.json", "w")
jsonFile.write(jsonString)
jsonFile.close()
I dont know, cant find a writing dynamo node I can open as an example
import sys, clr, json, os
aList = IN[0]
jsonFile = IN[1]
jsonString = json.dumps(aList)
jsonFile.write(jsonString)
jsonFile.close()
OUT = jsonString
Apparently, there is a JsonData Package as well that lets you parse and write to json format.
I’d start with a small dyn file of one or two nodes and work up with more complex graphs.
Can you upload a sample of the Python you want to bulk change? Judging by the scope I can see using a package containing the Python is likely the best way to go, or better still writing the path as an input value instead of hard coding it.
As a part of the class I helped present with @dana.defilippi at BiLT America this year I produced some Python code to bulk edit Dynamo graphs, including:
While dyn and dyf files are text documents, you need to have them serialized correctly to have the application interpret them properly, which can be problematic for the packages I could find. The out of the box Python JSON tools worked well enough for me, but I recommend starting by editing in notepad++ so you can get the hang of it (change the language to json).
Thanks Jacob and others. Looking forwards to trying when I’m at work. Jacob where is your profile pic?
Hmmm I’m not sure if I can upload an example of the Python, its a tracking thing someone gave me
any kind of string replace is no good messing with jsons. I put the updated python node in another file and thought maybe I could replace it in the other files but its just to tricky. 1s the python node alone in a file. 2 is the other files to update. But I must be messing up serializeing?
It was a syntax thing or serialized. Looked at that string of JSON with the fixed path I wanted and then used that. Seems to add extra \ all over the place and it worked
Hi Jacob, do you have a link to your BiLT America class with documentation by any chance? To avoid this situation in future I need to make my own package. However I will need to replace those python tracker nodes in the script maintaining the wire as a next goal
Try making it a standalone .py file in a commonly accessible location, then append to system path and use the syntax; from ‘filename’ import *
This is how I log my pyrevit tool use with a single function stored in a .py file where I control the function on one place.
That’s the ‘work’ account which exists solely because it has to, and since I had info I thought might keep you hopeful I wanted to share it out before you got discouraged.
First some background.
Managing Dynamo repositories is hard, as each release can require modifying your code base, similar to what developers of add-ins go through. However we (development, seasoned users, community leaders) haven’t done a good job showing how this is best accomplished. My small section of this class aimed to start showing users hope to do this while prepping graphs for the new player.
The attached file should be renamed to a .zip and extracted. It contains 9.1 Dynamo graphs:
The zip also contains the source journal used for playback, in case you want (or need) to edit that further so you can update the larger set of content.
All of these nodes (and a few more) will eventually make it up to package manager, but I need some beta testers first - feedback welcome.
Bulk Graph Edits.zip.txt (275.6 KB)
While none of these directly show you how to bulk modify your python, you can likely use them to append your tracker (if that is what you’re after) quite readily, or use them as a template to do the bulk editing of the python.
Please try running with the IronPython 2.7 engine, and if the issue still persists post a .zip file renamed to .txt containing a sample of graphs to update.
by this way warning message has changed.Do i need to post sample of graph or is it possible to solve it by changing pyhthon code?
Interesting… try removing the , exist_ok=True
from that line and see if it runs.
Ok - I was afraid that something like that was going to happen.
Send over the files and I’ll have a look monday.