Zbrush, Python, and win7 UAC

Oh my this is a fun one.

I’m writing a python script that will automatically copy brushes and alphas and what not from a perforce folder to the zbrush install folder in order to centralize common tools for artists.

I have it all working for the most part, except for the fact that when I try to copy anything to the ZBrush install folder, I get a permission denied error. I am pretty sure that this is because of Win7 / UAC, but I don’t know of a way to run the script as Admin to get around the permissions. I have read a bit about this and it seems that I need to elevate the script somehow to run as admin. I’m wondering if anyone else has run into this and if there is a relatively easy way to get around it.

Alternatively, is there a way to point ZBrush to source tools and brushes from locations other than the default install folder? I could easily circumvent the UAC problem if I could just give ZBrush another path to source those things from.

Thanks friends

I’m not a Windows user, so this may be incredibly stupid but:

Would it work around the problem to wrap this in py2exe and run as administrator? I ported one of my package installers to Windows this way and I haven’t run into problems, but it could just be because admin privileges aren’t actually needed for the application install I’m patching. I spent probably a grand total of 10 minutes in Windows last year just to build to py2exe and do a quick run-through to make sure it works, so feel free to take this with a grain of salt.

I wasn’t familiar with py2exe but it looks like it could be an option… I assume users still need to have the correct python version installed in order for it to be runnable?

Why not just use a directory level symbolic link instead? No overhead whatsoever.

py2exe and py2app don’t require that users have Python installed, which was part of the reason I needed it for my patcher.

They work by basically building in the interpreter and the libraries that your application makes use of. As Brett pointed out, there’s some obvious overhead in that the executable actually contains the Python interpreter (becomes extra gluttonous if you use e.g., PyQT to create GUI for your application). For my simple patcher using PyQT as GUI, it’s nearly 28MB, majority of which is from PyQT dlls (even larger on OS X using py2app when the application is not compressed). It’s not especially pretty, but it’s something I had to use in my case for enhanced usability and my inability to make assumptions about the user’s configuration (e.g., whether they have Python installed, what version they might have, whether they have PyQT installed, etc.).

Fwiw, turning off the UAC is one of the first things I do and have everyone using my tools do. It’s a real pain in the neck.

Just type “UAC” in the field in the Start Menu and drag the slider all the way to the bottom…

I wish I could but we have a studio mandate that won’t allow that. It was like pulling teeth just to get them to lower it enough so that we didn’t have to put in an admin user/pass when we clicked on the clock.

Symbolic links sounded great but apparently I have the same issue when trying to create the link as just copying straight to the folder. Need permissions to create the link as well.

Next up py2exe, haha.

Don’t know if this could be of any help, but what you could try as well is to have your ZBrush install on each machine somewhere that isn’t protected as heavily by UAC (like in some C:\Apps or something, rather than in Program Files). Windows should no longer halt whenever you try to change anything within the folder.

Yeah I am to the point where I am probably going to have to do that. py2exe works in the sense that it builds correctly but for some reason the p4 module behaves differently when I run py2exe versus when I run the python script from the intepreter. p4.run_sync syncs a path based on the clientspec and returns the sync info. When I run the script in the interpreter or by double clicking the python script, it resolves the path name no problem. When I build the script as py2exe in order to test the Run as Administrator workaround, it can’t resolve the pathname. So many hitches… Installing to a folder outside of program files seems to be my only hope at this point. I’m going to make it my mission to find a way to get feedback to Pixologic that user defined paths need to be implemented for Vista/win7 users in a future release, haha. This is ridiculous.

workaround found:

Your files do not necessarily need to be local to the install folder, you can create shortcuts to any folder outside of the directory and the ZBrush lightbox will recognize it and allow you to browse any of those folders. So you don’t have to physically copy anything in order to keep data synced between ZBrush and P4, you just need shortcuts to the P4 directories.

Sad that I spent a long time dealing with all this permissions stuff but at least I learned something out of it, right? right???

[QUOTE=jeremyc;8671]Sad that I spent a long time dealing with all this permissions stuff but at least I learned something out of it, right? right???[/QUOTE]

Whatever doesn’t kill you, makes you more knowledgeable. :D: