I have a Python script that uses the nose library to set some custom options before running my tests. My project is in a virtualenv that uses Python 2.5. My global Python version was recently upgraded to 2.7, but because I'm using a virtualenv, I should be shielded. However, the last few lines look like they're referencing a non-local version of nosegae.
Where is build/bdist.linux-x86_64/egg/nosegae.py located? It looks local, but that relative path does not exist.
Traceback (most recent call last):
File "scripts/run_nosetests.py", line 70, in <module>
nose.run(argv=nose_opts)
File "/home/matthew/dev/projects/jazzy_jack/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/core.py", line 282, in run
return TestProgram(*arg, **kw).success
File "/home/matthew/dev/projects/jazzy_jack/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/core.py", line 117, in __init__
**extra_args)
File "/usr/lib/python2.5/unittest.py", line 767, in __init__
self.parseArgs(argv)
File "/home/matthew/dev/projects/jazzy_jack/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/core.py", line 134, in parseArgs
self.config.configure(argv, doc=self.usage())
File "/home/matthew/dev/projects/jazzy_jack/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/config.py", line 324, in configure
self.plugins.begin()
File "/home/matthew/dev/projects/jazzy_jack/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/plugins/manager.py", line 93, in __call__
return self.call(*arg, **kw)
File "/home/matthew/dev/projects/jazzy_jack/lib/python2.5/site-packages/nose-0.11.3-py2.5.egg/nose/plugins/manager.py", line 161, in simple
result = meth(*arg, **kw)
File "build/bdist.linux-x86_64/egg/nosegae.py", line 129, in begin
File "build/bdist.linux-x86_64/egg/nosegae.py", line 153, in _install_hook
TypeError: __init__() takes at least 3 arguments (2 given)
Related
I am new to python and currently using spyder 5.3.3 but I have encountered an issue where it will not launch. Please could you help with this.
Error message below
Traceback (most recent call last):
File "/Users/kira/opt/anaconda3/bin/spyder", line 11, in
sys.exit(main())
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/app/start.py", line 252, in main
mainwindow.main(options, args)
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 1956, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/app/utils.py", line 289, in create_window
main.setup()
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 778, in setup
PLUGIN_REGISTRY.register_plugin(self, PluginClass,
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/api/plugin_registration/registry.py", line 342, in register_plugin
instance = self._instantiate_spyder5_plugin(
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/api/plugin_registration/registry.py", line 184, in _instantiate_spyder5_plugin
plugin_instance = PluginClass(main_window, configuration=CONF)
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/api/plugins/new_api.py", line 973, in __init__
super().__init__(parent, configuration=configuration)
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/api/plugins/new_api.py", line 313, in __init__
self._container = container = self.CONTAINER_CLASS(
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/console/widgets/main_widget.py", line 135, in __init__
self.shell = InternalShell( # TODO: Move to use SpyderWidgetMixin?
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/console/widgets/internalshell.py", line 153, in __init__
super().__init__(parent, get_conf_path('history_internal.py'),
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/console/widgets/shell.py", line 665, in __init__
ShellBaseWidget.__init__(self, parent, history_filename,
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/console/widgets/shell.py", line 75, in __init__
self.history = self.load_history()
File "/Users/kira/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/console/widgets/shell.py", line 503, in load_history
if rawhistory[1] != self.INITHISTORY[1]:
IndexError: list index out of range
#Kaza, I've just run over the same problem and after a few hours, I found this (History on spyder kills the kernel) that helped me out. In my case, a memory out of space corrupted the history.py file, which can be accessed through spyder defaults at the /Users/Name_User/.spyder-py3 (or under similar file name). Opening that file gave me the option to delete the history.py which resets the file and gets the spyder back to work.
I develop a project with the celery in python,and use the cython to compile the pyd files, every files is good but tasks.pyd, it fails to run. I think perhaps the bug is relate to the #decarator,and I try sererval methons with no solution, who can help me? thanks first.
here is my code in tasks.py
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
#app.task
def myTaskFunc(arg1=None, arg2=None):
some code
Traceback (most recent call last):
File "c:\users\en-18\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\en-18\AppData\Local\Programs\Python\Python36\Scripts\celery.exe\__main__.py", line 9, in <module>
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\__main__.py", line 16, in main
_main()
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\bin\celery.py", line 322, in main
cmd.execute_from_commandline(argv)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\bin\celery.py", line 495, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\bin\base.py", line 305, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\bin\celery.py", line 487, in handle_argv
return self.execute(command, argv)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\bin\celery.py", line 419, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\bin\worker.py", line 223, in run_from_argv
return self(*args, **options)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\bin\base.py", line 253, in __call__
ret = self.run(*args, **kwargs)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\bin\worker.py", line 258, in run
**kwargs)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\worker\worker.py", line 97, in __init__
self.on_before_init(**kwargs)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\apps\worker.py", line 93, in on_before_init
trace.setup_worker_optimizations(self.app, self.hostname)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\app\trace.py", line 596, in setup_worker_optimizations
app.finalize()
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\app\base.py", line 538, in finalize
_announce_app_finalized(self)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\_state.py", line 54, in _announce_app_finalized
callback(app)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\app\base.py", line 411, in cons
return app._task_from_fun(fun, **opts)
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\app\base.py", line 452, in _task_from_fun
'__header__': staticmethod(head_from_fun(fun, bound=bind)),
File "c:\users\en-18\appdata\local\programs\python\python36\lib\site-packages\celery\utils\functional.py", line 279, in head_from_fun
namespace = {'__name__': fun.__module__}
AttributeError: 'method-wrapper' object has no attribute '__module__'
comtypes > Calling CoUnititialize()
comtypes > CoUnititialize() done.
It's impossible to know without a minimal reproducible example so what follows is a guess.
I suspect #app.task requires the function to have some introspectable attribute that Cython doesn't provide by default. Things to try:
Use the directive #cython: binding=True. This makes Cython functions a custom object type that behave more like a regular function.
Use Cython 3 alpha (although who knows what version of Cython you're using here, since you don't say). It contains some improvements to function introspection (and enables binding=True by default).
Write this bit of code in Python (you could use exec for this for example).
After updating to the current version of Anacondo (Anaconda3-5.0.0-Windows-x86_64), my pweave code has run into some issues.
When running for example
pweave.weave('example.texw', doctype = 'tex')
I get the MultipleInstanceError with the traceback shown below:
Traceback (most recent call last):
File "<ipython-input-9-85475eedd74e>", line 1, in <module>
pweave.weave('example.texw', doctype = 'tex')
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site
packages\pweave\__init__.py", line 59, in weave
doc.weave()
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site-
packages\pweave\pweb.py", line 192, in weave
self.run()
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site
packages\pweave\pweb.py", line 127, in run
self.wd
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site
packages\pweave\processors\jupyter.py", line 169, in __init__
super(IPythonProcessor, self).__init__(*args, embed_kernel=embed)
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site
packages\pweave\processors\jupyter.py", line 34, in __init__
km.start_kernel(cwd=path, stderr=open(os.devnull, 'w'))
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site
packages\ipykernel\inprocess\manager.py", line 46, in start_kernel
self.kernel = InProcessKernel(parent=self, session=self.session)
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site
packages\ipykernel\inprocess\ipkernel.py", line 72, in __init__
super(InProcessKernel, self).__init__(**traits)
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site
packages\ipykernel\ipkernel.py", line 46, in __init__
kernel = self,
File "C:\Users\tdecloedt\AppData\Local\Continuum\anaconda3\lib\site
packages\traitlets\config\configurable.py", line 423, in instance
'%s are being created.' % cls.__name__
MultipleInstanceError: Multiple incompatible subclass instances
InProcessInteractiveShell are being created.
I can however run pweave from the terminal as
pweave -f tex example.texw
I have not found relevant answers regarding the MultipleInstanceError elsewhere.
Any insight would be greatly appreciated!
I installed jupiter with pip and run
jupyter notebook
Then I got this mistakes:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/notebook/notebookapp.py", line 1136, in initialize
super(NotebookApp, self).initialize(argv)
File "<decorator-gen-6>", line 2, in initialize
File "/Library/Python/2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 243, in initialize
self.migrate_config()
File "/Library/Python/2.7/site-packages/jupyter_core/application.py", line 162, in migrate_config
from .migrate import get_ipython_dir, migrate
File "/Library/Python/2.7/site-packages/jupyter_core/migrate.py", line 35, in <module>
from IPython.paths import get_ipython_dir
File "/Library/Python/2.7/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/Library/Python/2.7/site-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/Library/Python/2.7/site-packages/IPython/terminal/interactiveshell.py", line 93, in <module>
class TerminalInteractiveShell(InteractiveShell):
File "/Library/Python/2.7/site-packages/IPython/terminal/interactiveshell.py", line 138, in TerminalInteractiveShell
highlighting: \n %s""" % ', '.join(get_all_styles())
File "/Library/Python/2.7/site-packages/pygments/styles/__init__.py", line 79, in get_all_styles
for name, _ in find_plugin_styles():
File "/Library/Python/2.7/site-packages/pygments/plugin.py", line 62, in find_plugin_styles
for entrypoint in iter_entry_points(STYLE_ENTRY_POINT):
File "/Library/Python/2.7/site-packages/pygments/plugin.py", line 45, in iter_entry_points
import pkg_resources
File "/Library/Python/2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/Library/Python/2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
Anyone know how to fix it?
I have searched it on google, but nothing is helpful on this particular issue.
I was facing the same problem but only in one of the two virtualenv on my machine. I had latest pip and same version of jupyter in both environments running on Python-2.7.9
Upon searching more, I found a similar issue which suggested using a specific version of setuptools
pip install setuptools==33.1.1
My setuptools version was setuptools-34.2.0 earlier.
At first I use python 2.7.10 , which will call the mistake. After change the version of python to 2.7.13 and reinstall jupyter, the problem is fixed:)
May be is easy, but really helpful!
I’m following a video from 2012 - Gevent-socketio, cross-framework real-time web live demo (https://www.youtube.com/watch?v=zhh_N5pmHBY)
I’m working on Ubuntu 15.04.
At 8 mins, in init.py he corrects config.add_renderer('.html', 'pyramid.mako_templating.renderer_factory') but after that I still can’t get it to work. The error I’m getting is below.
Any and all help would be greatly appreciated.
Thank you
(env)cloud#cloudnetwork:~/Code/python/3/moo/Moo$ pserve --reload development.ini
Starting subprocess with file monitor
Traceback (most recent call last):
File "/home/cloud/Code/python/3/moo/env/bin/pserve", line 9, in <module>
load_entry_point('pyramid==1.5.7', 'console_scripts', 'pserve')()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 58, in main
return command.run()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 328, in run
global_conf=vars)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 363, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, **context.local_conf)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
val = callable(*args, **kw)
File "/home/cloud/Code/python/3/moo/Moo/moo/__init__.py", line 10, in main
config.add_renderer('.html', 'pyramid.mako_templating.renderer_factory')
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/util.py", line 528, in wrapper
result = wrapped(self, *arg, **kw)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/config/rendering.py", line 33, in add_renderer
factory = self.maybe_dotted(factory)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 825, in maybe_dotted
return self.name_resolver.maybe_resolve(dotted)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 320, in maybe_resolve
return self._resolve(dotted, package)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 327, in _resolve
return self._zope_dottedname_style(dotted, package)
File "/home/cloud/Code/python/3/moo/env/local/lib/python2.7/site-packages/pyramid/path.py", line 382, in _zope_dottedname_style
__import__(used)
ImportError: No module named mako_templating
The easiest way to register a new extension to be processed as a Mako template in Pyramid is as follows:
config.include('pyramid_mako')
config.add_mako_renderer('.html')
This will set up the renderer correctly.
Mako templating was removed from the Pyramid core framework, and thus pyramid.mako_templating.* no longer exists.
Depending on how you installed pyramid, you also need to install pyramid_mako, for instance by running pip install pyramid_mako. It's a separate module and is not a part of pyramid itself.