hi, 
okey let me explain with an example which will be faster. It is a small 
code so I'll just past it here. I have the function:

def saveTreeDataToFile(filePath, treeWidget):
    treeData = json.loads(serializeTree(treeWidget))
    print(filePath) # Result: "D:/CHIMERA STUDIO/CHIMERA 
CGI/workspace/cfg_data.json"
    
    with open(filePath, mode="w") as f:
        json.dump(treeData, f, indent=4)

I printed the file path just to check which is "D:/CHIMERA STUDIO/CHIMERA 
CGI/workspace/cfg_data.json". So there is no back slash issue or anything. 
I get the following error:

# OSError: [Errno 22] Invalid argument: '"D:/CHIMERA STUDIO/CHIMERA 
CGI/workspace/cfg_data.json"'


however, if override manually filePath with the result that what was 
printed like so:

def saveTreeDataToFile(filePath, treeWidget):
    treeData = json.loads(serializeTree(treeWidget))
    filePath = "D:/CHIMERA STUDIO/CHIMERA CGI/workspace/cfg_data.json"
    with open(filePath, mode="w") as f:
        json.dump(treeData, f, indent=4)

...everything works fine. How is this possible? If it is a formatting issue 
I don't see it. 
Any idea what is happening ?

thanks,
R

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4eae1d5e-791d-4afc-bea0-489ec135b057n%40googlegroups.com.

Reply via email to