Note that there are some explanatory texts on larger screens.

plurals
  1. POTypeError when trying to upload Pictures from Google App Engine to Picasa with the GData API
    primarykey
    data
    text
    <p>I'm trying to write a small tool to upload Pictures from Google App Engine to Picasa. Fetching the image works, but when i try to upload it i get the error "<em>TypeError: stat() argument 1 must be (encoded string without NULL bytes), not str</em>" </p> <p>The Code basically looks like this:</p> <pre><code>def getfile(url): result = urlfetch.fetch(url) if result.status_code == 200: return (result.content) logging.error ("[-] Error fetching URL: %s" % url) def uploadpicture(comment,pic): album_url = '/data/feed/api/user/%s/album/%s' % (username, album) fname = "image.jpg" entry = gd_client.InsertPhotoSimple(album_url, fname, comment, pic, content_type='image/jpeg') picurl = "http://brilliantleap.com/blog/frog.jpg" pic = getfile(picurl) comment = "Test" uploadpicture(comment, pic) </code></pre> <p>The full Stacktrace is:</p> <p>Traceback (most recent call last):</p> <p>File "/home/birt/stuff/google/appengine/ext/webapp/<strong>init</strong>.py", line 507, in <strong>call</strong> handler.get(*groups)</p> <p>File "/home/birt/stuff/app_picasaupload/main.py", line 124, in get uploadpicture(comment, pic)</p> <p>File "/home/birt/stuff/app_picasaupload/main.py", line 104, in uploadpicture entry = gd_client.InsertPhotoSimple(album_url, fname, comment, pic, content_type='image/jpeg')</p> <p>File "/home/birt/stuff/app_picasaupload/gdata/photos/service.py", line 469, in InsertPhotoSimple content_type)</p> <p>File "/home/birt/stuff/app_picasaupload/gdata/photos/service.py", line 398, in InsertPhoto os.path.exists(filename_or_handle): # it's a file name</p> <p>File "/usr/lib/python2.5/posixpath.py", line 171, in exists st = os.stat(path)</p> <p>File "/home/birt/stuff/google/appengine/tools/dev_appserver.py", line 1109, in <strong>call</strong> if not FakeFile.IsFileAccessible(path):</p> <p>File "/home/birt/stuff/google/appengine/tools/dev_appserver.py", line 1018, in IsFileAccessible normcase=normcase)</p> <p>File "/home/birt/stuff/google/appengine/tools/dev_appserver.py", line 1036, in _IsFileAccessibleNoCache if os.path.isdir(logical_filename):</p> <p>File "/usr/lib/python2.5/posixpath.py", line 195, in isdir st = os.stat(path)</p> <p>TypeError: stat() argument 1 must be (encoded string without NULL bytes), not str</p> <p>Any Ideas ? :-)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload