[Example code]-I am trying to upload a youtube video using the Youtube API with python
score:1
As already mentioned in one of my comments above, I suspect that you’re running your program on a computer that has at least two Python installations — each set up with own (separate) Google API Client Library for Python packages –, and that your program is actually running an old version of the client library.
I suggest to verify the version of the client library at run-time. Do that by inserting the following piece of code right at the beginning of main
function:
print('google-api-python-client version:',
get_googleapiclient_version())
where the function get_googleapiclient_version
is:
def get_googleapiclient_version():
try:
import googleapiclient
return googleapiclient.__version__
except AttributeError:
import pkg_resources
return pkg_resources.get_distribution(
"google-api-python-client").version
The version numbers shown should be newer than 1.6.7
from Apr 27, 2018.
The best would always be to make sure you’re running the latest version. (At the time of this writing that is 1.10.0
from Jul 15th.)
A caveat of function get_googleapiclient_version
above: using pkg_resources
is not one hundred percent a reliable method for obtaining a package’s version. In any case, the following piece of code prints the path of googleapiclient
:
print('google-api-python-client path:',
googleapiclient.__path__)
This may help troubleshoot the real origin of the client library your program is actually running.