Search code examples
pythonlibcurlpycurl

pycurl request exist in header function?


in C do return -1 when i want to cancel the download in either the header or the write function. In pycurl i get this error

pycurl.error: invalid return value for write callback -1 17

I dont know what the 17 means but what am i not doing correctly?


Solution

  • from pycurl.c:

    else if (PyInt_Check(result)) {
        long obj_size = PyInt_AsLong(result);
        if (obj_size < 0 || obj_size > total_size) {
            PyErr_Format(ErrorObject, "invalid return value for write callback %ld %ld", (long)obj_size, (long)total_size);
            goto verbose_error;
        }
    

    this would mean 17 is the total_size - is this possible ? and -1 (result) is what your callback is returning.