UPDATE: Note that while the accepted answer does fix the problem, it is somewhat useless since the servers for Google App Engine are constantly making too many Reddit API requests, preventing my program from ever doing anything.
I'm trying to put my python script (that uses PRAW) on the Google App Engine so that it will run periodically without my computer.
I initially ran into problems running locally (with dev_appserver.py) because of missing libraries, so I copied the necessary libraries over to my application's lib folder (which initially only contained flask).
Now I'm getting a problem with this line, but only on the live version (not when I test locally).
r = praw.Reddit(user_agent="some_agent")
Here's the traceback:
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 266, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/main.py", line 32, in update_pics
r = praw.Reddit(user_agent="fresh_pics")
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/praw/__init__.py", line 1067, in __init__
super(AuthenticatedReddit, self).__init__(*args, **kwargs)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/praw/__init__.py", line 536, in __init__
super(OAuth2Reddit, self).__init__(*args, **kwargs)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/praw/__init__.py", line 648, in __init__
super(UnauthenticatedReddit, self).__init__(*args, **kwargs)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/praw/__init__.py", line 316, in __init__
update_check(__name__, __version__)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/update_checker.py", line 170, in update_check
result = checker.check(package_name, package_version, **extra_data)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/update_checker.py", line 67, in wrapped
retval = function(obj, package_name, package_version, **extra_data)
File "/base/data/home/apps/s~river-acrobat-728/1.379380117832801085/lib/update_checker.py", line 121, in check
data['platform'] = platform.platform(True)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/platform.py", line 1603, in platform
libcname,libcversion = libc_ver(sys.executable)
File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/platform.py", line 163, in libc_ver
f = open(executable,'rb')
IOError: [Errno 2] No such file or directory: '/base/data/home/runtimes/python27/python27_dist/python'
I had the same issue and disabling updates worked for me:
r = praw.Reddit(user_agent='some_agent', disable_update_check=True)