python-opensubtitles icon indicating copy to clipboard operation
python-opensubtitles copied to clipboard

Python3 upload error

Open HelloThere4587 opened this issue 5 years ago • 2 comments

Hello there,

I have issues uploading subtitles, my code is simple:

... 
if not already_in_db:
    params = {'baseinfo': {
        'idmovieimdb': imdb_id
    },
        'cd1': {
            'subhash': sub_hash,
            'subfilename': filename,
            'subcontent': get_gzip_base64_encoded(file)
        }}
    url = ost.upload_subtitles(params)

And I have the project using the setup.py file installed and use Python 3.7 on Debian 10.

The issue is that the upload does not work (instead of the url None is returned) and if I use the debugger I get the following output:

error The file is located in /usr/lib/python3.7/xmlrpc/client.py .

But the code runs without issues if I use Python2 instead.

I hope this helps fixing the issue and thank you for this project 😃

HelloThere4587 avatar Nov 12 '19 17:11 HelloThere4587

Sorry @HelloThere4587, I completely missed this issue.

Did you manage to make it work somehow with python 3? If not, could you provide all the test info: hashes, gzip of the subtitle, etc... that you used to reach that point where it fails?

agonzalezro avatar Apr 19 '20 13:04 agonzalezro

Hi,

I got similar issue. And I fix it with this method :

if not already_in_db:
    params = {'baseinfo': {
        'idmovieimdb': imdb_id
    },
        'cd1': {
            'subhash': sub_hash,
            'subfilename': filename,
            'subcontent': str(get_gzip_base64_encoded(file)) # add str here.
        }}
    url = ost.upload_subtitles(params)

MrCirdo avatar Dec 20 '21 21:12 MrCirdo