Django-CMS : Unexpected keyword argument 'providing_args' - python-3.x

I have installed a vanilla django-cms on a new server. I installed all requirements. It all went fine, up untill the point where I wanted to migrate to the database (Postgres).
So this is what I did :
Tried reinstalling and installing it all again. Didn't change it.
Used google to try and find people with the same error.
Try editing the signals file on which the error(shown below) fires, but that meant rewriting it all, which still made it unresponsive.
Traceback:
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/websites/fl/flvenv/lib/python3.8/site-packages/django/core/management/_ _init__.py", line 425, in execute_from_command_line
utility.execute()
File "/websites/fl/flvenv/lib/python3.8/site-packages/django/core/management/_ _init__.py", line 401, in execute
django.setup()
File "/websites/fl/flvenv/lib/python3.8/site-packages/django/__init__.py", lin e 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/websites/fl/flvenv/lib/python3.8/site-packages/django/apps/registry.py" , line 114, in populate
app_config.import_models()
File "/websites/fl/flvenv/lib/python3.8/site-packages/django/apps/config.py", line 300, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.8/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 848, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/websites/fl/flvenv/lib/python3.8/site-packages/cms/models/__init__.py", line 12, in <module>
from cms import signals as s_import # nopyflakes
File "/websites/fl/flvenv/lib/python3.8/site-packages/cms/signals/__init__.py" , line 16, in <module>
page_moved = Signal(providing_args=["instance"])
TypeError: __init__() got an unexpected keyword argument 'providing_args'
Anybody got an idea? Did I miss something.
Thanks for your time!

I found that answer to this problem.
If you look at the documentation of Django. It has been Django from 2.0 to 3.0.
Do formerly it was :
pizza_done = django.dispatch.Signal(providing_args = ['toppings'])
now it is:
Defining signals
All signals are django.dispatch.Signal instances.
For example:
import django.dispatch
pizza_done = django.dispatch.Signal()
This declares a pizza_done signal.
Source: https://docs.djangoproject.com/en/4.0/topics/signals/

Upgrading django-cors-headers with python -m pip install -U django-cors-headers solves this.

Related

error message when i run .python manage.py runserver'

I am new to to python,
i keep getting this error message "syntax error "from the wsgi.py file
I have tried to edit the file to python_home to my virtualenv, it still shows the
Can anyone help please
enter image description here
o manage.py package-lock.json requirements.txt ScrumMaster super.file websocketlab
djangowebsocketlab media requirements2.txt Scrum settings.ini update.py
(afo) [root#slave ScrumMaster]# python manage.py runserver 0.0.0.0:8000
Performing system checks...
Testing from slack=================
System check identified no issues (0 silenced).
January 31, 2023 - 06:17:02
Django version 2.1.7, using settings 'ScrumMaster.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f76df181950>
Traceback (most recent call last):
File "/home/linuxjobber/chatscrum/Django/ScrumMaster/afo/lib/python3.6/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/linuxjobber/chatscrum/Django/ScrumMaster/afo/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 137, in inner_run
handler = self.get_handler(*args, **options)
File "/home/linuxjobber/chatscrum/Django/ScrumMaster/afo/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
handler = super().get_handler(*args, **options)
File "/home/linuxjobber/chatscrum/Django/ScrumMaster/afo/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 64, in get_handler
return get_internal_wsgi_application()
File "/home/linuxjobber/chatscrum/Django/ScrumMaster/afo/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 45, in get_internal_wsgi_application
return import_string(app_path)
File "/home/linuxjobber/chatscrum/Django/ScrumMaster/afo/lib/python3.6/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 674, in exec_module
File "<frozen importlib._bootstrap_external>", line 781, in get_code
File "<frozen importlib._bootstrap_external>", line 741, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/linuxjobber/chatscrum/Django/ScrumMaster/ScrumMaster/wsgi.py", line 26
python_home = /home/<your-user>/chatscrum/Django/ScrumMaster/venv
^
SyntaxError: invalid syntax

waagent not deprovisioning on preparing debian VHD Azure

When running the final command which is sudo waagent –force -deprovision after preparing a Debian VHD for Kali but it keeps finishing with the below messages:
Traceback (most recent call last):
File "/usr/sbin/waagent", line 33, in <module>
sys.exit(load_entry_point('WALinuxAgent==2.2.47', 'console_scripts', 'waagent')())
File "/usr/sbin/waagent", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/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 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in load_unlocked
File "<frozen importlib.bootstrap_external>", line 790, in exec_module
File "<frozen importlib.bootstrap>", line 228, in call_with_frames_removed
File "/usr/lib/python3/dist-packages/azurelinuxagent/agent.py", line 34, in <module>
import azurelinuxagent.common.event as event
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/event.py", line 632, in <module>
event_logger = EventLogger()
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/event.py", line 304, in init
osutil = get_osutil()
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/osutil/factory.py", line 50, in get_osutil
return _get_osutil(distro_name, distro_code_name, distro_version, distro_full_name)
File "/usr/lib/python3/dist-packages/azurelinuxagent/common/osutil/factory.py", line 79, in _get_osutil
return DebianOSBaseUtil()
NameError: name 'DebianOSBaseUtil' is not defined`
The deployment fails in Azure and I think this may be apart of that issue. I have reviewed their documentation and seen users having the same issue. Anyone ever faced this issue?
The original document in question that was used is this: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/debian-create-upload-vhd
It looks like there is an error in the factory.py file.
try changing line 25 to add ", DebianOSBaseUtil" to the end of the import statement.

Unable to run pd.read_excel for scripts that previously worked

I am unable to get my python scripts working. To clarify they did work before but now they not, the code itself is not the issue. Whenever I try to run one I get an error specifically on the line pd.read_excel(file)
Traceback (most recent call last):
File "automated_cleaning.py", line 9, in <module>
df = pd.read_excel(roster_file)
File "C:\Users\"User"\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\util\_decorators.py", line 208, in wrapper
return func(*args, **kwargs)
File "C:\Users\"User"\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\io\excel\_base.py", line 310, in read_excel
io = ExcelFile(io, engine=engine)
File "C:\Users\"User"\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\io\excel\_base.py", line 819, in __init__
self._reader = self._engines[engine](self._io)
File "C:\Users\"User"\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\io\excel\_xlrd.py", line 20, in __init__
import_optional_dependency("xlrd", extra=err_msg)
File "C:\Users\"User"\AppData\Local\Programs\Python\Python37\lib\site-packages\pandas\compat\_optional.py", line 90, in import_optional_dependency
module = importlib.import_module(name)
File "C:\Users\"User"\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 724, in exec_module
File "<frozen importlib._bootstrap_external>", line 860, in get_code
File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\"User"\AppData\Local\Programs\Python\Python37\lib\site-packages\xlrd\__init__.py", line 1187
print "EXTERNSHEET(b7-):"
^
SyntaxError: invalid syntax
Process finished with exit code 1
After searching it seems like the file is corrupt and that is the reason why it is not working. I have tried changing the function to use a different engine but I still get a similar error.
I have tried running pip install to try and fix the package in both Pycharm Terminal and the cmd line but in either scenario it doesn't work.
Any suggestions?
I had similar problem in past, I just updated my xlrd module.
python -m pip install --upgrade xlrd
and also try to put r in file path
pd.read_excel(r"C:\Users\")
I hope you're using python-3.x

how to fix Error with pip after 20 update

I’m using Python 3.6.7 64x on windows 10.
Today after my updating (pip) I got this error when I’m trying to install any lib.
Traceback (most recent call last):
File "c:\users\admin\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\admin\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\Scripts\pip.exe\__main__.py", line 7, in <module>
File "c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\cli\main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "c:\users\admin\appdata\local\programs\python\python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\users\admin\appdata\local\programs\python\python36\lib\site-packages\pip\_internal\commands\install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand, with_cleanup
ImportError: cannot import name 'with_cleanup'
I tried to repair the installation but it didn’t help.
So please will you tell me what I can do to fix this problem!
With all respect!
I didn't get any answer for my question, and I still don't know how to solve the problem with the 20 update of pip.
but I found a way to make pip work again by using 'easy_install pip==19.3.1' in the cmd. and now i'm using the pip 19.3.1 and it works well.
hope this will help somebody!
with all respect!

Tensorflow keeps showing requirement violation regarding "-ensorflow-gpu" on Windows 10

I was trying to upgrade my previously installed tensorflow-gpu to a newer version, and when I do so, after checking a few requirements without any error, it says -ensorflow-gpu 1.8.0 has requirement tensorboard<1.9.0, >=1.8.0, but you'll have tensorboard 1.12.2 which is incompatible, followed by normal installation Installing collected packages: tensorboard, tensorflow-gpu.
With tensorflow installed, the following error message shows up when I attempted to run a program which makes use of tensorflow.
Traceback (most recent call last):
File "C:\...\lib\cli.py", line 88, in execute_script
script = self.import_script()
File "C:\...\lib\cli.py", line 34, in import_script
module = import_module(mod)
File "C:\...\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\...\scripts\gui.py", line 10, in <module>
from lib.gui import (CliOptions, CommandNotebook, ConsoleOut, Session, DisplayNotebook,
File "C:\...\lib\gui\__init__.py", line 2, in <module>
from lib.gui.display import DisplayNotebook
File "C:\...\lib\gui\display.py", line 11, in <module>
from .display_analysis import Analysis
File "C:\...\lib\gui\display_analysis.py", line 12, in <module>
from .stats import Calculations, Session
File "C:\...\lib\gui\stats.py", line 12, in <module>
import tensorflow as tf
File "C:\...\AppData\Roaming\Python\Python36\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
ModuleNotFoundError: No module named 'tensorflow.python'`
It seems that the problem is caused by that little typo there saying -ensorflow-gpu, but I can't seem to find where that comes from.

Resources