thanos / django-googledata

exported from my original code at code.google.com/p/django-googledata
0 stars 0 forks source link

host error on save #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create the project as shown in the wiki (app name is picasatest)
2. open http://localhost:8000/admin/picasatest/image/add/
3. select file, and click save

What is the expected output? What do you see instead?
I expect my file saved at picasa
I get 
socket.gaierror
gaierror: [Errno -2] Name or service not known

Please provide any additional information below.
the last line of the traceback's this:
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known
>>> host
u'picasaweb.google.comdefault'

I notice the foldername's right after the .com, with no / or anything.. think 
that might be the problem there

Django version 1.2.5, using settings 'testsite.settings'
Development server is running at http://127.0.0.1:8000/
Using the Werkzeug debugger (http://werkzeug.pocoo.org/)
Quit the server with CONTROL-C.
Traceback (most recent call last):
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 674, in __call__
    return self.application(environ, start_response)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 248, in __call__
    response = self.get_response(request)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/core/handlers/base.py", line 141, in get_response
    return self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/core/handlers/base.py", line 165, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/core/handlers/base.py", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/contrib/admin/options.py", line 288, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/utils/decorators.py", line 76, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/views/decorators/cache.py", line 78, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/contrib/admin/sites.py", line 190, in inner
    return view(request, *args, **kwargs)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/utils/decorators.py", line 21, in _wrapper
    return decorator(bound_func)(*args, **kwargs)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/utils/decorators.py", line 76, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/utils/decorators.py", line 17, in bound_func
    return func(self, *args2, **kwargs2)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/db/transaction.py", line 299, in _commit_on_success
    res = func(*args, **kw)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/contrib/admin/options.py", line 853, in add_view
    self.save_model(request, new_object, form, change=False)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/contrib/admin/options.py", line 655, in save_model
    obj.save()
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/db/models/base.py", line 458, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/db/models/base.py", line 541, in save_base
    for f in meta.local_fields if not isinstance(f, AutoField)]
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/db/models/fields/files.py", line 255, in pre_save
    file.save(file.name, file, save=False)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/db/models/fields/files.py", line 92, in save
    self.name = self.storage.save(name, content)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/core/files/storage.py", line 47, in save
    name = self.get_available_name(name)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django/core/files/storage.py", line 73, in get_available_name
    while self.exists(name):
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django_picasa-1.3-py2.6.egg/picasa/storage.py", line 54, in exists
    photo = self.url(filename)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django_picasa-1.3-py2.6.egg/picasa/storage.py", line 103, in url
    return self.entry(filename).GetMediaURL()
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django_picasa-1.3-py2.6.egg/picasa/storage.py", line 106, in entry
    return self.get('entry', id, self.gdclient.GetEntry)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/django_picasa-1.3-py2.6.egg/picasa/storage.py", line 138, in get
    obj = getter(id, *args, **kwa)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/gdata/photos/service.py", line 205, in GetEntry
    return self.Get(uri, converter=gdata.photos.AnyEntryFromString)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/gdata/service.py", line 1069, in Get
    headers=extra_headers)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/atom/__init__.py", line 93, in optional_warn_function
    return f(*args, **kwargs)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/atom/service.py", line 186, in request
    data=data, headers=all_headers)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/gdata/auth.py", line 725, in perform_request
    return http_client.request(operation, url, data=data, headers=headers)
  File "/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packages/atom/http.py", line 163, in request
    connection.endheaders()
  File "/usr/lib/python2.6/httplib.py", line 908, in endheaders
    self._send_output()
  File "/usr/lib/python2.6/httplib.py", line 780, in _send_output
    self.send(msg)
  File "/usr/lib/python2.6/httplib.py", line 739, in send
    self.connect()
  File "/usr/lib/python2.6/httplib.py", line 1112, in connect
    sock = socket.create_connection((self.host, self.port), self.timeout)
  File "/usr/lib/python2.6/socket.py", line 547, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known

Original issue reported on code.google.com by lacrymol...@gmail.com on 8 Jul 2011 at 10:28

GoogleCodeExporter commented 8 years ago
Debugging a while I tracked this down to these possible issues:

site-packages/atom/service.py(155)request()
-> if url.startswith('http:') and self.ssl:
(Pdb) url
u'default/logo-clowdy.png'
(Pdb) l
[...]
158           elif not url.startswith('http') and self.ssl: 
159             url = atom.url.parse_url('https://%s%s' % (self.server, url))

there you can see how the incoming url should have the heading '/' in it.
But I still see no login details, this can be a problem too.

Further up the backtrace, I can see this.
> 
/home/lacrymology/workspace/django/django-cms-site/venv/lib/python2.6/site-packa
ges/gdata/service.py(1069)Get()
(1060)
    if self.__gsessionid is not None:
      if uri.find('gsessionid=') < 0:
        if uri.find('?') > -1:
          uri += '&gsessionid=%s' % (self.__gsessionid,)
        else:
          uri += '?gsessionid=%s' % (self.__gsessionid,)
(Pdb) self.__gsessionid
*** AttributeError: 'PhotosService' object has no attribute '__gsessionid'

I don't understand why it doesn't die before in that test, but I gather this 
might be the origin of the problem

Original comment by lacrymol...@gmail.com on 8 Jul 2011 at 10:48

GoogleCodeExporter commented 8 years ago
adding a heading / to the upload_to option works around this issue, but adds a 
/ to the album in picasa

Original comment by lacrymol...@gmail.com on 8 Jul 2011 at 10:53

GoogleCodeExporter commented 8 years ago
Confirm same issue and same work-around.

Original comment by davemccloskey on 4 Jan 2013 at 5:36