pyaaf2 icon indicating copy to clipboard operation
pyaaf2 copied to clipboard

urlstring corruption above 254 character path. pyaaf2 or AMC?

Open CronenbergRick opened this issue 1 year ago • 2 comments

Hi Mark. thanks for all the work you've put into building this library. I'm very new to programming, so please accept my apologies if this is an obvious thing to figure out by ones self.

when I use pyaaf2 and dump() a test file to txt:

with aaf2.open(input_file, "r") as f:
    with open(output_file, "w", encoding='utf-8') as out_file, io.StringIO() as buf:
        original_stdout = sys.stdout
        sys.stdout = buf 
        f.dump()
        sys.stdout = original_stdout  
        out_file.write(buf.getvalue())

I get a file where the 'unc path' under 'user comments' looks healthy regardless of length, but the 'URLString' under 'locator' gets wonky if the file path is over 254 chars long.

Is this pyaaf2 having the issue? or is this Avid Media Composer having the issue when exporting? or is this maybe running the script from windows having the issue?

The url path will show up like this: URLString <aafString TypeDefString> file://server/share/musicdepartment/subfolder/2023%20sick%20tunes%20bro/pretend%20this%20longer/too-fast-too-furious-stems왂翸 symbols at the end, then cut off while the unc path would have the full S:\share\musicdepartment\subfolder\2023 sick tunes bro\pretend this longer\too-fast-too-furious-stems-because-fambly.aiff

If it matters, I've been running the script from a Windows environment, and yes, the %20 conversion of a 'space' does count against the 254 limit by 3 characters.

CronenbergRick avatar Jan 07 '24 19:01 CronenbergRick

dumping from Ubuntu instead of Windows doesn't alter the results.

CronenbergRick avatar Jan 07 '24 22:01 CronenbergRick

pyaaf has no path limits for urls it just treats them the same as any string property. Window does use a different encoding for stdout/err in terminals by default. I think it's cp1252 or something like that. That could be that messing it up somehow.

markreidvfx avatar Jan 08 '24 01:01 markreidvfx