first installation, testing it is giving me xml.elementtree parsing error as described below
Closed this issue · 20 comments
= Versions
youtube-upload: stable
python: 2.7.1
python-gdata:2.0.17
= Describe the steps (including the command you run) that will reproduce
the problem?
I installed gdata and used the test run and everything worked OK. Installed
also the youtube-upload and there were no errors. But when I actually tried to
upload it is giving me this problem. Please help, I don't know python and this
is my first time working with google apis.
Thank you in advance
A
$ youtube-upload --email=myemail@gmail.com --password="mypassword"
--title="Test01" --description="Intro" --category=Music --keywords="toto"
./file.flv
Login to Youtube API: email='myemail@gmail.com', password='****'
Traceback (most recent call last):
File "/usr/local/bin/youtube-upload", line 448, in <module>
sys.exit(catch_exceptions(EXIT_CODES, main_upload, sys.argv[1:]))
File "/usr/local/bin/youtube-upload", line 104, in catch_exceptions
fun(*args, **kwargs)
File "/usr/local/bin/youtube-upload", line 380, in main_upload
captcha_response=options.captcha_response)
File "/usr/local/bin/youtube-upload", line 182, in login
self.categories = self.get_categories()
File "/usr/local/bin/youtube-upload", line 254, in get_categories
xml = ElementTree.XML(xmldata)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1282, in XML
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1624, in feed
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1488, in _raiseerror
xml.etree.ElementTree.ParseError: undefined entity: line 1, column 39
Original issue reported on code.google.com by meleketm...@gmail.com
on 11 Sep 2012 at 3:47
cannot reproduce. Please insert this print in line 254 and paste here its
output:
xmldata = urllib.urlopen(cls.CATEGORIES_SCHEME).read()
print("xmldata", xmldata)
xml = ElementTree.XML(xmldata)
Original comment by tokland
on 11 Sep 2012 at 8:17
in my case i get this error when uploading files with long names (like "this is
a movie.mp4")
Original comment by sanderak...@gmail.com
on 17 Sep 2012 at 12:45
[deleted comment]
@sanderakkerman: I just tried with that filename and it worked ok. Please paste
the xmldata.
Original comment by tokland
on 17 Sep 2012 at 1:03
Guys, I need some feedback here...
Original comment by tokland
on 18 Sep 2012 at 7:46
- Changed state: Stalled
Issue 83 has been merged into this issue.
Original comment by tokland
on 29 Sep 2012 at 9:10
This is the result after placing the print in line 254
Login to Youtube API: email='test.for.utube@gmail.com', password='********'
('xmldata', "<?xml version='1.0' encoding='UTF-8'?><app:categories
xmlns:app='http://www.w3.org/2007/app' xmlns:atom='http://www.w3.org/2005/Atom'
xmlns:yt='http://gdata.youtube.com/schemas/2007' fixed='yes'
scheme='http://gdata.youtube.com/schemas/2007/categories.cat'><atom:category
term='Film' label='Film & Animation'
xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU BD BE BG BR CA
CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO
JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA SE SG SI SK SN
TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category><atom:category term='Autos'
label='Autos & Vehicles' xml:lang='en-US'><yt:assignable/><yt:browsable
regions='AE AR AU BD BE BG BR CA CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR
HK HR HU ID IE IL IN IR IS IT JO JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK
PL PT RO RS RU SA SE SG SI SK SN TH TN TR TW TZ UA UG US VN YE
ZA'/></atom:category><atom:category term='Music' label='Music'
xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU BD BE BG BR CA
CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO
JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA SE SG SI SK SN
TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category><atom:category
term='Animals' label='Pets & Animals'
xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU BD BE BG BR CA
CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO
JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA SE SG SI SK SN
TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category><atom:category term='Sports'
label='Sports' xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU
BD BE BG BR CA CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL
IN IR IS IT JO JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA
SE SG SI SK SN TH TN TR TW TZ UA UG US VN YE
ZA'/></atom:category><atom:category term='Shortmov' label='Short Movies'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category term='Travel'
label='Travel & Events' xml:lang='en-US'><yt:assignable/><yt:browsable
regions='AE AR AU BD BE BG BR CA CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR
HK HR HU ID IE IL IN IR IS IT JO JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK
PL PT RO RS RU SA SE SG SI SK SN TH TN TR TW TZ UA UG US VN YE
ZA'/></atom:category><atom:category term='Games' label='Gaming'
xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU BD BE BG BR CA
CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO
JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA SE SG SI SK SN
TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category><atom:category
term='Videoblog' label='Videoblogging'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category term='People'
label='People & Blogs' xml:lang='en-US'><yt:assignable/><yt:browsable
regions='AE AR AU BD BE BG BR CA CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR
HK HR HU ID IE IL IN IR IS IT JO JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK
PL PT RO RS RU SA SE SG SI SK SN TH TN TR TW TZ UA UG US VN YE
ZA'/></atom:category><atom:category term='Comedy' label='Comedy'
xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU BD BE BG BR CA
CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO
JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA SE SG SI SK SN
TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category><atom:category
term='Entertainment' label='Entertainment'
xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU BD BE BG BR CA
CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO
JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA SE SG SI SK SN
TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category><atom:category term='News'
label='News & Politics' xml:lang='en-US'><yt:assignable/><yt:browsable
regions='AE AR AU BD BE BG BR CA CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR
HK HR HU ID IE IL IN IR IS IT JO JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK
PL PT RO RS RU SA SE SG SI SK SN TH TN TR TW TZ UA UG US VN YE
ZA'/></atom:category><atom:category term='Howto' label='Howto & Style'
xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU BD BE BG BR CA
CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO
JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA SE SG SI SK SN
TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category><atom:category
term='Education' label='Education'
xml:lang='en-US'><yt:assignable/><yt:browsable regions='AE AR AU BD BE BG BR CA
CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR HK HR HU ID IE IL IN IR IS IT JO
JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK PL PT RO RS RU SA SE SG SI SK SN
TH TN TR TW TZ UA UG US VN YE ZA'/></atom:category><atom:category term='Tech'
label='Science & Technology' xml:lang='en-US'><yt:assignable/><yt:browsable
regions='AE AR AU BD BE BG BR CA CL CO CZ DE DK DZ EE EG ES ET FI FR GB GH GR
HK HR HU ID IE IL IN IR IS IT JO JP KE KR LT LV MA MX MY NG NL NO NZ PE PH PK
PL PT RO RS RU SA SE SG SI SK SN TH TN TR TW TZ UA UG US VN YE
ZA'/></atom:category><atom:category term='Nonprofit' label='Nonprofits &
Activism' xml:lang='en-US'><yt:assignable/><yt:browsable
regions='US'/></atom:category><atom:category term='Movies' label='Movies'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_anime_animation' label='Anime/Animation'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_action_adventure' label='Action/Adventure'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_classics' label='Classics'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_comedy' label='Comedy'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_documentary' label='Documentary'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_drama' label='Drama'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_family' label='Family'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_foreign' label='Foreign'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_horror' label='Horror'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_sci_fi_fantasy' label='Sci-Fi/Fantasy'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_thriller' label='Thriller'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Movies_shorts' label='Shorts'
xml:lang='en-US'><yt:deprecated/></atom:category><atom:category term='Shows'
label='Shows' xml:lang='en-US'><yt:deprecated/></atom:category><atom:category
term='Trailers' label='Trailers'
xml:lang='en-US'><yt:deprecated/></atom:category></app:categories>")
Install pycurl to upload the video using HTTP
Start upload using basic gdata API: test.mp4
[InvalidCategory] Invalid category 'test' (valid: Tech Education Animals People
Travel Entertainment Howto Sports Autos Music News Games Nonprofit Comedy Film)
Original comment by test.for...@gmail.com
on 1 Oct 2012 at 12:04
after changing the category to Tech it made the upload
but i remove the print("xmldata", xmldata) it gives the same error again
Original comment by test.for...@gmail.com
on 1 Oct 2012 at 12:11
[deleted comment]
wait, are you saying that it works with the print, but not if you remove it?
try then something like this:
xmldata = str(urllib.urlopen(cls.CATEGORIES_SCHEME).read())
Original comment by tokland
on 1 Oct 2012 at 12:14
should i put it instead of the print
and i accessed the youtube in order to watch the video it is still giving me
processing
Original comment by test.for...@gmail.com
on 1 Oct 2012 at 12:15
instead of the print (but try everything you can)
the still processing is normal, youtube takes a while.
Original comment by tokland
on 1 Oct 2012 at 12:17
and uploaded the same video but from the youtube website and it gave the state
processing only for 1 minute
Original comment by test.for...@gmail.com
on 1 Oct 2012 at 12:19
1st thank you a lot for ur help
then i would like to ask about the category why should i put a category and
when i upload a video it doesn't ask to choose one
how can i upload without choosing a category
Original comment by test.for...@gmail.com
on 1 Oct 2012 at 12:21
I made the Category compulsory because the API requires it. If you send with it:
gdata.youtube.service.YouTubeError: {'status': 400, 'body': "<?xml
version='1.0'
encoding='UTF-8'?><errors><error><domain>yt:validation</domain><code>required</c
ode><location
type='xpath'>media:group/media:category[@scheme='http://gdata.youtube.com/schema
s/2007/categories.cat']/text()</location></error></errors>", 'reason':
'Validation Failed'}
I don't know why the API requires it and the web interface don't.
Did it work with the str(...) ?
Original comment by tokland
on 1 Oct 2012 at 12:38
yes it worked with the str
can i change the upload code to not require the the category?
Original comment by test.for...@gmail.com
on 1 Oct 2012 at 12:51
> yes it worked with the str
ok, uploaded: r172
> can i change the upload code to not require the the category?
you can play with this:
media_group = gdata.media.Group(
title=gdata.media.Title(text=title),
description=gdata.media.Description(description_type='plain', text=description),
keywords=gdata.media.Keywords(text=keywords),
category=gdata.media.Category(
text=category,
label=self.categories[category],
scheme=self.CATEGORIES_SCHEME),
private=(gdata.media.Private() if private else None),
player=None)
But as I said I was unable to upload a video without category.
Original comment by tokland
on 1 Oct 2012 at 12:58
- Changed state: Fixed
is there a way to check if the file was uploaded successfully or not??
Original comment by test.for...@gmail.com
on 6 Oct 2012 at 9:00
> is there a way to check if the file was uploaded successfully or not??
you can wait till the file is processed: --wait-processing. Nothing more.
Original comment by tokland
on 6 Oct 2012 at 11:45
Original comment by tokland
on 13 May 2014 at 2:55