[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3232] trunk/py/scripts/addons/ render_renderfarmfi.py: Fixing a bug with an assertation failing due to file being saved in inaccessable directory
Jesse Kaukonen
jesse.kaukonen at gmail.com
Fri Apr 6 14:33:21 CEST 2012
Revision: 3232
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3232
Author: gekko
Date: 2012-04-06 12:33:21 +0000 (Fri, 06 Apr 2012)
Log Message:
-----------
Fixing a bug with an assertation failing due to file being saved in inaccessable directory
Modified Paths:
--------------
trunk/py/scripts/addons/render_renderfarmfi.py
Modified: trunk/py/scripts/addons/render_renderfarmfi.py
===================================================================
--- trunk/py/scripts/addons/render_renderfarmfi.py 2012-04-06 11:03:26 UTC (rev 3231)
+++ trunk/py/scripts/addons/render_renderfarmfi.py 2012-04-06 12:33:21 UTC (rev 3232)
@@ -21,7 +21,7 @@
bl_info = {
"name": "Renderfarm.fi",
"author": "Nathan Letwory <nathan at letworyinteractive.com>, Jesse Kaukonen <jesse.kaukonen at gmail.com>",
- "version": (19,),
+ "version": (20,),
"blender": (2, 6, 2),
"location": "Render > Engine > Renderfarm.fi",
"description": "Send .blend as session to http://www.renderfarm.fi to render",
@@ -43,6 +43,7 @@
import xmlrpc.client
import math
from os.path import isabs, isfile
+import os
import time
from bpy.props import PointerProperty, StringProperty, BoolProperty, EnumProperty, IntProperty, CollectionProperty
@@ -81,7 +82,7 @@
bpy.texturePackError = False
bpy.linkedFileError = False
bpy.uploadInProgress = False
-bpy.originalFileName = bpy.path.display_name_from_filepath(bpy.data.filepath)
+bpy.originalFileName = bpy.data.filepath
bpy.particleBakeWarning = False
bpy.childParticleWarning = False
bpy.simulationWarning = False
@@ -324,14 +325,29 @@
# Save with a different name
print("Saving into a new file...")
+ bpy.originalFileName = bpy.data.filepath
+ print("Original path is " + bpy.originalFileName)
try:
- # If the filename is empty, we'll make one from the path of the Blender installation
+ # If the filename is empty, we'll make one from the path of the user's resource folder
if (len(bpy.originalFileName) == 0):
- bpy.originalFileName = bpy.utils.resource_path(type='LOCAL') + "renderfarm.blend"
- bpy.ops.wm.save_mainfile(filepath=bpy.originalFileName)
+ print("No existing file path found, saving to autosave directory")
+ savePath = bpy.utils.user_resource("AUTOSAVE")
+ try:
+ os.mkdir(savePath)
+ except Exception as ex:
+ print(ex)
+ try:
+ savePath = savePath + "_renderfarm"
+ except Exception as ex:
+ print(ex)
+ try:
+ bpy.ops.wm.save_mainfile(filepath=savePath)
+ except Exception as ex:
+ print(ex)
else:
+ print("Saving to current .blend directory")
savePath = bpy.originalFileName
- savePath = savePath + "_renderfarm"
+ savePath = savePath + "_renderfarm.blend"
bpy.ops.wm.save_mainfile(filepath=savePath)
except Exception as e:
print(e)
@@ -691,9 +707,13 @@
return body, headers
def send_post(data, files):
+ print("Forming connection for post")
connection = http.client.HTTPConnection(rffi_xmlrpc_upload)
+ print("Requesting")
connection.request('POST', '/burp/storage', *encode_multipart_data(data, files)) # was /file
+ print("Getting response")
response = connection.getresponse()
+ print("Reading response")
res = response.read()
return res
@@ -709,7 +729,9 @@
return md5hash.hexdigest()
def upload_file(key, userid, sessionid, path):
+ print("Asserting absolute path")
assert isabs(path)
+ print("Asserting path is a file")
assert isfile(path)
data = {
'userId': str(userid),
More information about the Bf-extensions-cvs
mailing list