Python : 'Doc2Vec' object has no attribute 'dv' - python

Thanks for advice, I have edited the question
I meet this: AttributeError: 'Doc2Vec' object has no attribute 'dv'
The error comes from
Traceback (most recent call last):
File "F:\Projects\项目代码\爬虫程序\headline\main.py", line 13, in <module>
execute(["scrapy", "crawl", "head_spider", '-a', 'key='+sys.argv[1]])
File "C:\Python310\lib\site-packages\scrapy\cmdline.py", line 144, in execute
cmd.crawler_process = CrawlerProcess(settings)
File "C:\Python310\lib\site-packages\scrapy\crawler.py", line 290, in __init__
super().__init__(settings)
File "C:\Python310\lib\site-packages\scrapy\crawler.py", line 167, in __init__
self.spider_loader = self._get_spider_loader(settings)
File "C:\Python310\lib\site-packages\scrapy\crawler.py", line 161, in _get_spider_loader
return loader_cls.from_settings(settings.frozencopy())
File "C:\Python310\lib\site-packages\scrapy\spiderloader.py", line 67, in from_settings
return cls(settings)
File "C:\Python310\lib\site-packages\scrapy\spiderloader.py", line 24, in __init__
self._load_all_spiders()
File "C:\Python310\lib\site-packages\scrapy\spiderloader.py", line 51, in _load_all_spiders
for module in walk_modules(name):
File "C:\Python310\lib\site-packages\scrapy\utils\misc.py", line 88, in walk_modules
submod = import_module(fullpath)
File "C:\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "F:\Projects\项目代码\爬虫程序\headline\headline\spiders\head_spider.py", line 6, in <module>
from headline.items import Artical
File "F:\Projects\项目代码\爬虫程序\headline\headline\items.py", line 20, in <module>
model = Doc2Vec.load('D:/pyspace/headline/headline/utils/model3/doc2vec.model')
File "C:\Python310\lib\site-packages\gensim\models\doc2vec.py", line 813, in load
raise ae
File "C:\Python310\lib\site-packages\gensim\models\doc2vec.py", line 807, in load
return super(Doc2Vec, cls).load(*args, rethrow=True, **kwargs)
File "C:\Python310\lib\site-packages\gensim\models\word2vec.py", line 1937, in load
raise ae
File "C:\Python310\lib\site-packages\gensim\models\word2vec.py", line 1930, in load
model = super(Word2Vec, cls).load(*args, **kwargs)
File "C:\Python310\lib\site-packages\gensim\utils.py", line 486, in load
obj._load_specials(fname, mmap, compress, subname)
File "C:\Python310\lib\site-packages\gensim\models\word2vec.py", line 1946, in _load_specials
super(Word2Vec, self)._load_specials(*args, **kwargs)
File "C:\Python310\lib\site-packages\gensim\utils.py", line 517, in _load_specials
getattr(self, attrib)._load_specials(cfname, mmap, compress, subname)
File "C:\Python310\lib\site-packages\gensim\utils.py", line 1521, in new_func1
return func(*args, **kwargs)
File "C:\Python310\lib\site-packages\gensim\models\doc2vec.py", line 326, in docvecs
return self.dv
AttributeError: 'Doc2Vec' object has no attribute 'dv'
the 'D:/pyspace/headline/headline/utils/model3/doc2vec.model' is an model that has ever been trained.
gensim version is 4.1.2
Django version is 4.0.3
I don't know what should I do to solve this problem. Thanks for help

It may be the problem of your version, or you can try to correct your code "model.doc2vec"

Related

Python 3.11 installing repl-cli: setuptools not found even it's installed

That's it. I am installing repl-cli but it's giving "ModuleNotFoundError: No module named 'setuptools'".
I tried:
pip install setuptools
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: setuptools in /home/bitte/.local/lib/python3.11/site-packages (67.1.0)
And then:
pip install repl-cli
.
. Tons of installation verbose
.
RROR: Exception:
Traceback (most recent call last):
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/commands/install.py", line 415, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.py", line 373, in resolve
failure_causes = self._attempt_to_pin_criterion(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.py", line 213, in _attempt_to_pin_criterion
criteria = self._get_updated_criteria(candidate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.py", line 204, in _get_updated_criteria
self._add_to_criteria(criteria, requirement, parent=candidate)
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
return bool(self._sequence)
^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
return any(self)
^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built
candidate = func()
^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 206, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 297, in __init__
super().__init__(
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 162, in __init__
self.dist = self._prepare()
^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 231, in _prepare
dist = self._prepare_distribution()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 308, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 491, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 577, in _prepare_linked_requirement
dist = _get_prepared_distribution(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/operations/prepare.py", line 69, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/distributions/sdist.py", line 48, in prepare_distribution_metadata
self._install_build_reqs(finder)
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/distributions/sdist.py", line 118, in _install_build_reqs
build_reqs = self._get_build_requires_wheel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/distributions/sdist.py", line 95, in _get_build_requires_wheel
return backend.get_requires_for_build_wheel()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_internal/utils/misc.py", line 701, in get_requires_for_build_wheel
return super().get_requires_for_build_wheel(config_settings=cs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 166, in get_requires_for_build_wheel
return self._call_hook('get_requires_for_build_wheel', {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_impl.py", line 321, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
File "/home/bitte/.local/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'setuptools'
Just don't know what to do. I am this whole day trying to install packages and searching errors on google. I already solved at leats 7 error messages for installing this today and I can't fix this one alone.

console error output not showing the line with the error

Please I really need help, I do not know what could be going on in my program, initialy if there was an error it just simply point where an error is in
my code e.g.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\python_files\venv\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "C:\python_files\venv\lib\site-packages\channels\management\commands\runserver.py", line 75, in inner_run
self.check(display_num_errors=True)
File "C:\python_files\venv\lib\site-packages\django\core\management\base.py", line 392, in check
all_issues = checks.run_checks(
File "C:\python_files\venv\lib\site-packages\django\core\checks\registry.py", line 70, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\python_files\venv\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "C:\python_files\venv\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "C:\python_files\venv\lib\site-packages\django\urls\resolvers.py", line 408, in check
for pattern in self.url_patterns:
File "C:\python_files\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\python_files\venv\lib\site-packages\django\urls\resolvers.py", line 589, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\python_files\venv\lib\site-packages\django\utils\functional.py", line 48, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\python_files\venv\lib\site-packages\django\urls\resolvers.py", line 582, in
urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\python_files\hospital_project\urls.py", line 61, in <module>
url('residence/', include('hospital_project.residence.urls', namespace="residence")),#dashboard for residence
File "C:\python_files\venv\lib\site-packages\django\urls\conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\python_files\hospital_project\residence\urls.py", line 36, in <module>
url(r'pharmacy1', views.pharmacy1, name="pharmacy"),
AttributeError: module 'hospital_project.residence.views' has no attribute 'pharmacy1'
from the above error it can be seen that the error is at file C:\python_files\hospital_project\residence\urls.py line 36
This has been the normal for a long time since I have been using python. But suddenly I discorvered that the output changed.
Instead of giving me the specific line in the file where the problem exist. It prints out the whole code in the pythong file onto the console.
See an example below.
--- Logging error ---
Traceback (most recent call last):
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\logging\__init__.py", line 1081, in emit
msg = self.format(record)
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\logging\__init__.py", line 925, in format
return fmt.format(record)
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\logging\__init__.py", line 672, in format
record.exc_text = self.formatException(record.exc_info)
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\logging\__init__.py", line 622, in formatException
traceback.print_exception(ei[0], ei[1], tb, None, sio)
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\traceback.py", line 103, in print_exception
for line in TracebackException(
File "C:\software_development\python\venv\lib\site-packages\trio\_core\_multierror.py", line 393, in traceback_exception_init
traceback_exception_original_init(
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\traceback.py", line 523, in __init__
self._load_lines()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\traceback.py", line 535, in _load_lines
self.__context__._load_lines()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\traceback.py", line 535, in _load_lines
self.__context__._load_lines()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\traceback.py", line 535, in _load_lines
self.__context__._load_lines()
[Previous line repeated 6 more times]
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\traceback.py", line 533, in _load_lines
frame.line
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\traceback.py", line 288, in line
self._line = linecache.getline(self.filename, self.lineno).strip()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\linecache.py", line 16, in getline
lines = getlines(filename, module_globals)
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\linecache.py", line 47, in getlines
return updatecache(filename, module_globals)
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\linecache.py", line 137, in updatecache
lines = fp.readlines()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 6781: invalid start byte
Call stack:
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\threading.py", line 890, in _bootstrap
self._bootstrap_inner()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\software_development\python\venv\lib\site-packages\django\utils\autoreload.py", line 53, i
n wrapper
fn(*args, **kwargs)
File "C:\software_development\python\venv\lib\site-packages\channels\management\commands\runserver.py", line 106, in inner_run
self.server_cls(
File "C:\software_development\python\venv\lib\site-packages\daphne\server.py", line 143, in run
reactor.run(installSignalHandlers=self.signal_handlers)
File "C:\software_development\python\venv\lib\site-packages\twisted\internet\asyncioreactor.py", li
ne 255, in run
self._asyncioEventloop.run_forever()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 570, in run_forever
self._run_once()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 1859, in _run_once
handle._run()
File "C:\Users\software_developer\AppData\Local\Programs\Python\Python38\lib\asyncio\events.py", line 81, in _run
self._context.run(self._callback, *self._args)
File "C:\software_development\python\venv\lib\site-packages\twisted\internet\asyncioreactor.py", li
ne 271, in _onTimer
self.runUntilCurrent()
File "C:\software_development\python\venv\lib\site-packages\twisted\internet\base.py", line 991, in
runUntilCurrent
call.func(*call.args, **call.kw)
File "C:\software_development\python\venv\lib\site-packages\daphne\server.py", line 290, in applica
tion_checker
logger.error(
Message: 'Exception inside application: %s'
Arguments: (UnicodeDecodeError('utf-8', b'import re\r\nfrom django.db.models import Count, Avg\r\nfrom django.shortcuts import render, redirect\r\nfrom django.http
import HttpResponse, HttpResponseRedirect, StreamingHttpResponse\r\n\r\nfrom django.urls import reverse...................the rest of the output are just my code
with \r \n \t included allover
please what could be going on and how can I get the program to produce error.
I would really appreciate any help thanks
The first line of your log tells that it's a problem with emit method in logging python library. So the problem is that logging cannot properly emit the message to your terminal. The reason is at the bottom:
File "C:\software_development\python\venv\lib\site-packages\daphne\server.py", line 290, in applica
tion_checker
logger.error(
Message: 'Exception inside application: %s'
Arguments: (UnicodeDecodeError('utf-8', b'
So the site-package daphne which is probably a Django dependency has a problem logging the message because the Arguments that it tries to logs cannot be decoded to UTF-8.
From this traceback and without the actual code it's hard to say what's the exact reason, but if I were you I'd just run the code with the debugger, execute code line by line and check where the issue is.
You know which file causes the problem, because as you wrote the entire content of the file is logged.
You should be cautious what do you actually log. Do you log some user input data? Some contents of DB which you can't exactly predict? Can there be any special, non UTF-8 characters?

running pytest does nothing

I created a python file for running pytest but whenever I run pytest nothing happens and command prompt stays as it is. But when I do Ctrl+C this following Traceback is printing. I couldn't find how to solve this issue. I will be grateful for any support you can provide.
File "C:\ProgramData\Anaconda3\lib\tempfile.py", line 255, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\anyio\\__pycache__\\tmp7fewgyj8'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\pytest-script.py", line 10, in <module>
sys.exit(console_main())
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\config\__init__.py", line 187, in console_main
code = main()
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\config\__init__.py", line 145, in main
config = _prepareconfig(args, plugins)
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\config\__init__.py", line 324, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\_callers.py", line 55, in _multicall
gen.send(outcome)
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\helpconfig.py", line 102, in pytest_cmdline_parse
config: Config = outcome.get_result()
File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\config\__init__.py", line 1016, in pytest_cmdline_parse
self.parse(args)
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\config\__init__.py", line 1304, in parse
self._preparse(args, addopts=addopts)
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\config\__init__.py", line 1187, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\_manager.py", line 287, in load_setuptools_entrypoints
plugin = ep.load()
File "C:\ProgramData\Anaconda3\lib\importlib\metadata.py", line 86, in load
module = import_module(match.group('module'))
File "C:\ProgramData\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\assertion\rewrite.py", line 163, in exec_module
_write_pyc(state, co, source_stat, pyc)
File "C:\ProgramData\Anaconda3\lib\site-packages\_pytest\assertion\rewrite.py", line 315, in _write_pyc
with atomic_write(os.fspath(pyc), mode="wb", overwrite=True) as fp:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 119, in __enter__
return next(self.gen)
File "C:\ProgramData\Anaconda3\lib\site-packages\atomicwrites\__init__.py", line 166, in _open
with get_fileobject(**self._open_kwargs) as f:
File "C:\ProgramData\Anaconda3\lib\site-packages\atomicwrites\__init__.py", line 183, in get_fileobject
descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix,
File "C:\ProgramData\Anaconda3\lib\tempfile.py", line 336, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "C:\ProgramData\Anaconda3\lib\tempfile.py", line 255, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)```
Seems you dont have the right permissions as stated by #mrCopiCat, but you are on windows so you can do something like this.
import ctypes, sys
def elevate():
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if elevate():
# Put your program here
else:
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
Or better yet using elevate: https://pypi.org/project/elevate/

arguments already parsed: cannot register CLI option problem

I am trying to run a project About sdn mininet&ryu controller. source: https://github.com/archanas23/SDN-Project but when I try to run a dumper file step 3, I get this error.
Command:
PYTHONPATH=. ./bin/ryu-manager --verbose --observe-links ryu/topology/dumper.py ./ryu/controller/controller.py
Error:
loading app ./ryu/controller/controller.py
Traceback (most recent call last):
File "./bin/ryu-manager", line 19, in <module>
main()
File "/home/saber/ryu/ryu/cmd/manager.py", line 98, in main
app_mgr.load_apps(app_lists)
File "/home/saber/ryu/ryu/base/app_manager.py", line 415, in load_apps
cls = self.load_app(app_cls_name)
File "/home/saber/ryu/ryu/base/app_manager.py", line 392, in load_app
mod = utils.import_module(name)
File "/home/saber/ryu/ryu/utils.py", line 99, in import_module
return _import_module_file(modname)
File "/home/saber/ryu/ryu/utils.py", line 88, in _import_module_file
return load_source(modname, abspath)
File "/home/saber/ryu/ryu/utils.py", line 42, in load_source
return loader.load_module(name)
File "<frozen importlib._bootstrap_external>", line 522, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 1027, in load_module
File "<frozen importlib._bootstrap_external>", line 852, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 702, in _load
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/saber/ryu/ryu/controller/controller.py", line 58, in <module>
CONF.register_cli_opts([
File "/home/saber/.local/lib/python3.8/site-packages/oslo_config/cfg.py", line 2077, in __inner
result = f(self, *args, **kwargs)
File "/home/saber/.local/lib/python3.8/site-packages/oslo_config/cfg.py", line 2363, in register_cli_opts
self.register_cli_opt(opt, group, clear_cache=False)
File "/home/saber/.local/lib/python3.8/site-packages/oslo_config/cfg.py", line 2081, in __inner
return f(self, *args, **kwargs)
File "/home/saber/.local/lib/python3.8/site-packages/oslo_config/cfg.py", line 2355, in register_cli_opt
raise ArgsAlreadyParsedError("cannot register CLI option")
oslo_config.cfg.ArgsAlreadyParsedError: arguments already parsed: cannot register CLI option

Error while upgrading ODOO from V11 to V12

While migrating my ODOO from version 11 to 12 using openUpgrade, I've encountered the following issue. I am using the community version of ODOO.
Traceback (most recent call last):
File "/home/user/company/version12/OpenUpgrade/odoo/service/server.py", line 1162, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/home/user/company/version12/OpenUpgrade/odoo/modules/registry.py", line 86, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/user/company/version12/OpenUpgrade/odoo/modules/loading.py", line 478, in load_modules
processed_modules += load_marked_modules(cr, graph,
File "/home/user/company/version12/OpenUpgrade/odoo/modules/loading.py", line 361, in load_marked_modules
loaded, processed = load_module_graph(
File "/home/user/company/version12/OpenUpgrade/odoo/modules/loading.py", line 196, in load_module_graph
load_openerp_module(package.name)
File "/home/user/company/version12/OpenUpgrade/odoo/modules/module.py", line 368, in load_openerp_module
__import__('odoo.addons.' + module_name)
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible
File "/home/user/company/version12/OpenUpgrade/odoo/modules/module.py", line 82, in load_module
exec(open(modfile, 'rb').read(), new_mod.__dict__)
File "<string>", line 3, in <module>
File "/home/user/company/erp12/company-erp-v3/mail_trail_message/models/__init__.py", line 5, in <module>
from . import mail_thread
File "/home/user/company/erp12/company-erp-v3/mail_trail_message/models/mail_thread.py", line 33, in <module>
class MailThread(models.AbstractModel):
File "/home/user/company/version12/OpenUpgrade/odoo/api.py", line 112, in _new_
value = guess(value)
File "/home/user/company/version12/OpenUpgrade/odoo/api.py", line 690, in guess
args, vname, kwname, defaults = getargspec(method)
File "/usr/lib/python3.8/inspect.py", line 1095, in getargspec
raise ValueError("Function has keyword-only parameters or annotations"
ValueError: Function has keyword-only parameters or annotations, use inspect.signature() API which can support them
File "/home/user/company/erp12/company-erp-v3/mail_trail_message/models/mail_thread.py", line 33, in <module>
This is where you should look at. I believe Odoo has no module name mail_trail_message

Categories

Resources