1

I'm using Jython on Google App Engine, but I can't get 'import urlfetch' to work. Other imports like 'import sys' and 'import zlib' work, but not 'import urlfetch'. I get a 500 Server Error. What am I doing wrong?

The error messages in my dashboard log are:

1) javax.servlet.ServletContext log: debug: Callable object not in cache

2) Error for /java.lang.ExceptionInInitializerError

3) Nested in java.lang.ExceptionInInitializerError:java.security.AccessControlException:access denied (java.lang.RuntimePermission modifyThreadGroup)

4) Uncaught exception from servlet

java.lang.ExceptionInInitializerError

I also tried switching threadsafe to both false and true, but neither seems to have any effect (I saw somewhere that there might be a problem with jython and threadsafe=TRUE).

Thanks for any help you can give me!

Dhara
  • 4,093
  • 2
  • 36
  • 69

1 Answers1

1

Have you tried:

from google.appengine.api import urlfetch

As from this:

You can use the Python standard libraries urllib, urllib2 or httplib to make HTTP requests. When running in App Engine, these libraries perform HTTP requests using App Engine's URL fetch service, which runs on Google's scalable HTTP request infrastructure.

I read that it's not the "normal" urlfetch in use in GAE.

https://developers.google.com/appengine/docs/python/urlfetch/overview

Paul Collingwood
  • 9,053
  • 3
  • 23
  • 36
  • Thanks, yes I have been using 'from google.appengine.api import urlfetch', but it doesn't work. When I try to import urlfetch, urllib, or urllib2, I get errors. Could this be something on Google's side? Are they not allowing jython to use functions that try to make HTTP requests? – user1937362 Feb 16 '13 at 00:41