Python 3 issue in utility.py

Issue #39 resolved
Gfy repo owner created an issue
python pyrescene\bin\pyrescene.py --best -l -r "I:\The.French.Connection.1971.REMASTERED.1080p.BluRay.X264-AMIABLE" -o "C:\Users\whatever\Desktop\srrDB"
everything works fine till the Subs
Traceback (most recent call last):
  File "pyrescene\bin\pyrescene.py", line 1189, in <module>
    sys.exit(main())
  File "pyrescene\bin\pyrescene.py", line 1115, in main
    options, mthread)
  File "pyrescene\bin\pyrescene.py", line 734, in generate_srr
    new_srrs = create_srr_for_subs(unrar, esfv, working_dir, reldir)
  File "pyrescene\bin\pyrescene.py", line 500, in create_srr_for_subs
    for sfile in extract_and_create_srr(dest_file[:-4], first_rars):
  File "pyrescene\bin\pyrescene.py", line 459, in extract_and_create_srr
    with open(os.path.join(dest, efile), "r") as idx:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\whatever\\Ap
pData\\Local\\Temp\\tmpzxqe1s4b.pyReScene\\Subs\\the.french.connection.1971.rema
stered.1080p.bluray.x264-amiable.subs\\the.french.connection.1971.remastered.108
0p.bluray.x264-amiable.subs\\The.French.Connection.1971.REMASTERED.1080p.BluRay.
X264-AMIABLE.idx'

<Gfy> maybe the path becomes too long try pyrescene --vobsubs I:\The.French.Connection.1971.REMASTERED.1080p.BluRay.X264-AMIABLE\the.french.connection.1971.rematered.1080p.bluray.x264-amiable.subs.sfv

Traceback (most recent call last):
  File "pyrescene\bin\pyrescene.py", line 1189, in <module>
    sys.exit(main())
  File "pyrescene\bin\pyrescene.py", line 1084, in main
    os.path.dirname(sfv))
  File "pyrescene\bin\pyrescene.py", line 496, in create_srr_for_subs
    first_rars = get_start_rar_files([sfv])
  File "pyrescene\bin\pyrescene.py", line 327, in get_start_rar_files
    rescene.utility.parse_sfv_file(sfv)[0])
  File "C:\Users\whatever\Desktop\srrDB\pyrescene\rescene\utility.py", line 171,
 in parse_sfv_file
    parse(sfv_data)
  File "C:\Users\whatever\Desktop\srrDB\pyrescene\rescene\utility.py", line 134,
 in parse
    for line in file_data.split(b"\n"):
TypeError: Can't convert 'bytes' object to str implicitly

python-3.4.1.amd64.msi

2.7.7 ?
now it works with the --vobsubs
no error
and the regular way?
same error
it's probably the path

It worked after shortening the path using another temporary directory -t dir

Comments (7)

  1. vadmium

    My guess is there is an IOError which is being swallowed by the following code from the “parse_sfv_file” function. Then the code is trying to use the file name string as the SFV data!

    try:
        # Open and read sfv_file in binary mode
    except IOError:
        sfv_data = sfv_file
    

    I opened Pull Request #14 which should help see what the underlying IOError is.

  2. Gfy reporter

    I am only able to replicate that last error. For the first error I always see this:

    Total path and file name length must not exceed 260 characters
    Het systeem kan het opgegeven pad niet vinden.
    

    The Dutch translates to "The system can not find the path specified."

    After merging the pull request, I got this output:

    Traceback (most recent call last):
      File "MyPath\rescene\utility.py", line 165, in parse_sfv_file
        with open(sfv_file, mode='rb') as fsock:
    FileNotFoundError: [Errno 2] No such file or directory: 'D:\\my\\releasedir\\-t'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "MyPath\bin\pyrescene.py", line 1208, in <module>
        sys.exit(main())
      File "MyPath\bin\pyrescene.py", line 1103, in main
        os.path.dirname(sfv))
      File "MyPath\bin\pyrescene.py", line 504, in create_srr_for_subs
        first_rars = get_start_rar_files([sfv])
      File "MyPath\bin\pyrescene.py", line 335, in get_start_rar_files
        rescene.utility.parse_sfv_file(sfv)[0])
      File "MyPath\rescene\utility.py", line 170, in parse_sfv_file
        with open("\\\\?\\" + sfv_file, mode='rb') as fsock:
    FileNotFoundError: [Errno 2] No such file or directory: '\\\\?\\D:\\my\\releasedir\\-t'
    

    Then I noticed my parameters were wrong: pyrescene.py --vobsubs -t D:\tmp\ Subs\the.french.connection.1971.remastered.1080p.bluray.x264-amiable.subs.sfv

    Setting them properly gives the top error again. Currently it's not possible to generate the vobsubs SRR on Windows properly due to loo long paths in the temp folder. I also noticed these things:

    "Cannot create D:\tmp\tmp8jk40whv.pyReScene\Subs\the.french.connection.1971.remastered.1080p.bluray.x264-amiable.subs\the.french.connection.1971.remastered.1080p.bluray.x264-amiable.subs\The.French.Connection.1971.REMASTERED.1080p.BluRay.X264-AMIABLE\The.French.Connection.1971.REMASTERED.1080p.BluRay.X264-AMIABLE.sub"

    Why is the extra 'the.french.connection.1971.remastered.1080p.bluray.x264-amiable.subs' folder there?

    Stored files:
                  197  languages.diz
    

    The .diz file is there, so the .sub file was able to be read, but the .srr file for the .rar from the .sub file isn't there.

    A proper file is on srrdb, but that was generated on Linux: http://www.srrdb.com/release/details/The.French.Connection.1971.REMASTERED.1080p.BluRay.X264-AMIABLE

  3. Gfy reporter

    Main problem solved, but long paths are still an issue on Windows.

    this worked
    "C:\Python34\python" "pyrescene\bin\pyrescene.py" -r --best -l "F:\_rewatch\The.French.Connection.1971.REMASTERED.1080p.BluRay.X264-AMIABLE" -t "C:\_tmp"
    but this didn't
    "C:\Python34\python" "pyrescene\bin\pyrescene.py" -r --best -l "F:\_rewatch\The.French.Connection.1971.REMASTERED.1080p.BluRay.X264-AMIABLE"
    Traceback (most recent call last):
      File "pyrescene\bin\pyrescene.py", line 1210, in <module>
        sys.exit(main())
      File "pyrescene\bin\pyrescene.py", line 1136, in main
        options, mthread)
      File "pyrescene\bin\pyrescene.py", line 755, in generate_srr
        new_srrs = create_srr_for_subs(unrar, esfv, working_dir, reldir)
      File "pyrescene\bin\pyrescene.py", line 510, in create_srr_for_subs
        for sfile in extract_and_create_srr(dest_file[:-4], first_rars):
      File "pyrescene\bin\pyrescene.py", line 465, in extract_and_create_srr
        with open(os.path.join(dest, efile), "rb") as idx:
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\whatever\\Ap
    pData\\Local\\Temp\\tmpdxp2a9wo.pyReScene\\Subs\\the.french.connection.1971.rema
    stered.1080p.bluray.x264-amiable.subs\\the.french.connection.1971.remastered.108
    0p.bluray.x264-amiable.subs\\The.French.Connection.1971.REMASTERED.1080p.BluRay.
    X264-AMIABLE.idx'
    
  4. Gfy reporter

    "but that was generated on Linux" Not true. My temp path was probably still a few chars too long.

  5. Gfy reporter

    Similar problem on http://www.srrdb.com/release/details/The.Good.the.Bad.and.the.Ugly.1966.INTERNAL.EXTENDED.REMASTERED.BDRip.x264-ARCHiViST

    See also Issue 18 and Issue 49 for related subs problems.

    PS D:\Programs\Gfy-pyrescene-7f4d455a50a9\bin> python .\pyrescene.py \\diskstation\SCENE\XVID\The.Good.the.Bad.and.the.Ugly.1966.INTERNAL.EXTENDED.REMASTERED.BDRip.x264-ARCHiViST --best --output D:\Downloads\SRRs --temp-dir D:\Temp --always-yes
    \\diskstation\SCENE\XVID\The.Good.the.Bad.and.the.Ugly.1966.INTERNAL.EXTENDED.REMASTERED.BDRip.x264-ARCHiViST
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.rar.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r00.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r01.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r02.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r03.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r04.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r05.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r06.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r07.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r08.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r09.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r10.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r11.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r12.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r13.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r14.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r15.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r16.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r17.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r18.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r19.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r20.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r21.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r22.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r23.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r24.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r25.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r26.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r27.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r28.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r29.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r30.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r31.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r32.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r33.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r34.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r35.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r36.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r37.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r38.
    Processing file: the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.r39.
    Checking against the following main files:
            \\diskstation\SCENE\XVID\The.Good.the.Bad.and.the.Ugly.1966.INTERNAL.EXTENDED.REMASTERED.BDRip.x264-ARCHiViST\the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.rar
    File Details:   Size           CRC
                    -------------  --------
                        9,550,526  B1D01AFA
    
    
    Track Details:  Track  Length
                    -----  -------------
                        1      8,775,343
                        2        752,537
                        3             25
    
    Parse Details:  Metadata     Attachments   Track Data     Total
                    -----------  ------------  -------------  -------------
                         22,621             0      9,527,905      9,550,526
    
    Checking that sample exists in the specified full file...
    Check Complete. All tracks located.
    Successfully created SRS file: D:\Temp\tmpwob0xx.pyReScene\Sample\the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.sample.srs
    Traceback (most recent call last):
      File ".\pyrescene.py", line 1247, in <module>
        sys.exit(main())
      File ".\pyrescene.py", line 1163, in main
        result = generate_srr(reldir, working_dir, options, mthread)
      File ".\pyrescene.py", line 791, in generate_srr
        new_srrs = create_srr_for_subs(unrar, esfv, working_dir, reldir)
      File ".\pyrescene.py", line 539, in create_srr_for_subs
        for sfile in extract_and_create_srr(dest_file[:-4], first_rars):
      File ".\pyrescene.py", line 496, in extract_and_create_srr
        with open(os.path.join(dest, efile), "rb") as idx:
    IOError: [Errno 2] No such file or directory: u'D:\\Temp\\tmpwob0xx.pyReScene\\Subs\\the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.sub\\the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.sub\\the.good.the.bad.and.the.ugly.1966.internal.extended.remastered.bdrip.x264-archivist.idx'
    

    In the above case you could try to run pyReScene directly on the diskstation. It'll be faster too.

  6. Log in to comment