AttributeError: 'int' object has no attribute '_compiler_dispatch' - flask

I am using the flask-sqlalchemy extension with alembic for migrations. When I try to add a new migration file and upgrade the schema to the latest one, I get the following error:
AttributeError: 'int' object has no attribute '_compiler_dispatch'
The content of the migration file:
revision = 'ec2c2d40eb1'
down_revision = '28dda873b826'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column(
'users',
'wiki_permission',
new_column_name='wiki_group',
nullable=False,
existing_nullable=False,
type_=sa.Integer(),
existing_type=sa.Integer(),
server_default=1,
existing_server_default=1 # Line of error - 27
)
def downgrade():
op.alter_column(
'users',
'wiki_group',
new_column_name='wiki_permission',
nullable=False,
existing_nullable=False,
type_=sa.Integer(),
existing_type=sa.Integer(),
server_default=1,
existing_server_default=1
)
Thanks for taking time to help me.
Edit:
The complete error message :
INFO [alembic.migration] Context impl MySQLImpl.
INFO [alembic.migration] Will assume non-transactional DDL.
INFO [alembic.migration] Running upgrade 28dda873b826 -> ec2c2d40eb1, users change column wiki_permission to wiki_group
Traceback (most recent call last):
File "/home/kevin/Code/python/flask/terminus/venv/bin/alembic", line 9, in <module>
load_entry_point('alembic==0.6.5', 'console_scripts', 'alembic')()
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 298, in main
CommandLine(prog=prog).main(argv=argv)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 293, in main
self.run_cmd(cfg, options)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/config.py", line 279, in run_cmd
**dict((k, getattr(options, k)) for k in kwarg)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/command.py", line 125, in upgrade
script.run_env()
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/script.py", line 203, in run_env
util.load_python_file(self.dir, 'env.py')
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/util.py", line 212, in load_python_file
module = load_module_py(module_id, path)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/compat.py", line 58, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "alembic/env.py", line 77, in <module>
run_migrations_online()
File "alembic/env.py", line 70, in run_migrations_online
context.run_migrations()
File "<string>", line 7, in run_migrations
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/environment.py", line 688, in run_migrations
self.get_context().run_migrations(**kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/migration.py", line 258, in run_migrations
change(**kw)
File "alembic/versions/ec2c2d40eb1_users_change_column_wiki_permission_to_.py", line 27, in upgrade
existing_server_default=1,
File "<string>", line 7, in alter_column
File "<string>", line 1, in <lambda>
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/util.py", line 329, in go
return fn(*arg, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/operations.py", line 317, in alter_column
existing_autoincrement=existing_autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 44, in alter_column
else existing_autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/impl.py", line 76, in _exec
conn.execute(construct, *multiparams, **params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 720, in execute
return meth(self, multiparams, params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 67, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 768, in _execute_ddl
compiled = ddl.compile(dialect=dialect)
File "<string>", line 1, in <lambda>
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 468, in compile
return self._compiler(dialect, bind=bind, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 25, in _compiler
return dialect.ddl_compiler(dialect, self, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 197, in __init__
self.string = self.process(self.statement, **compile_kwargs)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 220, in process
return obj._compiler_dispatch(self, **kwargs)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/ext/compiler.py", line 410, in <lambda>
lambda *arg, **kw: existing(*arg, **kw))
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/ext/compiler.py", line 448, in __call__
return fn(element, compiler, **kw)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 171, in _mysql_change_column
autoincrement=element.autoincrement
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 190, in _mysql_colspec
spec += " DEFAULT %s" % _render_value(compiler, server_default)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 179, in _render_value
return compiler.sql_compiler.process(expr)
File "/home/kevin/Code/python/flask/terminus/venv/local/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 220, in process
return obj._compiler_dispatch(self, **kwargs)
AttributeError: 'int' object has no attribute '_compiler_dispatch'

Alright, I just went through this same issue. I'm not using flask-sqlalchemy, just straight alembic, but it should be identical.
Second, it worked for me with sa.Integer with no parentheses, so I would recommend that.
The alembic docs say:
When producing MySQL-compatible migration files, it is recommended that the existing_type, existing_server_default, and existing_nullable parameters be present, if not being altered.
Since it seems you are not altering these columns, the docs suggest they should be present. So:
Remove nullable, type_, and server_default. They are not being altered.
Keep existing_nullable, existing_type, and existing_server_default.

Related

Error migrating database from 2.7.2 to 2.9

During migration of a CKAN instance from version 2.7.2 to 2.9 I'm facing the following error:
2022-03-11 14:11:28,312 INFO [ckan.cli] Using configuration file /etc/ckan/____/production.ini
2022-03-11 14:11:28,312 INFO [ckan.config.environment] Loading static files from public
2022-03-11 14:11:28,364 INFO [ckan.config.environment] Loading templates from /usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/templates
2022-03-11 14:11:28,581 INFO [ckan.config.environment] Loading templates from /usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/templates
Traceback (most recent call last):
File "/usr/lib/ckan/____/bin/ckan", line 11, in <module>
load_entry_point('ckan==2.9.5', 'console_scripts', 'ckan')()
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/cli/db.py", line 64, in upgrade
_run_migrations(plugin, version)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/cli/db.py", line 122, in _run_migrations
repo.upgrade_db(version)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/model/__init__.py", line 326, in upgrade_db
alembic_upgrade(self.alembic_config, version)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/alembic/command.py", line 254, in upgrade
script.run_env()
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/alembic/script/base.py", line 427, in run_env
util.load_python_file(self.dir, 'env.py')
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file
module = load_module_py(module_id, path)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/alembic/util/compat.py", line 135, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/migration/env.py", line 80, in <module>
run_migrations_online()
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/migration/env.py", line 74, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/alembic/runtime/environment.py", line 836, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/alembic/runtime/migration.py", line 330, in run_migrations
step.migration_fn(**kw)
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/migration/versions/001_103676e0a497_create_existing_tables.py", line 20, in upgrade
if skip_based_on_legacy_engine_version(op, __name__):
File "/usr/lib/ckan/____/local/lib/python2.7/site-packages/ckan-2.9.5-py2.7.egg/ckan/migration/__init__.py", line 22, in skip_based_on_legacy_engine_version
return int(version) >= int(filename.split(u'_', 1)[0])
ValueError: invalid literal for int() with base 10: 'None'
The skip_based_on_legacy_engine_version function is in this file from codebase. In this comparison int(version) >= int(filename.split(u'_', 1)[0]), the second returns 001, and the filename is the first of the versions folder.
I didn't get if the sqlalchemy migrate_version shoud maintain data stored in the Ckan database, couldn't find out.
The version should be setted on the alembic.ini file ?

How to resolve an error message when attempting to start Jupyter-Notebook?

I have Jupyter-Notebook on an AWS EC2 instance. It was working fine until I made a few changes/updates and now I'm getting the following error message when I attempt to use Jupyter-Notebook:
ubuntu#ip-10-0-0-5:~$ jupyter-notebook
[E 06:41:09.375 NotebookApp] Exception while loading config file /home/ubuntu/.jupyter/jupyter_notebook_config.json
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/application.py", line 562, in _load_config_files
config = loader.load_config()
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/loader.py", line 406, in load_config
dct = self._read_file_as_dict()
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/loader.py", line 412, in _read_file_as_dict
return json.load(f)
File "/usr/lib/python2.7/json/__init__.py", line 291, in load
**kw)
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 367, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 17 column 1 - line 18 column 1 (char 255 - 257)
Traceback (most recent call last):
File "/home/ubuntu/.local/bin/jupyter-notebook", line 10, in <module>
sys.exit(main())
File "/home/ubuntu/.local/lib/python2.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/ubuntu/.local/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/ubuntu/.local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1633, in initialize
self.init_server_extensions()
File "/home/ubuntu/.local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1559, in init_server_extensions
section = manager.get(self.config_file_name)
File "/home/ubuntu/.local/lib/python2.7/site-packages/notebook/services/config/manager.py", line 25, in get
recursive_update(config, cm.get(section_name))
File "/home/ubuntu/.local/lib/python2.7/site-packages/notebook/config_manager.py", line 103, in get
recursive_update(data, json.load(f))
File "/usr/lib/python2.7/json/__init__.py", line 291, in load
**kw)
File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 367, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 17 column 1 - line 18 column 1 (char 255 - 257)
Can anyone help me troubleshoot this problem?

exceptions.TypeError: __init__() got an unexpected keyword argument 'settings'

I have downloaded the distribute-crawler from github. But I found that didn't work. It is giving:
unexpected keyword argument 'settings'
Anybody know this?
The full stack trace is as follows:
2017-03-31 15:43:43 [twisted] ERROR: Unhandled error in Deferred:
2017-03-31 15:43:43 [twisted] ERROR: Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/scrapy/commands/crawl.py", line 57, in run
self.crawler_process.crawl(spname, **opts.spargs)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 163, in crawl
return self._crawl(crawler, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 167, in _crawl
d = crawler.crawl(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1237, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1099, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 90, in crawl
six.reraise(*exc_info)
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 72, in crawl
self.engine = self._create_engine()
File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 97, in _create_engine
return ExecutionEngine(self, lambda _: self.stop())
File "/usr/local/lib/python2.7/dist-packages/scrapy/core/engine.py", line 70, in __init__
self.scraper = Scraper(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/core/scraper.py", line 71, in __init__
self.itemproc = itemproc_cls.from_crawler(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 58, in from_crawler
return cls.from_settings(crawler.settings, crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 36, in from_settings
mw = mwcls.from_crawler(crawler)
File "/usr/local/lib/python2.7/dist-packages/scrapy/pipelines/media.py", line 51, in from_crawler
pipe = cls.from_settings(crawler.settings)
File "/usr/local/lib/python2.7/dist-packages/scrapy/pipelines/images.py", line 95, in from_settings
return cls(store_uri, settings=settings)
exceptions.TypeError: __init__() got an unexpected keyword argument 'settings'

Can't use pytest-bdd after installation

I installed pytest-bdd at /home/marlu/.local using python setup.py install --user, since I don't have admin privileges. Both python2.7 and pytest are located at /usr/bin/. When I check if pytest-bdd is working correctly by running py.test --version I get an error, could anyone tell me why? Thanks!
Error output:
Traceback (most recent call last):
File "/usr/bin/py.test", line 9, in <module>
load_entry_point('pytest==2.7.0', 'console_scripts', 'py.test-2.7')()
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 32, in main
config = _prepareconfig(args, plugins)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 85, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
return self._docall(self.methods, kwargs)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
firstresult=self.firstresult).execute()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 393, in execute
return wrapped_call(method(*args), self.execute)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 109, in wrapped_call
wrap_controller.send(call_outcome)
File "/usr/lib/python2.7/site-packages/_pytest/helpconfig.py", line 28, in pytest_cmdline_parse
config = outcome.get_result()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 138, in get_result
py.builtin._reraise(*ex)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 123, in __init__
self.result = func()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
res = method(*args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 636, in pytest_cmdline_parse
self.parse(args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 746, in parse
self._preparse(args)
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 713, in _preparse
self.pluginmanager.consider_setuptools_entrypoints()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 282, in consider_setuptools_entrypoints
self.register(plugin, name=name)
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 189, in register
reg(plugin, name) # may call addhooks
File "/usr/lib/python2.7/site-packages/_pytest/config.py", line 604, in _register_plugin
{'pluginmanager': self.pluginmanager})
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 360, in call_plugin
kwargs=kwargs, firstresult=True).execute()
File "/usr/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
res = method(*args)
File "/home/marlu/.local/lib/python2.7/site-packages/pytest_bdd-2.17.0-py2.7.egg/pytest_bdd/plugin.py", line 15, in pytest_addhooks
from pytest_bdd import hooks
File "/home/marlu/.local/lib/python2.7/site-packages/pytest_bdd-2.17.0-py2.7.egg/pytest_bdd/hooks.py", line 38, in <module>
#pytest.hookspec(firstresult=True)
AttributeError: 'module' object has no attribute 'hookspec'
#pytest.hookspec was introduced in pytest 2.8, so you'd need to upgrade pytest, or downgrade pytest-bdd to 2.16.1. (Whoops, I was the one who broke 2.7 compatibility)

Pymongo Error in PyCharm debugger only

I am seeing a very weired error while debugging my code in PyCharm. The offending lines that cause the exception are
a = db.links.list_indexes()
or the following:
db.links.create_index("created", expireAfterSeconds=settings.EXPIRY_PERIOD, background=True)
My code runs normally inside PyCharm if I simply do run tests, while trying to debug it causes the following error:
======================================================================
ERROR: test_detail_view (sharescreening.tests.TestIndex)
----------------------------------------------------------------------
Traceback (most recent call last):
File "sharescreening/tests.py", line 53, in test_detail_view
response = self.client.get('/')
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/django/test/client.py", line 500, in get
**extra)
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/django/test/client.py", line 303, in get
return self.generic('GET', path, secure=secure, **r)
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/django/test/client.py", line 379, in generic
return self.request(**r)
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/django/test/client.py", line 466, in request
six.reraise(*exc_info)
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 119, in get_response
resolver_match = resolver.resolve(request.path_info)
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 365, in resolve
for pattern in self.url_patterns:
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 401, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 395, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
result = _import(*args, **kwargs)
File "sharescreening/urls.py", line 17, in <module>
from .views import put_links, index, get_shares, ShowDetails
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/gevent/builtins.py", line 93, in __import__
result = _import(*args, **kwargs)
File "sharescreening/views.py", line 22, in <module>
a = db.links.list_indexes()
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/pymongo/collection.py", line 1269, in list_indexes
with self._socket_for_primary_reads() as (sock_info, slave_ok):
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 699, in _socket_for_reads
with self._get_socket(read_preference) as sock_info:
File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 663, in _get_socket
server = self._get_topology().select_server(selector)
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/pymongo/topology.py", line 121, in select_server
address))
File "/home/oznt/.virtualenvs/screenshares/local/lib/python2.7/site-packages/pymongo/topology.py", line 97, in select_servers
self._error_message(selector))
ServerSelectionTimeoutError: No servers found yet
----------------------------------------------------------------------
Ran 4 tests in 32.173s
FAILED (errors=1)
I have no clue why the tests pass in the command line, and in simple running mode but not in debug mode. Can someone shed some light on this problem here?
It turns out that the issue was really a problem with the combination or using gevent with the debugger.
If you this problem, it is resolved by upgrading your pycharm version to 2006.1.
More details can be found in the issue in PYCharm tracker