49

This is using the Python SDK version 1.8.0.

My remote API works fine using remote_api_shell.py, but doesn't work when trying to accessing from within a python script. I'm using the sample code from google:

from google.appengine.ext.remote_api import remote_api_stub
import getpass

def auth_func():
  return (raw_input('Username:'), getpass.getpass('Password:'))

remote_api_stub.ConfigureRemoteApi(None, '/_ah/remote_api', auth_func,
                               'localhost:8080')

and I'm also importing the fix_sys_path() from dev_appserver.py to set my sys.path correctly for the google app engine SDK:

import dev_appserver
dev_appserver.fix_sys_path()

that adds, among other paths, the following line to my sys.path:

'/google_appengine_1.8.0/lib/fancy_urllib'

However, the following error is thrown when the above call to remote_api_stub.ConfigureRemoteApi() is called:

opener.add_handler(fancy_urllib.FancyProxyHandler())
AttributeError: 'module' object has no attribute 'FancyProxyHandler'
amport
  • 2,966
  • 2
  • 21
  • 34
drewlio
  • 667
  • 6
  • 9
  • 4
    It seems the google-provided `fix_sys_path()` does not correctly locate the `fancy_urllib` module. `fix_sys_path()` sets the path to: `/google_appengine/lib/fancy_urllib/` However, the module is actually located here: `/google_appengine/lib/fancy_urllib/fancy_urllib/` So I just copied the contents of the deepest `fancy_urllib` into the parent directory. This is a workaround and I don't like modifying the SDK like this. Anyone have a better solution? – drewlio May 26 '13 at 19:29
  • File a bug on the google issue tracker. https://code.google.com/p/googleappengine/issues/list – dragonx May 27 '13 at 15:08
  • Yes, this definitely seems like a bug and that those files belong one directory up in the hierarchy. Report the issue on the tracker. – Jeff Lockhart May 27 '13 at 19:54
  • 3
    Tried reproducing the problem and it seems to have disappeared with the current SDK (1.9.18) -- i.e, your sample code works fine now. Can you please check this and close the question...? – Alex Martelli Mar 12 '15 at 04:11

1 Answers1

2

Wait 7 years, and it all seems to work fine.

Konchog
  • 1,337
  • 12
  • 17