Warning before overwriting during installation?

I just made what I’m sure is considered a “classic” mistake. I updated PyRevit (by running the .exe) without thinking ahead, and therefore without realizing that all the script.py files I had modified would be overwritten with ‘fresh’ copies.

Maybe most people rely on GitHub to handle backups, but I’m new to this and was just happy I could effectively modify some scripts to better suit my needs. So I didn’t yet have any other copies of my changed.py files.

Might I suggest adding a note to the setup file’s first screen, in all-caps: “ALL EXISTING PYREVIT .PY FILES WILL BE OVERWRITTEN BY THIS INSTALLATION, INCLUDING ANY USER-MODIFIED SCRIPTS. IF YOU HAVE MADE ANY MODIFICATIONS, BACK THEM UP NOW BEFORE PROCEEDING.”

Hi @Revitech, sorry for not reaching out sooner.

I’m sorry you lost all the work!

Usually you don’t mess with the pyrevit files, but rather create your own extension with the modified version of the scripts. Custom extensions won’t be affected by a pyrevit upgrade.
This is also useful to share scripts with others, either via file sharing or a github repository.

We could add the message you wrote, and I agree that could help avoid honest mistakes, but this is something you should expect by almost all the software out there!
And… taking backups is something you should do regularly regardless of but especially before any software update, as anything could go wrong…
This is just my personal opinion, not sure if some other contributor would invest their free time to add this message.

2 Likes

Hi Andrea,

I agree about making backups, and typically do so. This happened to be my first PyRevit experiment and was developed over a short timeline prior to a presentation to my coworkers (so I was in a bit of a rush) and a couple days before the presentation, a colleague asked me to test it on his machine, which made me suddenly realize my PyRevit wasn’t the latest version, so naturally I wanted to upgrade and test before showing it to him … All in all, a perfect example of the expression “haste makes waste”. :frowning:

So I certainly don’t expect PyRevit or any other software to be responsible for my oversights, but figure if it’s easy to add a warning that might prevent this for others, it’s worth suggesting.

One other idea – again, if it’s easy to implement – would be if when Alt-Clicking a PyRevit menu item, in addition to opening the File Explorer to that item’s script folder, it also opened a popup with a caution about how these scripts would be overwritten with PyRevit updates, and perhaps a link or at least a description of what to search for regarding the recommended practice of building extensions.

For many people this might seem unnecessary, but since it’s so easy to actually modify PyRevit’s scripts, I’m sure I won’t be the only one to tinker like this and perhaps suffer similar consequences.

BTW as is often the case, my replacement script took far less time to code, and was better coded as a result of being rewritten. Of course I wish I hadn’t had to rewrite it, but I figured you’d want to know that in the end I was able to make an effective presentation.

Jamie

Unless it raises some support, I’d never implement a popup for this. Imagine working on new scripts all day and get that popup every time…
I use the alt click thingies so many times that it would make me feel like working in Revit again. Kiddin’