-2

I am building this project on two computers, windows 10 and ubuntu 18.04. Actually I never succeeded to fully use the ubuntu pc. Whenever I try to make a post request to the database I get this error:

    File "/home/user/venv1/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/home/user/venv1/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/user/venv1/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/user/venv1/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/user/venv1/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/user/venv1/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/user/venv1/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/user/venv1/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/user/venv1/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/user/venv1/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/user/venv1/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/user/venv1/lib/python3.6/site-packages/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/user/venv1/lib/python3.6/site-packages/flask/views.py", line 149, in dispatch_request
    return meth(*args, **kwargs)
  File "/home/user/venv1/lib/python3.6/site-packages/flask_apispec/annotations.py", line 117, in wrapped
    return wrapper(*args, **kwargs)
  File "/home/user/venv1/lib/python3.6/site-packages/flask_apispec/wrapper.py", line 29, in __call__
    response = self.call_view(*args, **kwargs)
  File "/home/user/venv1/lib/python3.6/site-packages/flask_apispec/wrapper.py", line 48, in call_view
    return self.func(*args, **kwargs)
  File "/home/user/venv1/lib/python3.6/site-packages/flask_security/decorators.py", line 216, in decorated_view
    return fn(*args, **kwargs)
//project related methods which work flawlessly
  File "/home/user/venv1/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 417, in get_or_404
    rv = self.get(ident)
  File "/home/user/venv1/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 882, in get
    ident, loading.load_on_ident)
  File "/home/user/venv1/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 893, in _get_impl
    if len(ident) != len(mapper.primary_key):
TypeError: object of type 'NoneType' has no len()

However I tried:

  1. pip freeze on the windows virtualenv, that's how I got the "good" versions, tried to configure the ubuntu's venv with the same but the error keeps appearing
  2. I tried without specifying the dependencies versions in my setup.py file but I got exactly the same error.

The mysql user I am using in the application has got all the privileges on the database. I am using Ver 14.14 Distrib 5.7.23, for Linux (x86_64). As I am newbie using Ubuntu 18.04 do I need to setup my mysql in some certain way?

gvlkn
  • 25
  • 6
  • can you connect to the db on Ubuntu with the credentials in question? – n8sty Sep 23 '18 at 19:58
  • Yes I can connect, I even get some results from the database, even some post requests are throwing a 200. It is strange I get this error on most of them while on windows, the same ones work perfectly. – gvlkn Sep 23 '18 at 20:05
  • does the same request succeed and fail intermittently or are the failures consistent? it would help to see some of what you've tried rather than just a stack trace. – n8sty Sep 23 '18 at 20:12
  • For future readers, this is a good example of why using something like Vagrant to set up development environments is a useful thing to do. It lets you keep track of system packages and the python dependencies explicitly. – shuttle87 Oct 27 '18 at 07:35

1 Answers1

0

I've installed mysql 8 and now works fine.

gvlkn
  • 25
  • 6