Anyone knowledgable with python?
Posted: Tue Feb 09, 2010 2:36 pm
Seemingly simple question. I'm using blender to export a collada file. The export errors and the error console indicates it cannot save the file to "c:\\"
Does python have anything comparable to PHP's stripslashes? Before this post I have about 5 minutes of python experience, so yes, I'm greener than green.
It errors on line 32, because filename has escaping slashes.
Does python have anything comparable to PHP's stripslashes? Before this post I have about 5 minutes of python experience, so yes, I'm greener than green.
It errors on line 32, because filename has escaping slashes.
Code: Select all
def SaveDocumentToFile(self, filename):
self.version = '1.4.0'
self.xmlns = 'http://www.collada.org/2005/11/COLLADASchema'
colladaNode = Element(DaeSyntax.COLLADA)
colladaNode.setAttribute(DaeSyntax.VERSION, self.version)
colladaNode.setAttribute(DaeSyntax.XMLNS, self.xmlns)
colladaNode.appendChild(self.asset.SaveToXml(self))
# add the libraries
# print '\ndeb:SaveDocumentToFile self.controllersLibrary=', self.controllersLibrary #------
# print '\ndeb:SaveDocumentToFile dir(self)', dir(self) #------
# print '\ndeb:SaveDocumentToFile self.effectsLibrary=', self.effectsLibrary #------
AppendChild(self,colladaNode,self.animationsLibrary)
AppendChild(self,colladaNode,self.animationClipsLibrary)
AppendChild(self,colladaNode,self.camerasLibrary)
AppendChild(self,colladaNode,self.controllersLibrary)
AppendChild(self,colladaNode,self.effectsLibrary)
AppendChild(self,colladaNode,self.imagesLibrary)
AppendChild(self,colladaNode,self.lightsLibrary)
AppendChild(self,colladaNode,self.materialsLibrary)
AppendChild(self,colladaNode,self.geometriesLibrary)
AppendChild(self,colladaNode,self.nodesLibrary)
AppendChild(self,colladaNode,self.visualScenesLibrary)
AppendChild(self,colladaNode,self.physicsMaterialsLibrary)
AppendChild(self,colladaNode,self.physicsModelsLibrary)
AppendChild(self,colladaNode,self.physicsScenesLibrary)
AppendChild(self,colladaNode,self.scene)
# write xml to the file
fileref = open(filename, 'w')
fileref.write(xmlUtils.ToXml(colladaNode))
fileref.flush()
fileref.close()
colladaNode.unlink()