You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 6, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 6, 2021. It is now read-only.
Access/Overwrite the code inside the GHPython from another GHPython component #54
I wonder if there is a way that I can can access the code inside the GHPython components on canvas and modify/overwrite them from a GHPython component.
I'm thinking to use this method to update the components that I share with others as user objects. I want to iterate through the components, read the code, check if it is old (in my case there is a line that indicates the version) and overwrite the code with a newer version in case there is a newer version.
this shows how to achieve an update of the code from another Python component. I made this into a working example, so you can choose the way you would like this to work: either manually, one by one (this is not possible with the usual upgrader), or all components at once.
@piac Thanks for the reply. It gives me the error below when I try to open the file. Seems to be an issue with the ghx file. I tried to fix the file but I couldn't get it to work.
Hi @piac, Thank you for the new file. I can't still open the file. I asked a friend to test it and he wasn't able to open the file either. Do you have a guess why this is happening? What if you just share the code inside the component?
This is just a file on Git -- you can download the whole source, which you already did once, and it will be there. Otherwise, follow the link. Then you'll see the "raw view" link. That is the file that you are supposed to save...
I just tried and it worked well. If this does not work, there are some issues on GitHub...
Activity
piac commentedon Nov 7, 2013
Hi Mostapha
this shows how to achieve an update of the code from another Python component. I made this into a working example, so you can choose the way you would like this to work: either manually, one by one (this is not possible with the usual upgrader), or all components at once.
https://github.com/mcneel/ghpython/blob/master/Samples/quickUpdater.gh
Giulio
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
piac commentedon Nov 8, 2013
@mostaphaRoudsari: please let me know if this helps -- otherwise, please feel free to open this issue again. Thanks!
mostaphaRoudsari commentedon Nov 12, 2013
@piac Thanks for the reply. It gives me the error below when I try to open the file. Seems to be an issue with the ghx file. I tried to fix the file but I couldn't get it to work.
piac commentedon Nov 12, 2013
@mostaphaRoudsari I've changed the sample to .gh to have it more easily downloadable
mostaphaRoudsari commentedon Nov 13, 2013
Hi @piac, Thank you for the new file. I can't still open the file. I asked a friend to test it and he wasn't able to open the file either. Do you have a guess why this is happening? What if you just share the code inside the component?
piac commentedon Nov 14, 2013
This is just a file on Git -- you can download the whole source, which you already did once, and it will be there. Otherwise, follow the link. Then you'll see the "raw view" link. That is the file that you are supposed to save...
I just tried and it worked well. If this does not work, there are some issues on GitHub...
mostaphaRoudsari commentedon Nov 14, 2013
Hi Guilio, I will try it on more systems and will let you know if I could open it. Thanks.
mostaphaRoudsari commentedon Nov 14, 2013
We tried on another system and now it is working fine. Exactly what I was looking for. This is a great help. Thank you so much.