Python Source Editor does not save when I close Houdini

   1353   7   0
User Avatar
Member
117 posts
Joined: 2月 2015
Offline
I had this happen a few times. I write code in the Python Source Editor, then I restart Houdini and all my changes are gone.
Just lost last evenings coding which is not great.

Am I doing something wrong? What would be a better way of writing the code? I downloaded pycharm, but not sure how to integrate it in Houdini.

Currently what I do is I write my functions in Python Source Editor and then I call functions in the Python Shell which is a bit primitive.
User Avatar
Member
311 posts
Joined: 10月 2016
Offline
You could save the code in a node network or import it from a chosen location. Just storing it in an editor will vanish as you noticed.

If you put it in a shelf it is saved.
Edited by SWest - 2022年10月14日 06:01:08
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
User Avatar
Member
117 posts
Joined: 2月 2015
Offline
Thanks
If I put it in the shelf and open in external editor I see that its putting the shelf in the temp folder. Is that right, that does not sound like a good place to save the code.
User Avatar
Member
311 posts
Joined: 10月 2016
Offline
No, it should only be there during editing in external editor.
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
User Avatar
Member
2036 posts
Joined: 9月 2015
Offline
SWest
Just storing it in an editor will vanish as you noticed.

Actually, it is saved - but only in the hip file in which it was created. New instances of Houdini won't have it.
User Avatar
Member
117 posts
Joined: 2月 2015
Offline
BabaJ
SWest
Just storing it in an editor will vanish as you noticed.

Actually, it is saved - but only in the hip file in which it was created. New instances of Houdini won't have it.
The odd thing happeneing to me and my collegue is that it is saved sometimes. So I can open the file next day and then I have lost what I wrote in the evening. Not sure what is going on.
User Avatar
Member
117 posts
Joined: 2月 2015
Offline
I would like to build a library with python functions that are available in all Houdini scenes.
Any idea on how to do this?

What I did setup the PYTHONPATH environment pointing to a folder, then I created a python file there vf.py
I can now import this from the Python Shell.
One big problem though if I change the code for this vf.py file it will not register in Houdini until I restart.

That means every time I change the script I need to restart which is not great.
I just cannot figure out a good workflow to work with python in Houdini yet.
User Avatar
Member
1904 posts
Joined: 11月 2006
Offline
Putting all your code in an external module is the best way to go about it so that all files can access it. In terms of reloading, you can manually run a Python reload on your module when you've made changes that you want to pick up immediately.

Alternatively, you could shove it all into an HDA's PythonModule section (so that you can edit in Houdini and changes happen immediately) and refer/execute it from there via some convoluted means as long as the HDA is installed in the session.
Graham Thompson, Technical Artist @ Rockstar Games
  • Quick Links