Does nitrous.io support the endpoint library? - python

Developing a python project on the platform and attempting appengine endpoints.
import endpoints throws google.appengine.api.yaml_errors.EventError: the library "endpoints" is not supported. The full stack trace is below.
Traceback (most recent call last):
File "/home/action/.google_appengine/dev_appserver.py", line 182, in <module>
_run_file(__file__, globals())
File "/home/action/.google_appengine/dev_appserver.py", line 178, in _run_file
execfile(script_path, globals_)
File "/home/action/.google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 695, in <module>
main()
File "/home/action/.google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 688, in main
dev_server.start(options)
File "/home/action/.google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 525, in start
options.yaml_files)
File "/home/action/.google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 556, in __init__
server_configuration = ServerConfiguration(yaml_path)
File "/home/action/.google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 82, in __init__
self._yaml_path)
File "/home/action/.google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 272, in _parse_configuration
return appinfo_includes.ParseAndReturnIncludePaths(f)
File "/home/action/.google_appengine/google/appengine/api/appinfo_includes.py", line 63, in ParseAndReturnIncludePaths
appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
File "/home/action/.google_appengine/google/appengine/api/appinfo.py", line 1715, in LoadSingleAppInfo
listener.Parse(app_info)
File "/home/action/.google_appengine/google/appengine/api/yaml_listener.py", line 226, in Parse
self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
File "/home/action/.google_appengine/google/appengine/api/yaml_listener.py", line 177, in _HandleEvents
raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: the library "endpoints" is not supported
in "./app.yaml", line 21, column 1

Start with a non-python project.
Download appengine for Linux python:
curl -O http://googleappengine.googlecode.com/files/google_appengine_1.8.9.zip
Unzip and export directory in ~/.bash_profile:
export PATH="$HOME/google_appengine:$PATH"
Build endpoint python app as described and run dev_appserver.py.
You can't view the Google APIs Explorer when launched from Nitrous.io, unless you port forward, but you can still use as a developing endpoint.

Related

TypeError from pkg_resources when using static assets in Pyramid

Trying to set up static assets on a Pyramid app. I used the following call:
config.add_static_view(name='static', path='toolsofknowledge:static')
The file main.css is stored under toolsofknowledge/static/main.css, as expected. The toolsofknowledge package is installed locally with an editable link, using pip3 install -e ..
Requesting http://localhost:8080/static/main.css with curl causes this exception on the server:
amoe#cslp019129 $ PYRAMID_RELOAD_TEMPLATES=1 pserve3 --reload development.ini
Starting monitor for PID 3796.
Starting server in PID 3796.
Serving on http://localhost:8080
Serving on http://localhost:8080
ERROR:waitress:Exception when serving /static/main.css
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pyramid/tweens.py", line 13, in _error_handler
response = request.invoke_exception_view(exc_info)
File "/usr/lib/python3/dist-packages/pyramid/view.py", line 769, in invoke_exception_view
raise HTTPNotFound
pyramid.httpexceptions.HTTPNotFound: The resource could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/waitress/channel.py", line 336, in service
task.service()
File "/usr/lib/python3/dist-packages/waitress/task.py", line 175, in service
self.execute()
File "/usr/lib/python3/dist-packages/waitress/task.py", line 452, in execute
app_iter = self.channel.server.application(env, start_response)
File "/usr/lib/python3/dist-packages/pyramid/router.py", line 270, in __call__
response = self.execution_policy(environ, self)
File "/usr/lib/python3/dist-packages/pyramid/router.py", line 279, in default_execution_policy
return request.invoke_exception_view(reraise=True)
File "/usr/lib/python3/dist-packages/pyramid/view.py", line 768, in invoke_exception_view
reraise_(*exc_info)
File "/usr/lib/python3/dist-packages/pyramid/compat.py", line 179, in reraise
raise value
File "/usr/lib/python3/dist-packages/pyramid/router.py", line 277, in default_execution_policy
return router.invoke_request(request)
File "/usr/lib/python3/dist-packages/pyramid/router.py", line 249, in invoke_request
response = handle_request(request)
File "/usr/lib/python3/dist-packages/pyramid/tweens.py", line 43, in excview_tween
response = _error_handler(request, exc)
File "/usr/lib/python3/dist-packages/pyramid/tweens.py", line 17, in _error_handler
reraise(*exc_info)
File "/usr/lib/python3/dist-packages/pyramid/compat.py", line 179, in reraise
raise value
File "/usr/lib/python3/dist-packages/pyramid/tweens.py", line 41, in excview_tween
response = handler(request)
File "/usr/lib/python3/dist-packages/pyramid/router.py", line 148, in handle_request
registry, request, context, context_iface, view_name
File "/usr/lib/python3/dist-packages/pyramid/view.py", line 657, in _call_view
response = view_callable(context, request)
File "/usr/lib/python3/dist-packages/pyramid/viewderivers.py", line 401, in viewresult_to_response
result = view(context, request)
File "/usr/lib/python3/dist-packages/pyramid/static.py", line 102, in __call__
if resource_isdir(self.package_name, resource_path):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1138, in resource_isdir
return get_provider(package_or_requirement).resource_isdir(
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 364, in get_provider
return _find_adapter(_provider_factories, loader)(module)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1392, in __init__
self.module_path = os.path.dirname(getattr(module, '__file__', ''))
File "/usr/lib/python3.7/posixpath.py", line 156, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Python 3.7, Pyramid 1.10.2.
Solution: add __init__.py to toolsofknowledge directory.
The problem is quite simple -- the toolsofknowledge package was not a real package, despite being installed, as it was missing an __init__.py. This causes toolsofknowledge.__loader__ to be an instance of NamespaceLoader, when it should be SourceFileLoader. Obviously, pkg_resources cannot resolve resources relative to something that's not a real package. Arguably it should handle this case more smoothly though.

Calling SOAP web service by Python WSDL library error

I have the following python program on Python 2.7 that uses python WDSL library.
>>> from SOAPpy import WSDL
>>> wsdlFile = 'my_wsdl_file_path'
>>> server = WSDL.Proxy(wsdlFile)
And I get below error;
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/pymodules/python2.7/SOAPpy/WSDL.py", line 62, in __init__
self.wsdl = reader.loadFromStream(stream, wsdlsource)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/WSDLTools.py", line 34, in loadFromStream
wsdl.load(document)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/WSDLTools.py", line 260, in load
schema = reader.loadFromNode(WSDLToolsAdapter(self), item)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 80, in loadFromNode
schema.load(reader)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1088, in load
self.addImportSchema(tp.getSchema())
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1205, in getSchema
self._schema = reader.loadFromURL(url)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 114, in loadFromURL
schema.load(reader)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1120, in load
tp.fromDom(node)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 1764, in fromDom
self.setAttributes(node)
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 627, in setAttributes
self.__checkAttributes()
File "/usr/lib/pymodules/python2.7/SOAPpy/wstools/XMLSchema.py", line 681, in __checkAttributes
%(self.getItemTrace(), a, self.attributes[a])
SOAPpy.wstools.XMLSchema.SchemaError: <schema targetNamespace="http://tempuri.org/DataSetGW4.xsd"><element name="DataSetGW4">, unknown attribute(urn:schemas-microsoft-com:xml-msdata,{u'IsDataSet': u'true', u'UseCurrentLocale': u'true'})
what could be the reason?
My experience with SOAPpy is that it is not as complete nor tolerant as Suds. Maybe you should try parsing your WSDL file with suds instead.
import suds.client as client
session = client.Client('file:///absolute/path/to/yourwsdl')

define proxy for pysetup

i'm trying to install a python package on RHEL5 (old i know).
[root#myhost~]# pysetup install shyaml
Checking the installation location...
Getting information about 'shyaml'...
extensions in requires.txt are not supported (used by u'pip' 6.0.6)
Traceback (most recent call last):
File "/usr/bin/pysetup", line 5, in ?
pkg_resources.run_script('Distutils2==1.0a4', 'pysetup')
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 407, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1084, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/EGG-INFO/scripts/pysetup", line 4, in ?
sys.exit(main())
File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/run.py", line 651, in main
return dispatcher()
File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/run.py", line 639, in __call__
return func(self, self.args)
File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/run.py", line 91, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/run.py", line 167, in _install
return not install(target)
File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/install.py", line 515, in install
info = get_infos(project)
File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/install.py", line 339, in get_infos
release = index.get_release(requirements)
File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/pypi/wrapper.py", line 40, in decorator
raise exception
socket.error: (101, 'Network is unreachable')
This is ok, because this host does not have access to the internet but has access via http proxy. But i can't find anything how to configure pysetup for http proxy.
I already tried exporting the proxy variables wget/curl style:
http_proxy=http://proxyhost:3128
HTTP_PROXY=http://proxyhost:3128
https_proxy=http://proxyhost:3128
HTTPS_PROXY=http://proxyhost:3128
Any idea?

GAE can't generate discovery file

I upgraded my GAE SDK to Version 1.8.5 and cannot generate a discovery file anymore with endpointscfg.py gen_discovery_doc -o.-f rpc .../main.FlyFlap.APi
I get the errors below.
I tried to delete the file google_appengine/lib/cacerts/urlfetch_cacerts.txt and certs.txt like it is suggested here, but it didn't help. Does someone got same problems?
Traceback (most recent call last):
File "/usr/local/bin/endpointscfg.py", line 196, in <module>
run_file(__file__, globals())
File "/usr/local/bin/endpointscfg.py", line 192, in run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 472, in <module>
sys.exit(main(sys.argv))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 467, in main
args.callback(args)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 348, in _GenDiscoveryDocCallback
output_path, hostname=hostname)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 188, in GenDiscoveryDoc
service_configs = GenApiConfig(service_class_names, hostname=hostname)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 144, in GenApiConfig
module_name, base_service_class_name = service_class_name.rsplit('.', 1)
ValueError: need more than 1 value to unpack
updated osx and it works again.

App Engine Start Up Errors

Google App Engine won't start due to errors. The information below is from the error log file created by the app engine. How can I fix this?
>Traceback (most recent call last):
> File "GoogleAppEngineLauncher.py", line 42, in <module>
> File "wx\_core.pyc", line 7913, in __init__
> File "wx\_core.pyc", line 7487, in _BootstrapApp
> File "launcher\app.pyc", line 53, in OnInit
> File "launcher\app.pyc", line 98, in _CreateModels
> File "launcher\preferences.pyc", line 68, in __init__
> File "launcher\preferences.pyc", line 72, in Load
> File "ConfigParser.pyc", line 267, in read
> File "ConfigParser.pyc", line 462, in _read
>ConfigParser.MissingSectionHeaderError: File contains no section headers.
>file: C:\Users\Lennart/Google\google_appengine_launcher.ini, line: 1
>'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
>x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
>\x00\x00\x00\x00\x00\x00\x00\x00\x00'
app.yaml file in the application route? That is the type of error you would get if the app file were missing

Categories

Resources