zopefoundation / zope.sqlalchemy

Integration of SQLAlchemy with transaction management
Other
32 stars 34 forks source link

AttributeError: 'NoneType' object has no attribute '_instantiate_plugins' #48

Closed JoyVehmeijer closed 4 years ago

JoyVehmeijer commented 4 years ago

I'm trying to run a python file for a lecture, but I keep getting an error:

AirvanGruiker18:src3 gebruiker$ python list.py
Traceback (most recent call last):
  File "list.py", line 6, in <module>
    engine = create_engine(os.getenv("DATABASE_URL"))
  File "/Users/gebruiker/Library/Python/2.7/lib/python/site-packages/sqlalchemy/engine/__init__.py", line 488, in create_engine
    return strategy.create(*args, **kwargs)
  File "/Users/gebruiker/Library/Python/2.7/lib/python/site-packages/sqlalchemy/engine/strategies.py", line 56, in create
    plugins = u._instantiate_plugins(kwargs)
AttributeError: 'NoneType' object has no attribute '_instantiate_plugins'

Does anybody know what the problem is and how I can fix it?

jamadden commented 4 years ago

The u variable is assigned u = url.make_url(name_or_url). So I suspect that the DATABASE_URL in your environment is wrong.

JoyVehmeijer commented 4 years ago

The u variable is assigned u = url.make_url(name_or_url). So I suspect that the DATABASE_URL in your environment is wrong.

To what would I have to change it? A file I already have on my computer?

jamadden commented 4 years ago

I have absolutely no idea, that's up to you and depends on what you're trying to do.

This doesn't seem like an issue in zope.sqlalchemy, so the issue should probably be closed.

JoyVehmeijer commented 4 years ago

Oke thank you! Sorry I'm quite new at this, so I'm still trying to figure things out.

mgedmin commented 4 years ago

To be fair, this is an atrocious error message. I would file an sqlalchemy bug asking it to report a better error (and ideally print the bad database URL value).

JoyVehmeijer commented 4 years ago

To be fair, this is an atrocious error message. I would file an sqlalchemy bug asking it to report a better error (and ideally print the bad database URL value).

Thank you for the tip! I will try this and hopefully there will be something to fix this problem