jjedMoriAnktah / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

Unexpected extension: PDF #158

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Need PDF upload support. Getting Unexpected extension: PDF on upload, but the 
Google docs clearly states the below:

Convert documents - up to 500 KB per file:
Microsoft Word (.doc, .docx), OpenDocument text (.odt), StarOffice text (.sxw)
Rich text (.rtf), Plain text (.txt), HTML (.htm, .html)
Convert presentations - up to 10 MB per file:
Microsoft PowerPoint (.ppt, .pps)
Convert spreadsheets - up to 1 MB per file:
Microsoft Excel (.xls, .xlsx) files, OpenDocument spreadsheets (.ods).
Comma-separated values (.csv)
Some features may not be fully supported when files are converted (for example, 
footnotes, tables of contents, tracked changes and comments, embedded graphs, 
pivot tables and slide animations). Files that you don't convert (maximum 25 MB 
per file) will count towards your storage limit.
Convert text from PDF or image files - up to 500 KB per file:
Photos, scanned documents, screenshots, etc. (.jpg, .gif, .png)
PDF files (.pdf)

Original issue reported on code.google.com by hemanth...@gmail.com on 23 Jun 2010 at 10:08

GoogleCodeExporter commented 9 years ago
I suspect you're using a gdata-python-client < 2.0. I just checked the 
libraries, and PDF support wasn't available for some releases of gdata, and 
thus wasn't in the SUPPORTED_FILETYPES dict defined in gdata.docs.service.

Though I just tried to upload a PDF, and while it found the correct mimetype, I 
got:

{'status': 415, 'body': 'Content-Type application/pdf is not a valid input 
type.', 'reason': 'Unsupported Media Type'}

Maybe PDF upload isn't supported through the API...

Original comment by tom.h.mi...@gmail.com on 23 Jun 2010 at 2:00

GoogleCodeExporter commented 9 years ago
I got the latest from http://code.google.com/p/gdata-python-client/ and install 
afresh, i'm still getting Unexpected extension: PDF, is it looking for some 
particular meta data? My file was a tex->ps->pdf file.

Original comment by hemanth...@gmail.com on 23 Jun 2010 at 2:12

GoogleCodeExporter commented 9 years ago
Here's the solution:

http://code.google.com/p/gdata-issues/issues/detail?id=591#c77

You need to edit that file in your version in the same way the commenter did

Original comment by childo...@gmail.com on 23 Jun 2010 at 4:57

GoogleCodeExporter commented 9 years ago
I followed the steps outlined in the link provided by childoftv above with 
regards to making changes to the service.py file.  I still cannot get it to 
work for PDF uploads to docs.  I have gdata-2.0.10 and googlecl-0.9.8 installed 
on Windows 7.  I get: 

{'status': 415, 'body': 'Content-Type application/pdf is not a valid input 
type.', 'reason': 'Unsupported Media Type'}

Original comment by elymiran...@gmail.com on 28 Jul 2010 at 3:55

GoogleCodeExporter commented 9 years ago
Hey  elymiranda1972 sorry about that...you also need to update the 
corresponding section in the google cl src/docs/service.py in the same way.

new_entry = self.Post(entry, post_uri, media_source=media,
                            extra_headers={'Slug': media.file_name,'GData-Version': 3}

(the 'GData-Version': 3 is what matters)

Original comment by childo...@gmail.com on 28 Jul 2010 at 9:06

GoogleCodeExporter commented 9 years ago
Also make sure that:

 post_uri = '/feeds/default/private/full'

in the upload_single_doc function

Original comment by childo...@gmail.com on 28 Jul 2010 at 9:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Bingo! That did it.  Thanks!

Original comment by elymiran...@gmail.com on 28 Jul 2010 at 10:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
r371 (finally) includes a non-hackish solution! Give it a try, let me know if 
you run into problems.

Original comment by tom.h.mi...@gmail.com on 9 Aug 2010 at 5:13