Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoneType is not callable in utils.py #11362

Open
max00xam opened this issue Dec 4, 2016 · 7 comments
Open

NoneType is not callable in utils.py #11362

max00xam opened this issue Dec 4, 2016 · 7 comments

Comments

@max00xam
Copy link

max00xam commented Dec 4, 2016

Error Type: <type 'exceptions.TypeError'>
    Error Contents: attribute of type 'NoneType' is not callable
    Traceback (most recent call last):
      File "ytdl_test.py", line 588, in <module>
        yt_download()
      File "ytdl_test.py", line 393, in yt_download
        result = ydl.extract_info(url, download=False)
      File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 694, in extract_info
        ie_result = ie.extract(url)
      File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 357, in extract
        return self._real_extract(url)
      File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 1436, in _real_extract
        upload_date = unified_strdate(upload_date)
      File "/usr/local/lib/python2.7/dist-packages/youtube_dl/utils.py", line 1118, in unified_strdate
        upload_date = datetime.datetime.strptime(date_str, expression).strftime('%Y%m%d')
    TypeError: attribute of type 'NoneType' is not callable

quick fix:

utils.py

1116    for expression in date_formats(day_first):
1117        try:
1118            upload_date = datetime.datetime.strptime(date_str, expression).strftime('%Y%m%d')
1119        except ValueError:
1120            pass
1121        except:     # added case for generic exception
1122            pass
@dstftw
Copy link
Collaborator

dstftw commented Dec 4, 2016

Post the full output of youtube-dl when run with -v, i.e. add -v flag to your command line, copy the whole output and post it in the issue body wrapped in ``` for better formatting. It should look similar to this:

$ youtube-dl -v <your command line>
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
[debug] youtube-dl version 2015.12.06
[debug] Git HEAD: 135392e
[debug] Python version 2.6.6 - Windows-2003Server-5.2.3790-SP2
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
[debug] Proxy map: {}
...

Do not post screenshots of verbose log only plain text is acceptable.

The output (including the first lines) contains important debugging information. Issues without the full output are often not reproducible and therefore do not get solved in short order, if ever.

@max00xam
Copy link
Author

max00xam commented Dec 4, 2016

It only appens in python script inside a Kodi addon... if you care I can post the full Kodi log and code excerpt

@dstftw
Copy link
Collaborator

dstftw commented Dec 4, 2016

I don't care about Kodi logs. You must post youtube-dl log. You pass 'verbose': True in params dict to YoutubeDL in order to enable verbosity programmatically.

@max00xam
Copy link
Author

max00xam commented Dec 4, 2016

here is the log with verbose enabled:

22:04:18 184726.625000 T:1642066928   ERROR: [debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out missing (instance), pref ANSI_X3.4-1968
22:04:18 184726.625000 T:1642066928  NOTICE: .
22:04:18 184726.625000 T:1642066928   ERROR: [debug] youtube-dl version 2016.11.04
22:04:18 184726.625000 T:1642066928  NOTICE: .
22:04:18 184726.687500 T:1642066928   ERROR: [debug] Python version 2.7.9 - Linux-4.4.27-5-osmc-armv7l-with-debian-8.6
22:04:18 184726.687500 T:1642066928  NOTICE: .
22:04:19 184727.062500 T:1642066928   ERROR: [debug] exe versions: avconv 11.8-6, avprobe 11.8-6
22:04:19 184727.062500 T:1642066928  NOTICE: .
22:04:19 184727.062500 T:1642066928   ERROR: [debug] Proxy map: {}
22:04:19 184727.062500 T:1642066928  NOTICE: .
22:04:21 184729.531250 T:1642066928  NOTICE: youtube_dl D [youtube] mpqdLqYYpoY: Downloading webpage
22:04:22 184730.359375 T:1642066928  NOTICE: youtube_dl D [youtube] mpqdLqYYpoY: Downloading video info webpage
22:04:22 184730.906250 T:1642066928  NOTICE: youtube_dl D [youtube] mpqdLqYYpoY: Extracting video information
22:04:23 184730.953125 T:1642066928   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.TypeError'>
                                            Error Contents: attribute of type 'NoneType' is not callable
                                            Traceback (most recent call last):
                                              File "/home/osmc/.kodi/addons/service.maxxam.teamwatch/service.py", line 589, in <module>
                                                tw.loop()
                                              File "/home/osmc/.kodi/addons/service.maxxam.teamwatch/service.py", line 394, in loop
                                                result = ydl.extract_info(url, download=False)
                                              File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 694, in extract_info
                                                ie_result = ie.extract(url)
                                              File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/common.py", line 357, in extract
                                                return self._real_extract(url)
                                              File "/usr/local/lib/python2.7/dist-packages/youtube_dl/extractor/youtube.py", line 1436, in _real_extract
                                                upload_date = unified_strdate(upload_date)
                                              File "/usr/local/lib/python2.7/dist-packages/youtube_dl/utils.py", line 1118, in unified_strdate
                                                upload_date = datetime.datetime.strptime(date_str, expression).strftime('%Y%m%d')
                                            TypeError: attribute of type 'NoneType' is not callable
                                            -->End of Python script error report<--

@dstftw
Copy link
Collaborator

dstftw commented Dec 4, 2016

Possibly related to this python bug.

@anohren
Copy link

anohren commented Mar 30, 2018

It would be great if this could be considered for a workaround.

I'm consistently running into this when using the SendToKodi plugin that suffers from it.

It didn't seem like it would be fixed in python any time soon, the last time I looked at that python bug link.

@laurentbacall
Copy link

I concur with @anohren
It'd be great to have a workaround for this python issue affecting youtube-dl for more than two years, as the python team won't budge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants