chenqingyu / auto-sub

Automatically exported from code.google.com/p/auto-sub
0 stars 0 forks source link

"source" re.sub fails on default None #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It seems that a non-matching groupdict() can cause source to be None, which 
throws the error below. I'm using Python 2.6 on AutoSub 0.3.
Note: I don't code Python, but a similar issue might pop up on line 85.

nas> python2.6 AutoSub.py 
Traceback (most recent call last):
  File "AutoSub.py", line 130, in <module>
    sys.exit(main())
  File "AutoSub.py", line 92, in main
    wantedQueue = LocalDisk.scanDir(config.rootpath)
  File "/volume1/AutoSub/LocalDisk.py", line 74, in scanDir
    filenameResults = Helpers.ProcessFileName(filename)
  File "/volume1/AutoSub/Helpers.py", line 74, in ProcessFileName
    source = re.sub("[. _-]", "-", source)  
  File "/opt/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
TypeError: expected string or buffer

Tail of log:
2011-10-26 21:09:41,754 DEBUG  scanDir: File 
Lost.Girl.S01E08.Vexed.WEB-DL.AAC2.0.H264.mkv does not yet have a srt file

2011-10-26 21:09:41,757 DEBUG  ProcessFileName: Hit with a regex, dumping it 
for debug purpose: {'episode': '08', 'title': 'lost.girl', 'season': '01', 
'extra_ep_num': None, 'releasegrp': 'dl.aac2.0.h264', 'source': None, 
'quality': None, 'extra_info': 'vexed.web'}

Original issue reported on code.google.com by martijnp...@gmail.com on 26 Oct 2011 at 7:26

GoogleCodeExporter commented 9 years ago
Thank you for reporting this issue, we have noticed this problem too. Will 
release a fix soon.

Original comment by romke.va...@gmail.com on 26 Oct 2011 at 10:30

GoogleCodeExporter commented 9 years ago

Original comment by romke.va...@gmail.com on 27 Oct 2011 at 11:41

GoogleCodeExporter commented 9 years ago
This issue was closed by revision f2061a0ceca5.

Original comment by romke.va...@gmail.com on 27 Oct 2011 at 11:42