Re: [Maya-Python] with open() fails if the path is passed as argument, but works if I passed as variable

2023-06-09 Thread Rudi Hammad
ahhh , yes. That 's it. Thanks Marcus. At some point in my code I was storing data using the path using json.dumps(thePath), when I stored directly thePath everything went okey. Cheers El viernes, 9 de junio de 2023 a las 16:57:49 UTC+2, Marcus Ottosson escribió: > Also copy/pasted the

Re: [Maya-Python] with open() fails if the path is passed as argument, but works if I passed as variable

2023-06-09 Thread Marcus Ottosson
Also copy/pasted the question into ChatGPT out of curiosity and got a similar response. -- The issue you are encountering seems to be related to the formatting of the file path string. It appears that the filePath parameter you are passing to the saveTreeDataToFile

Re: [Maya-Python] with open() fails if the path is passed as argument, but works if I passed as variable

2023-06-09 Thread Marcus Ottosson
Possibly unicode related, try print(repr(filePath)) and print(type(filePath)). Strings coming out of Qt is often unicode. Second possible cause is that there are “ included in the path, notice the triple ‘ on the invalid argument warning. On Fri, 9 Jun 2023 at 15:41, Rudi Hammad wrote: > hi, >

[Maya-Python] with open() fails if the path is passed as argument, but works if I passed as variable

2023-06-09 Thread Rudi Hammad
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