Can it be that the python editor saves script before or after a run?
I had a bluescreen crash while running a script and after a reboot the python file is “empty” ExportCombs.py (1.5 KB)
I have no clue what causes the crash but I do not suspect the script or Rhino (yet) as it is a
“IRQL not less or equal”.
However I was surprised that apparently Rhino at some point after hitting the run button accesed and changed the .py file.
Can this behavior be set somewhere; I would like Rhino not to save my .py files without my explicit consent.
This is a known issue - not the crash, but the saving of .py files before running… been discussed here before… Apparently with the current setup it is necessary to save the files before running them, Steve said he will look into a workaround for this, but I don’t expect to see anything before V6…
About the only thing you can do while developing a script is do a series of incremental saves with a new name…
Edit: if you have run it but not saved it yet, you should find a copy of your script here:
Auto saving files before execution is normal behaviour from many IDEs but in a scripting environment not everyone likes it. Whatever happened I don’t think Rhino corrupted your file.
Have you considered using version control software?
I think once you realize that your script is being saved automatically, it’s easier to work around it, yet still a bit annoying. It’s not very handy for trial and error type coding, which due to the fact that I’m a toolmaker, not a programmer, is pretty much how it goes for me on every project. Well, maybe it’s not quite that bad, but there are times when I want to experiment with an idea, and the only time I really want to save it is if it is successful.
I could live with it the way it is, but the constant redirection of the Python editor to the last opened file is about to make me blow a gasket! Can we please get that fixed!! If I open a file using a script, I certainly don’t want the editor to be looking at that location next time I open a script. I’m sure most people keep their projects in one location, not scattered all over the place. The editor should always open to the same place. Maybe it could be a set path in the options?
Try this:
Open a Python script from a specific location. Now open a Rhino file. Now go back and open another script. See how the editor is looking at the location the Rhino file was opened from? That’s what I’m talking about, that’s just wrong!
I know that when we think of versioning software we imagine a server to which we push our changes or checkout different revisions, etc, but modern options are very lightweight and require no server. With git for example your working directory and database of revisions all reside in one local directory on your machine (pushing it to a server is optional). I version everything I do that way even if I’m not sharing my work. There is a learning curve but once you get used to it you’ll never want to go going back to incremental saves.
But if many of you want an incremental saves option I’m sure we can consider adding it.
We are making changes to improve the user experience so many of these pain points will dissapear but I agree with your last point - it is just wrong! So I’ve logged it as a bug in our system to make sure it gets dealt with.
Spyder being an external IDE for python - for others it would equally be worth looking in Pycharm, VS, Atom, Notepad++ or whatever other external editor you may have used. This clearly doesn’t help if you only ever use the integrated editor in Rhino…