diff --git a/Prism/Plugins/Apps/3dsMax/Scripts/Prism_3dsMax_Integration.py b/Prism/Plugins/Apps/3dsMax/Scripts/Prism_3dsMax_Integration.py index a0d10341..48912888 100644 --- a/Prism/Plugins/Apps/3dsMax/Scripts/Prism_3dsMax_Integration.py +++ b/Prism/Plugins/Apps/3dsMax/Scripts/Prism_3dsMax_Integration.py @@ -174,10 +174,11 @@ def writeMaxFiles(self, installPath): origInitFile = os.path.join(integrationBase, "initPrism.py") shutil.copy2(origInitFile, initPy) - with open(initPy, "r+") as init: + with open(initPy, "r") as init: initStr = init.read() + + with open(initPy, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) prismMenu = os.path.join(maxpath, "PrismMenu.ms") diff --git a/Prism/Plugins/Apps/Blender/Scripts/Prism_Blender_Integration.py b/Prism/Plugins/Apps/Blender/Scripts/Prism_Blender_Integration.py index 1d759e8d..b3b93f9e 100644 --- a/Prism/Plugins/Apps/Blender/Scripts/Prism_Blender_Integration.py +++ b/Prism/Plugins/Apps/Blender/Scripts/Prism_Blender_Integration.py @@ -168,10 +168,11 @@ def writeBlenderFiles(self, blenderPath): shutil.copy2(baseinitfile, initpath) addedFiles.append(initpath) - with open(initpath, "r+") as init: + with open(initpath, "r") as init: initStr = init.read() + + with open(initpath, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) baseRenderfile = os.path.join(integrationBase, "PrismAutoSaveRender.py") diff --git a/Prism/Plugins/Apps/Fusion/Scripts/Prism_Fusion_Integration.py b/Prism/Plugins/Apps/Fusion/Scripts/Prism_Fusion_Integration.py index adeefb2a..25fd552f 100644 --- a/Prism/Plugins/Apps/Fusion/Scripts/Prism_Fusion_Integration.py +++ b/Prism/Plugins/Apps/Fusion/Scripts/Prism_Fusion_Integration.py @@ -138,10 +138,11 @@ def writeFusionFiles(self, fusionpath): shutil.copy2(origFile, targetFile) addedFiles.append(targetFile) - with open(targetFile, "r+") as init: + with open(targetFile, "r") as init: initStr = init.read() initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) + + with open(targetFile, "w") as init: init.write(initStr) if platform.system() == "Windows": @@ -159,10 +160,11 @@ def writeFusionFiles(self, fusionpath): shutil.copy2(origFile, targetFile) addedFiles.append(targetFile) - with open(targetFile, "r+") as init: + with open(targetFile, "r") as init: initStr = init.read() + + with open(targetFile, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) for i in ["1 Save Version.py", "2 Save Comment.py", "3 Project Browser.py", "4 Update selected load nodes.py", "5 Settings.py"]: @@ -179,10 +181,11 @@ def writeFusionFiles(self, fusionpath): shutil.copy2(origFile, targetFile) addedFiles.append(targetFile) - with open(targetFile, "r+") as init: + with open(targetFile, "r") as init: initStr = init.read() + + with open(targetFile, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) for i in ["WritePrism.setting"]: @@ -199,10 +202,11 @@ def writeFusionFiles(self, fusionpath): shutil.copy2(origFile, targetFile) addedFiles.append(targetFile) - with open(targetFile, "r+") as init: + with open(targetFile, "r") as init: initStr = init.read() + + with open(targetFile, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) if platform.system() in ["Linux", "Darwin"]: diff --git a/Prism/Plugins/Apps/Houdini/Scripts/Prism_Houdini_Integration.py b/Prism/Plugins/Apps/Houdini/Scripts/Prism_Houdini_Integration.py index 6782be3e..849eb6de 100644 --- a/Prism/Plugins/Apps/Houdini/Scripts/Prism_Houdini_Integration.py +++ b/Prism/Plugins/Apps/Houdini/Scripts/Prism_Houdini_Integration.py @@ -209,10 +209,11 @@ def writeHoudiniFiles(self, houdiniPath): shutil.copy2(origInitFile, initpath) addedFiles.append(initpath) - with open(initpath, "r+") as init: + with open(initpath, "r") as init: initStr = init.read() + + with open(initpath, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) diff --git a/Prism/Plugins/Apps/Maya/Scripts/Prism_Maya_Integration.py b/Prism/Plugins/Apps/Maya/Scripts/Prism_Maya_Integration.py index c6bb8031..84b6f4e8 100644 --- a/Prism/Plugins/Apps/Maya/Scripts/Prism_Maya_Integration.py +++ b/Prism/Plugins/Apps/Maya/Scripts/Prism_Maya_Integration.py @@ -204,10 +204,11 @@ def writeMayaFiles(self, mayaPath): shutil.copy2(origInitFile, initpath) addedFiles.append(initpath) - with open(initpath, "r+") as init: + with open(initpath, "r") as init: initStr = init.read() + + with open(initpath, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) shelfpath = os.path.join(mayaPath, "prefs", "shelves", "shelf_Prism.mel") diff --git a/Prism/Plugins/Apps/Natron/Scripts/Prism_Natron_Integration.py b/Prism/Plugins/Apps/Natron/Scripts/Prism_Natron_Integration.py index 7fe984b5..3c7b67a6 100644 --- a/Prism/Plugins/Apps/Natron/Scripts/Prism_Natron_Integration.py +++ b/Prism/Plugins/Apps/Natron/Scripts/Prism_Natron_Integration.py @@ -144,10 +144,11 @@ def writeNatronFiles(self, natronpath): with open(initFile, 'a') as initfile: initfile.write(initString) - with open(initFile, "r+") as init: + with open(initFile, "r") as init: initStr = init.read() + + with open(initFile, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) addedFiles.append(initFile) diff --git a/Prism/Plugins/Apps/Nuke/Scripts/Prism_Nuke_Integration.py b/Prism/Plugins/Apps/Nuke/Scripts/Prism_Nuke_Integration.py index 5c260e76..b2546c9a 100644 --- a/Prism/Plugins/Apps/Nuke/Scripts/Prism_Nuke_Integration.py +++ b/Prism/Plugins/Apps/Nuke/Scripts/Prism_Nuke_Integration.py @@ -147,10 +147,11 @@ def writeNukeFiles(self, nukepath): with open(menuFile, 'a') as initfile: initfile.write(initString) - with open(menuFile, "r+") as init: + with open(menuFile, "r") as init: initStr = init.read() + + with open(menuFile, "w") as init: initStr = initStr.replace("PRISMROOT", "\"%s\"" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) addedFiles.append(menuFile) diff --git a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 1 Tools.jsx b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 1 Tools.jsx index 3bbc7670..303628ef 100644 --- a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 1 Tools.jsx +++ b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 1 Tools.jsx @@ -1 +1 @@ -app.system("start "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" Tools") \ No newline at end of file +app.system('start "" "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" Tools') \ No newline at end of file diff --git a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 2 Save version.jsx b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 2 Save version.jsx index 5985dfaf..33b51e2a 100644 --- a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 2 Save version.jsx +++ b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 2 Save version.jsx @@ -1 +1 @@ -app.system("start "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" SaveVersion") \ No newline at end of file +app.system('start "" "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" SaveVersion') \ No newline at end of file diff --git a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 3 Save comment.jsx b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 3 Save comment.jsx index b15901fb..bd2cef07 100644 --- a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 3 Save comment.jsx +++ b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 3 Save comment.jsx @@ -1 +1 @@ -app.system("start "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" SaveComment") \ No newline at end of file +app.system('start "" "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" SaveComment') \ No newline at end of file diff --git a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 4 Export.jsx b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 4 Export.jsx index 6a2e1f34..ebd2837c 100644 --- a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 4 Export.jsx +++ b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 4 Export.jsx @@ -1 +1 @@ -app.system("start "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" Export") \ No newline at end of file +app.system('start "" "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" Export') \ No newline at end of file diff --git a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 5 ProjectBrowser.jsx b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 5 ProjectBrowser.jsx index 89c256c7..8b97e894 100644 --- a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 5 ProjectBrowser.jsx +++ b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 5 ProjectBrowser.jsx @@ -1 +1 @@ -app.system("start "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" ProjectBrowser") \ No newline at end of file +app.system('start "" "PRISMROOT/Python27/PrismProjectBrowser.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" ProjectBrowser') \ No newline at end of file diff --git a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 6 Settings.jsx b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 6 Settings.jsx index 6d239add..85bb5f8d 100644 --- a/Prism/Plugins/Apps/Photoshop/Integration/Prism - 6 Settings.jsx +++ b/Prism/Plugins/Apps/Photoshop/Integration/Prism - 6 Settings.jsx @@ -1 +1 @@ -app.system("start \"PRISMROOT/Python27/PrismSettings.exe\" \"PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py\" Settings") \ No newline at end of file +app.system('start "" "PRISMROOT/Python27/PrismSettings.exe" "PRISMROOT/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py" Settings') \ No newline at end of file diff --git a/Prism/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_Integration.py b/Prism/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_Integration.py index 61e32045..5510f796 100644 --- a/Prism/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_Integration.py +++ b/Prism/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_Integration.py @@ -140,10 +140,12 @@ def writePhotoshopFiles(self, photoshoppath): shutil.copy2(origFile, targetFile) - with open(targetFile, "r+") as init: + with open(targetFile, "r") as init: initStr = init.read() - initStr = initStr.replace("PRISMROOT", "%s" % self.core.prismRoot.replace("\\", "/")) - init.seek(0) + + initStr = initStr.replace("PRISMROOT", "%s" % self.core.prismRoot.replace("\\", "/")) + + with open(targetFile, "w") as init: init.write(initStr) return True diff --git a/Prism/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py b/Prism/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py index da3b3ea7..50ae5dcf 100644 --- a/Prism/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py +++ b/Prism/Plugins/Apps/Photoshop/Scripts/Prism_Photoshop_MenuTools.py @@ -34,7 +34,7 @@ import os, sys, platform -prismRoot = os.path.abspath(os.path.join(os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, __file__)) +prismRoot = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir)) sys.path.append(os.path.join(prismRoot, "Scripts")) sys.path.append(os.path.join(prismRoot, "PythonLibs", "Python27", "PySide")) diff --git a/Prism/Plugins/Apps/Standalone/Scripts/Prism_Standalone_Functions.py b/Prism/Plugins/Apps/Standalone/Scripts/Prism_Standalone_Functions.py index 8eb82d8e..b0c5c1b1 100644 --- a/Prism/Plugins/Apps/Standalone/Scripts/Prism_Standalone_Functions.py +++ b/Prism/Plugins/Apps/Standalone/Scripts/Prism_Standalone_Functions.py @@ -201,10 +201,11 @@ def createWinStartMenu(self, origin): for i in [trayLnk, pbLnk, settingsLnk, pMenuSource]: if os.path.exists(i): - with open(i, "r+") as init: + with open(i, "r") as init: initStr = init.read() + + with open(i, "w") as init: initStr = initStr.replace("PRISMROOT", self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) if not os.path.exists(os.path.dirname(pMenuTarget)): @@ -254,10 +255,11 @@ def createWinStartMenu(self, origin): settingsLnk = os.path.join(self.core.prismRoot, "Tools", "Prism Settings.app") if os.path.exists(trayStartupSrc): - with open(trayStartupSrc, "r+") as init: + with open(trayStartupSrc, "r") as init: initStr = init.read() + + with open(trayStartupSrc, "w") as init: initStr = initStr.replace("PRISMROOT", self.core.prismRoot.replace("\\", "/")) - init.seek(0) init.write(initStr) cbPath = os.path.join(self.core.prismRoot, "Tools", "PrismTray.sh") diff --git a/Prism/Scripts/PrismCore.py b/Prism/Scripts/PrismCore.py index 3e693945..521d4a45 100644 --- a/Prism/Scripts/PrismCore.py +++ b/Prism/Scripts/PrismCore.py @@ -2642,7 +2642,7 @@ def saveVersionInfo(self, location, version, origin=None, fps=None, filenameBase deps = eval(deps.replace("\\", "/").replace("//", "/")) deps = str([str(x[0]) for x in deps]) - extFiles = self.appPlugin.sm_getExternalFiles(self)[0] + extFiles = getattr(self.appPlugin, "sm_getExternalFiles", lambda x: [[],[]])(self)[0] extFiles = str(list(set(extFiles))) data["Dependencies"] = deps