generateDS issue when using gends_generate_django.py - python

I would like to use the python script gends_generate_django.py from the generateDS toolbox to generate Django models from an initial XSD file.
According to the documentation (point 16.1) I would like to go through the following three steps:
Generate bindings -- Run generateDS.py.
ExtractsimpleType definitions from schema -- Run gends_extract_simple_types.py.
Generate models.py and forms.py -- Run gends_generate_django.py.
Steps 1+2 could be completed successfully. In step 3 the following error message appears:
Traceback (most recent call last):
File
"SOME_PATH/generateds_code_2_40_12/gends_generate_django.py", line 208,
in
main()
File "SOME_PATH/generateds_code_2_40_12/gends_generate_django.py", line 202,
in main
generate_model(options, module_name)
File "SOME_PATH/generateds_code_2_40_12/gends_generate_django.py", line 96, in generate_model
supermod = importlib.import_module(module_name)
File "C:\ProgramData\Miniforge3\envs\gends_ws\lib\importlib_init_.py",
line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 961, in _find_and_load_unlocked
File "", line 219, in
_call_with_frames_removed
File "", line 1014, in _gcd_import
File "", line 991,
in _find_and_load
File "", line 973, in
_find_and_load_unlocked
ModuleNotFoundError: No module named 'SOME_PATH/generateds_definedsimpletypes'
Where generateds_definedsimpletypes.py is the output from running gends_extract_simple_types.py.
I have tried running the script both in the Conda environment and underself-installed Python. Moreover, I have used generateDS version 2.40.12. and Python 3.9.13.
What is my mistake when executing the script?
Many thanks for your replies!

Related

Anaconda - Spyder no longer launching

I've been using anaconda Spyder for a few weeks for one of my classes and when I anaconda today, Spyder was not listed as installed. So I updated anaconda and restarted my MacBook and Spyder was back. Now, when I try launch Spyder, I get this error:
unittest: No module named 'lxml'
Traceback (most recent call last):
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/find_plugins.py", line 119, in find_external_plugins
mod = importlib.import_module(entry_point.module_name)
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 972, in _find_and_load_unlocked
File "", line 228, in _call_with_frames_removed
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder_unittest/__init__.py", line 9, in
from .unittestplugin import UnitTestPlugin as PLUGIN_CLASS
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder_unittest/unittestplugin.py", line 21, in
from spyder_unittest.widgets.unittestgui import UnitTestWidget
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder_unittest/widgets/unittestgui.py", line 26, in
from spyder_unittest.backend.noserunner import NoseRunner
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder_unittest/backend/noserunner.py", line 9, in
from lxml import etree
ModuleNotFoundError: No module named 'lxml'
Traceback (most recent call last):
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/utils.py", line 281, in create_window
main.setup()
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 850, in setup
internal_plugins = find_internal_plugins()
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/find_plugins.py", line 92, in find_internal_plugins
mod = importlib.import_module(entry_point.module_name)
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/findinfiles/plugin.py", line 18, in
from spyder.plugins.findinfiles.widgets import FindInFilesWidget
ImportError: cannot import name 'FindInFilesWidget' from 'spyder.plugins.findinfiles.widgets' (/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/findinfiles/widgets/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/aidenwalsh/opt/anaconda3/bin/spyder", line 11, in
sys.exit(main())
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/start.py", line 237, in main
mainwindow.main(options, args)
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 1992, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/utils.py", line 283, in create_window
if main.console is not None:
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 1088, in __getattr__
return self.get_plugin(self._INTERNAL_PLUGINS_MAPPING[attr])
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 165, in get_plugin
raise SpyderAPIError(f'Plugin "{plugin_name}" not found!')
spyder.api.exceptions.SpyderAPIError: Plugin "internal_console" not found!
Ive tried reinstalling Spyder, using a different version of Spyder, but I can't seem to get past this error. If anyone could help id really appreciate it, I need to use this software for my class.
New error:
main.setup()
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 850, in setup
internal_plugins = find_internal_plugins()
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/find_plugins.py", line 92, in find_internal_plugins
mod = importlib.import_module(entry_point.module_name)
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/findinfiles/plugin.py", line 18, in
from spyder.plugins.findinfiles.widgets import FindInFilesWidget
ImportError: cannot import name 'FindInFilesWidget' from 'spyder.plugins.findinfiles.widgets' (/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/plugins/findinfiles/widgets/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/aidenwalsh/opt/anaconda3/bin/spyder", line 11, in
sys.exit(main())
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/start.py", line 237, in main
mainwindow.main(options, args)
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 1992, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/utils.py", line 283, in create_window
if main.console is not None:
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 1088, in __getattr__
return self.get_plugin(self._INTERNAL_PLUGINS_MAPPING[attr])
File "/Users/aidenwalsh/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 165, in get_plugin
raise SpyderAPIError(f'Plugin "{plugin_name}" not found!')
spyder.api.exceptions.SpyderAPIError: Plugin "internal_console" not found!```
Try resetting spyder
conda activate your_spyder_env
spyder --reset
If that doesn't work try deleting the history lcoated as below and then re-running/reinstalling
user_dir/.config/spyder-py3
If that doesn't work try uninstalling, checking that all the files have been fully removed as below, updating conda, then reinstalling in a new environment
conda activate your_spyder_env
conda remove spyder
Check and make sure below or equivalent has properly removed.
Note: Your first and last name appear to be present in the logs, just a headsup in case you want to obscure it from the web
user_dir/opt/anaconda3/lib/python3.9/site-packages/spyder
Reinstall
conda update anaconda
conda create --name new_spyder_env spyder
I can observe some problems but the first can be solved by instaling LXML
pip install lxml
Try to install from the terminal.
Then shre with us the results

ModuleNotFoundError: No module named 'apps.endpointsapps'

I am very new to python and linux, I was trying to create an app from a tutorial and this happend when I tried to run a test of my model.
(venv) kali#kali:~/machinelearning/backend/server$ python manage.py test apps.ml.tests
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
app_config = AppConfig.create(entry)
File "/home/kali/machinelearning/venv/lib/python3.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python3.7/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 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'apps.endpointsapps'
This is my first question on stackoverflow too
Please add empty __init__.py file in the apps folder so that it can be recognized by Python as a package.
Check this link out. link
Can you please post the project structure you have? Basically just want to see where that apps exists.
You need to add an empty init.py (4 underscores in total) file in the apps folder for it to be recognized by Python as a package.
Have a look at the documentation for more informations.

scrapy not running ModuleNotFoundError: No module named 'scraper.settings'

I am getting below error while running my scrapy project. I tried everything suggested on stackoverflow but yet nothing has solved the problem.
Feel free to ask for more information. Looking forward for any help.
(venv) [kalpesh#localhost scraper]$ scrapy crawl mrdeepfakes -a output=db
Traceback (most recent call last):
File "/home/kalpesh/venv/bin/scrapy", line 8, in <module>
sys.exit(execute())
File "/home/kalpesh/venv/lib/python3.6/site-packages/scrapy/cmdline.py", line 113, in execute
settings = get_project_settings()
File "/home/kalpesh/venv/lib/python3.6/site-packages/scrapy/utils/project.py", line 69, in get_project_settings
settings.setmodule(settings_module_path, priority='project')
File "/home/kalpesh/venv/lib/python3.6/site-packages/scrapy/settings/__init__.py", line 287, in setmodule
module = import_module(module)
File "/home/kalpesh/venv/lib64/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 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'scraper.settings'
Make sure your scrapy.cfg file has the same default and project name as your spider crawler name inside the spiders folder.
I tried changing my spider crawler name in the python file and subsequently modifying the scrapy.cfg file and it works.
Screenshot of scrapy.cfg

ModuleNotFoundError: No module named 'admin'

I have this new remote job, where I had to clone all the code from a repository, and I have to make an export of the database from MySQL hosted in RDS.
The first problem is that when I set up the configuration to start the app, it raise an error telling me this:
Run Configuration Error: Broken configuration due to unavailable plugin or invalid configuration data.
The other thing is that I already have the data dumped and set up in my local storage (the app works this way, is no longer using AWS Cloud) but when I try to do an python manage.py migrate , this error comes up...
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
utility.execute()
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\core\management\__init__.py", line 312, in execute
django.setup()
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\apps\config.py", line 86, in create
module = import_module(entry)
File "C:\Users\Tony-App\AppData\Local\Programs\Python\Python37-32\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 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\liststyle\__init__.py", line 1, in <module>
from admin import ListStyleAdminMixin
ModuleNotFoundError: No module named 'admin'
First, django-liststyle is a dependency in your project, so make sure it has been installed.
py -m pip install django-liststyle
Second, make sure to add that package to INSTALLED_APPS:
INSTALLED_APPS = {
...
'liststyle',
...
'django.contrib.admin',
...
}
Third, I think the error you are getting is because of the way you are importing ListStyleAdminMixin. This should be the correct way to import it:
from liststyle.admin import ListStyleAdminMixin

shell_plus installed with Django giving error - ImportError: cannot import name 'Type

I am getting the following error when trying to launch shell_plus after installing django_extensions. Here are the steps i followed
1-Installed django_extensions using
pip install django_extensions
2-Added django_extensions to installed apps
Then I get the following error
$ ./manage.py shell_plus
Traceback (most recent call last):
File "./manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core/management/__init__.py", line 216, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core/management/__init__.py", line 36, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 662, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django_extensions/management/commands/shell_plus.py", line 14, in <module>
from django_extensions.management.shells import import_objects
File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django_extensions/management/shells.py", line 5, in <module>
from typing import ( # NOQA
ImportError: cannot import name 'Type'
Any suggestions on what might be going wrong ?
Python 3.5 comes with its own version of typing module. What is most likely happening is that you have the other typing module specified in your requirements (the one that doesn't include Type class) and its getting picked up by django_extensions instead of the native Python one. Check your installed modules, or try running:
pip uninstall typing

Categories