Croydon / flask-xml-rpc-reloaded

This is a library that lets your Flask apps provide XML-RPC APIs. OPEN FOR PULL REQUESTS.
https://pypi.org/project/Flask-XML-RPC-Re/
MIT License
8 stars 4 forks source link

Unable to import module #8

Open abnerjacobsen opened 5 years ago

abnerjacobsen commented 5 years ago

Hi,

I'm trying to use flask-xml-rpc-reloaded but got this error every time I call my Flaqsk app:

* Serving Flask app "main.py" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://0.0.0.0:80/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 287-775-524
192.168.64.1 - - [21/Nov/2018 21:17:18] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 325, in __call__
    self._flush_bg_loading_exception()
  File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 313, in _flush_bg_loading_exception
    reraise(*exc_info)
  File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 302, in _load_app
    self._load_unlocked()
  File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 317, in _load_unlocked
    self._app = rv = self.loader()
  File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 372, in load_app
    app = locate_app(self, import_name, name)
  File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 242, in locate_app
    '\n\n{tb}'.format(name=module_name, tb=traceback.format_exc())
NoAppException: While importing "main", an ImportError was raised:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/flask/cli.py", line 235, in locate_app
    __import__(module_name)
  File "/app/main.py", line 2, in <module>
    from flask_xmlrpcre import XMLRPCHandler, Fault
ImportError: cannot import name XMLRPCHandler

Testing using python colse got the same error:

# python
Python 2.7.15 (default, Oct 16 2018, 07:58:03) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from flask_xmlrpcre import XMLRPCHandler, Fault
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name XMLRPCHandler

Someone can help me in this issue ?

Regards,

Croydon commented 5 years ago

I believe this was a typo which got fixed in the meantime. Could you please re-try with 0.1.4?

Croydon commented 5 years ago

@abnerjacobsen Ping

ohlen1 commented 5 years ago

I am experiencing the same problem when trying to run a simple demo application. I'm using python3:

$ python3 --version
Python 3.7.3

Test code:

from flask import Flask, request
from flask_xmlrpcre import XMLRPCHandler, Fault

app = Flask(__name__)

handler = XMLRPCHandler('api')
handler.connect(app, '/api')

@handler.register
def hello(name="world"):
    if not name:
        raise Fault("unknown_recipient", "I need someone to greet!")
    return "Hello, %s!" % name

app.run()

Console output:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from flask_xmlrpcre import XMLRPCHandler, Fault
ImportError: cannot import name 'XMLRPCHandler' from 'flask_xmlrpcre' (/my/pth/env/lib/python3.7/site-packages/flask_xmlrpcre/__init__.py)

@Croydon if there is a known workaround for this, I'd appreciate to know about it.

abnerjacobsen commented 5 years ago

@Croydon I left the project where your library was being tested, and I can not confirm they continue to use it and if the problem is solved.

Anyway, thanks for your feedback.