Attribute Error running PyTest - python

I am currently trying to run some test on a program, but suddenly I keep getting the same error, no matter what I run it on, be it the program I want to test, a basic tutorial file, an empty file or nothing. The error is :
File "/usr/local/bin/py.test", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 38, in main
config = _prepareconfig(args, plugins)
File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 117, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 724, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 595, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 249, in _wrapped_call
wrap_controller.send(call_outcome)
File "/usr/local/lib/python2.7/dist-packages/_pytest/helpconfig.py", line 28, in pytest_cmdline_parse
config = outcome.get_result()
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
_reraise(*ex) # noqa
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 264, in __init__
self.result = func()
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
res = hook_impl.function(*args)
File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 852, in pytest_cmdline_parse
self.parse(args)
File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 957, in parse
self._preparse(args)
File "/usr/local/lib/python2.7/dist-packages/_pytest/config.py", line 918, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py", line 501, in load_setuptools_entrypoints
plugin = ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2088, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/usr/local/lib/python2.7/dist-packages/pytest_bdd/__init__.py", line 3, in <module>
from pytest_bdd.steps import given, when, then
File "/usr/local/lib/python2.7/dist-packages/pytest_bdd/steps.py", line 43, in <module>
from .feature import parse_line, force_encode
File "/usr/local/lib/python2.7/dist-packages/pytest_bdd/feature.py", line 37, in <module>
from . import exceptions
File "/usr/local/lib/python2.7/dist-packages/pytest_bdd/exceptions.py", line 65, in <module>
#six.python_2_unicode_compatible
AttributeError: 'module' object has no attribute 'python_2_unicode_compatible'
I could not find anything relating specifically to this bug in pytest, although it seems to occur in other programs using the six module. I tried reinstalling both six and pytest, but so far no luck. What is the problem and how to solve it?
Here is the result for print(six.__file__, dir(six)):
('/usr/lib/python2.7/dist-packages/six.pyc',
['BytesIO', 'Iterator', 'MAXSIZE', 'Module_six_moves_urllib',
'Module_six_moves_urllib_error', 'Module_six_moves_urllib_parse',
'Module_six_moves_urllib_request', 'Module_six_moves_urllib_response',
'Module_six_moves_urllib_robotparser', 'MovedAttribute', 'MovedModule',
'PY2', 'PY3', 'StringIO', '_LazyDescr', '_LazyModule', '_MovedItems',
'__author__', '__builtins__', '__doc__', '__file__', '__name__',
'__package__', '__version__', '_add_doc', '_func_closure', '_func_code',
'_func_defaults', '_func_globals', '_import_module', '_iteritems',
'_iterkeys', '_iterlists', '_itervalues', '_meth_func', '_meth_self',
'_moved_attributes', '_urllib_error_moved_attributes',
'_urllib_parse_moved_attributes', '_urllib_request_moved_attributes',
'_urllib_response_moved_attributes', '_urllib_robotparser_moved_attributes',
'add_metaclass', 'add_move', 'advance_iterator', 'b', 'binary_type',
'byte2int', 'callable', 'class_types', 'create_bound_method', 'exec_',
'get_function_closure', 'get_function_code', 'get_function_defaults',
'get_function_globals', 'get_method_function', 'get_method_self',
'get_unbound_function', 'indexbytes', 'int2byte', 'integer_types',
'iterbytes', 'iteritems', 'iterkeys', 'iterlists', 'itervalues', 'moves',
'next', 'operator', 'print_', 'remove_move', 'reraise', 'string_types',
'sys', 'text_type', 'types', 'u', 'unichr', 'with_metaclass'])

The lack of python_2_unicode_compatible and the presence of _iteritems, _itervalues, ... indicates that you are using an old version of Python Six.
Precisely, python_2_unicode_compatible was introduced in September 2014.
You can install a more recent version with pip and virtualenv.

Related

pytest KeyError: 'USER' within docker container

I am in the process of building a docker container that will run my automation tests. When I attempt to run the command below [this works locally and in jenkins] I get the following error:
root#645ed3930434:/test_dir# pytest test_* -m smoke
Traceback (most recent call last):
File "/usr/local/bin/pytest", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 49, in main
config = _prepareconfig(args, plugins)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 168, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
wrap_controller.send(call_outcome)
File "/usr/local/lib/python3.5/dist-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
config = outcome.get_result()
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
raise ex[1].with_traceback(ex[2])
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
self.result = func()
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 957, in pytest_cmdline_parse
self.parse(args)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 1121, in parse
self._preparse(args, addopts=addopts)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 1084, in _preparse
self.pluginmanager.load_setuptools_entrypoints('pytest11')
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 516, in load_setuptools_entrypoints
self.register(plugin, name=ep.name)
File "/usr/local/lib/python3.5/dist-packages/_pytest/config.py", line 264, in register
ret = super(PytestPluginManager, self).register(plugin, name)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 371, in register
hook._maybe_apply_history(hookimpl)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 768, in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/usr/local/lib/python3.5/dist-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/usr/local/lib/python3.5/dist-packages/pytest_cloud/plugin.py", line 76, in pytest_addoption
os.environ['USER'],
File "/usr/lib/python3.5/os.py", line 725, in __getitem__
raise KeyError(key) from None
KeyError: 'USER'
I am new to docker, so I do not understand what is causing this error.
I am starting with a ubuntu as my base [this also happens when using a https://hub.docker.com/_/python/ as my base]
for reference requirements.txt includes the following:
apipkg==1.4
certifi==2017.11.5
chardet==3.0.4
execnet==1.5.0
idna==2.6
parameterized==0.6.1
psutil==5.4.1
py==1.5.2
pytest==3.2.5
pytest-cloud==2.0.0
pytest-forked==0.2
pytest-xdist==1.20.1
requests==2.18.4
six==1.11.0
timeout-decorator==0.4.0
urllib3==1.22
I have installed Python 3.5.2 in the container
The 'USER' environment variable seems not to defined within your image. Define it externally, or make your code resilient to its absence:
In your code, use os.getenv('USER', backup_user_name) instead of os.environ['USER']
In your code, use getpass instead of relying on your environment to get the current user.
import getpass
print getpass.getuser()
In docker run, you could add -e USER=$(whoami) or something of that sort
In docker-compose, you could add USER: some_user_name under the environ setting for that service.

No module named misc when implementing a simple pytest plugin?

I'm trying to implement the pytest plugin mentioned in https://github.com/pytest-dev/pytest/issues/2039, basically this plugin will print all tests that pytest finds:
## pytest_collector.py
import sys
import pytest
class DkPytestCollector(object):
def __init__(self):
self.collected = []
def pytest_collection_modifyitems(self, items):
for item in items:
self.collected.append(item.nodeid)
if __name__ == '__main__':
dkpytest_collector = DkPytestCollector()
directory = sys.argv[1]
pytest.main(['--collect-only', directory], plugins=[dkpytest_collector])
print('\n\nfound:')
for nodeid in dkpytest_collector.collected:
print(nodeid)
however, when I run it I get:
(dk) go|c:\srv\lib\dk> python ..\dkbuild\dkbuild\pytest_collector.py \srv\lib\dk
Traceback (most recent call last):
File "..\dkbuild\dkbuild\pytest_collector.py", line 20, in <module>
pytest.main(['--collect-only', directory], plugins=[dkpytest_collector])
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 50, in main
config = _prepareconfig(args, plugins)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 160, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 196, in _multicall
gen.send(outcome)
File "c:\srv\venv\dk\lib\site-packages\_pytest\helpconfig.py", line 68, in pytest_cmdline_parse
config = outcome.get_result()
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 77, in get_result
_reraise(*ex) # noqa
File "c:\srv\venv\dk\lib\site-packages\pluggy\callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 943, in pytest_cmdline_parse
self.parse(args)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 1108, in parse
self._preparse(args, addopts=addopts)
File "c:\srv\venv\dk\lib\site-packages\_pytest\config.py", line 1071, in _preparse
self.pluginmanager.load_setuptools_entrypoints('pytest11')
File "c:\srv\venv\dk\lib\site-packages\pluggy\__init__.py", line 397, in load_setuptools_entrypoints
plugin = ep.load()
File "c:\srv\venv\dk\lib\site-packages\pkg_resources\__init__.py", line 2405, in load
return self.resolve()
File "c:\srv\venv\dk\lib\site-packages\pkg_resources\__init__.py", line 2411, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "c:\srv\venv\dk\lib\site-packages\_pytest\assertion\rewrite.py", line 212, in load_module
py.builtin.exec_(co, mod.__dict__)
File "c:\srv\venv\dk\lib\site-packages\py\_builtin.py", line 221, in exec_
exec2(obj, globals, locals)
File "<string>", line 7, in exec2
File "c:\srv\venv\dk\lib\site-packages\pytest_cov\plugin.py", line 6, in <module>
from coverage.misc import CoverageException
ImportError: No module named misc
if I pip uninstall pytest-cov everything works (well, except no coverage..)
How do I get this to work without uninstalling pytest-cov?

Pytest ImportError no module named 'test'

I am trying to run pytest on CircleCI, locally I have no issues but when I execute the shell command
PYTHONPATH=. pytest --cov-report html:$CIRCLE_ARTIFACTS/htmlcov --nomigrations
I get the following traceback:
Traceback (most recent call last):
File "/home/ubuntu/virtualenvs/venv-2.7.12/bin/pytest", line 11, in <module>
sys.exit(main())
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 49, in main
config = _prepareconfig(args, plugins)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 168, in _prepareconfig
pluginmanager=pluginmanager, args=args)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
wrap_controller.send(call_outcome)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/helpconfig.py", line 68, in pytest_cmdline_parse
config = outcome.get_result()
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result
_reraise(*ex) # noqa
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
self.result = func()
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 957, in pytest_cmdline_parse
self.parse(args)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 1121, in parse
self._preparse(args, addopts=addopts)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/config.py", line 1092, in _preparse
args=args, parser=self._parser)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
_MultiCall(methods, kwargs, hook.spec_opts).execute()
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
return _wrapped_call(hook_impl.function(*args), self.execute)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call
return call_outcome.get_result()
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 280, in get_result
_reraise(*ex) # noqa
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
self.result = func()
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
res = hook_impl.function(*args)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/pytest_django/plugin.py", line 244, in pytest_load_initial_conftests
dj_settings.DATABASES
File "/opt/circleci/python/2.7.12/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/home/ubuntu/virtualenvs/venv-2.7.12/lib/python2.7/site-packages/pytest_django/plugin.py", line 117, in _handle_import_error
raise ImportError(msg)
ImportError: No module named test
pytest-django found a Django project in /home/ubuntu/rit-das-pdp (it contains manage.py) and added it to the Python path.
If this is wrong, add "django_find_project = false" to pytest.ini and explicitly manage your Python path.
PYTHONPATH=. pytest --cov-report html:$CIRCLE_ARTIFACTS/htmlcov --nomigrations returned exit code 1
I have no idea what the error is saying or how to debug it.

Mysterious "'module' object has no attribute" error

Every time I try to serve my project I get this error:
Traceback (most recent call last):
File "/usr/bin/pserve", line 9, in <module>
load_entry_point('pyramid==1.5.2', 'console_scripts', 'pserve')()
File "/usr/lib/python3.4/site-packages/pyramid-1.5.2-py3.4.egg/pyramid/scripts/pserve.py", line 51, in main
return command.run()
File "/usr/lib/python3.4/site-packages/pyramid-1.5.2-py3.4.egg/pyramid/scripts/pserve.py", line 313, in run
relative_to=base, global_conf=vars)
File "/usr/lib/python3.4/site-packages/pyramid-1.5.2-py3.4.egg/pyramid/scripts/pserve.py", line 344, in loadserver
server_spec, name=name, relative_to=relative_to, **kw)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 255, in loadserver
return loadobj(SERVER, uri, name=name, **kw)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 271, in loadobj
global_conf=global_conf)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 320, in _loadconfig
return loader.get_context(object_type, name, global_conf)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 454, in get_context
section)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 476, in _context_from_use
object_type, name=use, global_conf=global_conf)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 406, in get_context
global_conf=global_conf)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 328, in _loadegg
return loader.get_context(object_type, name, global_conf)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 620, in get_context
object_type, name=name)
File "/usr/lib/python3.4/site-packages/PasteDeploy-1.5.2-py3.4.egg/paste/deploy/loadwsgi.py", line 646, in find_egg_entry_point
possible.append((entry.load(), protocol, entry.name))
File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2320, in load
return self.resolve()
File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 2326, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3.4/site-packages/waitress-0.8.9-py3.4.egg/waitress/__init__.py", line 1, in <module>
from waitress.server import create_server
File "/usr/lib/python3.4/site-packages/waitress-0.8.9-py3.4.egg/waitress/server.py", line 23, in <module>
from waitress.channel import HTTPChannel
File "/usr/lib/python3.4/site-packages/waitress-0.8.9-py3.4.egg/waitress/channel.py", line 28, in <module>
from waitress.task import (
File "/usr/lib/python3.4/site-packages/waitress-0.8.9-py3.4.egg/waitress/task.py", line 53, in <module>
class ThreadedTaskDispatcher(object):
File "/usr/lib/python3.4/site-packages/waitress-0.8.9-py3.4.egg/waitress/task.py", line 57, in ThreadedTaskDispatcher
start_new_thread = thread.start_new_thread
AttributeError: 'module' object has no attribute 'start_new_thread'
The weird thing is, the thread module has the attribute start_new_thread
>>> from waitress.compat import (thread, Empty)
>>> thread.start_new_thread
<built-in function start_new_thread>
I started this pyramid project using python 2.7, and I am trying to switch it over to python 3.4.
Things I've tried:
updating the waitress module, it's already up to date
scratching my head

"ImportError: No module named ekeet.models" When setting up Pylons with mongokit

I tried setting up a default pylons project to use mongokit as directed here:
http://namlook.github.com/mongokit/pylons.html
However it gives me the error:
>Traceback (most recent call last):
File "/usr/bin/paster", line 18, in
>command.run()
File "/usr/lib/pymodules/python2.6/paste/script/command.py", line 84, in run
>invoke(command, command_name, options, args[1:])
File "/usr/lib/pymodules/python2.6/paste/script/command.py", line 123, in invoke
>exit_code = runner.run(args)
File "/usr/lib/pymodules/python2.6/paste/script/command.py", line 218, in run
>result = self.command()
File "/usr/lib/pymodules/python2.6/paste/script/serve.py", line 276, in command
>relative_to=base, global_conf=vars)
File "/usr/lib/pymodules/python2.6/paste/script/serve.py", line 313, in loadapp
>**kw)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 204, in loadapp
>return loadobj(APP, uri, name=name, **kw)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 224, in loadobj
>global_conf=global_conf)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 248, in loadcontext
>global_conf=global_conf)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 278, in _loadconfig
>return loader.get_context(object_type, name, global_conf)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 409, in get_context
>section)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 431, in _context_from_use
>object_type, name=use, global_conf=global_conf)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 361, in get_context
>global_conf=global_conf)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 248, in loadcontext
>global_conf=global_conf)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 285, in _loadegg
>return loader.get_context(object_type, name, global_conf)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 561, in get_context
>object_type, name=name)
File "/usr/lib/pymodules/python2.6/paste/deploy/loadwsgi.py", line 587, in find_egg_entry_point
>possible.append((entry.load(), protocol, entry.name))
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1954, in load
>entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/home/ciferkey/Projects/runnr-site/runnrsite/config/middleware.py", line 11, in
>from runnrsite.config.environment import load_environment
File "/home/ciferkey/Projects/runnr-site/runnrsite/config/environment.py", line 8, in
>import runnrsite.lib.app_globals as app_globals
File "/home/ciferkey/Projects/runnr-site/runnrsite/lib/app_globals.py", line 2, in
>from ekeet.models import register_models
>ImportError: No module named ekeet.models
I haven't been able to find any help anywhere else or even what the module ekeet is. Why might this be happening?
Edit: I figured it out. that must have been the name of the pylons project used in the tutorial. ekeet.modules should really be what ever module you put the register_model in. I wont be so quick to ask next time!
Apparently ekeet just an example. You're supposed to make up your own name. The point is that register_models should be a list of all the modules you want to register. You need to tweak the names for your own needs.

Categories