i am trying to adding a new module in my database.
i faced this problem that i can not any solution.
the code of my init.py is:
from trytond.pool import Pool
from grh.Employe import *
def register():
Pool.register(
Employe,
module='grh', type_='model')
and the problem after trying is :
File "/usr/local/bin/trytond", line 5, in <module>
pkg_resources.run_script('trytond==3.2.2', 'trytond')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/EGG-INFO/scripts/trytond", line 113, in <module>
trytond.server.TrytonServer(options).run()
File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/server.py", line 123, in run
Pool(db_name).init(update=update, lang=lang)
File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/pool.py", line 151, in init
lang=lang)
File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/modules/__init__.py", line 428, in load_modules
_load_modules()
File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/modules/__init__.py", line 393, in _load_modules
graph = create_graph(module_list)[0]
File "/usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/modules/__init__.py", line 159, in create_graph
raise Exception('Module %s not found' % module)
help me please
Your are running the server from /usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg, so the module must be in /usr/local/lib/python2.7/dist-packages/trytond-3.2.2-py2.7.egg/trytond/modules/ folder or installed in /usr/local/lib/python2.7/dist-packages/
For development proposes I will recommend you running from sources without installing the packages. If you have done this, you're not connecting to the right tryton instance.
If you want to always install your module, just run python setup.py install (assuming that your custom module have the setup.py file defined with the correct methods and name).
You can find a template of setup.py on http://hg.tryton.org/tryton-tools/file/b1bf3e9fe771/contrib-module-setup.tmpl
Related
I am new to python, and its ecosystem, so I am having trouble figuring out how to fix an error I am getting while trying to install a library for a project. I understand it has something to due with the fact that my computer has two hard drives, but I do not know how to fix it. (I know putting the project on the other drive probably would, but that drive is too small, and only really has my operating system.)
This is the traceback of the error:
Traceback (most recent call last):
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\cli\base_command.py", line 179, in main
status = self.run(options, args)
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\commands\install.py", line 384, in run
installed = install_given_reqs(
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\req\__init__.py", line 53, in install_given_reqs
requirement.install(
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\req\req_install.py", line 910, in install
self.move_wheel_files(
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\req\req_install.py", line 437, in move_wheel_files
move_wheel_files(
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\wheel.py", line 458, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\wheel.py", line 424, in clobber
record_installed(srcfile, destfile, changed)
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\wheel.py", line 351, in record_installed
newpath = normpath(destfile, lib_dir)
File "D:\(name)\(project)\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip\_internal\wheel.py", line 68, in normpath
return os.path.relpath(src, p).replace(os.path.sep, '/')
File "C:\Users\(name)\AppData\Local\Programs\Python\Python38\lib\ntpath.py", line 703, in relpath
raise ValueError("path is on mount %r, start on mount %r" % (
ValueError: path is on mount 'D:', start on mount 'C:'
Also, further information, though I don't think it is relevant(but just in case), I am installing this package in PyCharm, which itself runs the pip command.
I am using Pyinstaller to compile Python to a standalone executable. The sourcecode includes modules PySide and SqlAlchemy. The dist .exe that PyInstaller creates runs OK, but when I run commands that access the database I get this error code in the command prompt:
Traceback (most recent call last):
File "clipper_tree.py", line 1907, in add_tree
File "build\bdist.win-amd64\egg\sqlalchemy\sql\operators.py", line 304, in __eq__
File "build\bdist.win-amd64\egg\sqlalchemy\orm\attributes.py", line 175, in operate
File "build\bdist.win-amd64\egg\sqlalchemy\sql\operators.py", line 304, in __eq__
File "build\bdist.win-amd64\egg\sqlalchemy\orm\properties.py", line 270, in operate
File "build\bdist.win-amd64\egg\sqlalchemy\sql\annotation.py", line 95, in __eq__
File "build\bdist.win-amd64\egg\sqlalchemy\sql\operators.py", line 304, in __eq__
File "build\bdist.win-amd64\egg\sqlalchemy\sql\elements.py", line 686, in operate
File "build\bdist.win-amd64\egg\sqlalchemy\sql\operators.py", line 304, in __eq__
File "<string>", line 1, in <lambda>
File "build\bdist.win-amd64\egg\sqlalchemy\sql\type_api.py", line 62, in operate
File "build\bdist.win-amd64\egg\sqlalchemy\util\langhelpers.py", line 964, in __getattr__
File "build\bdist.win-amd64\egg\sqlalchemy\util\langhelpers.py", line 962, in __getattr__
ImportError: Could not resolve module sqlalchemy.sql.default_comparator
While compiling, the command prompt output a few warnings about not being able to find "hidden DLLs" relating to sql alchemy. It said it was removing sqlalchemy/test files in response. Any help here would be deeply appreciated.
i had a same issue earlier.. resolves this problem by importing sqlalchemy.sql.default_comparator on my main program..
As #fredpi says you can add the module to the hiddenimports parameter of the Analysis initializer in the .spec file of the python file your trying to compile. Like so: hiddenimports=['sqlalchemy.sql.default_comparator']
Make sure you pass the .spec file when you run pyinstaller, or it will overwrite the .spec file and your changes will be lost. For example: pyinstaller --onefile myscript.spec
I have a large (~700MB) Mercurial repository. I can clone the repo fine without updating (and also it's totally browsable on Bitbucket, where it's hosted) but I can't update the working directory to the latest changeset because I get the following error:
... lot of getting [path] lines here
getting path/to/some/file.ext
abort: The system cannot find the file specified
[command returned code 255 Wed Jun 24 00:51:37 2015]
The last file before the error actually exists in the repo (it's visible in Bitbucket too).
I thought the issue was because of too long paths, but even cloning to a drive root yields the same. Paths could still be too long but "path/to/some/file.ext" is just 60 characters.
Running the command with traceback yields this:
Traceback (most recent call last):
File "mercurial\dispatch.pyo", line 160, in _runcatch
File "mercurial\dispatch.pyo", line 885, in _dispatch
File "mercurial\dispatch.pyo", line 646, in runcommand
File "mercurial\dispatch.pyo", line 976, in _runcommand
File "mercurial\dispatch.pyo", line 947, in checkargs
File "mercurial\dispatch.pyo", line 882, in <lambda>
File "mercurial\util.pyo", line 716, in check
File "mercurial\extensions.pyo", line 168, in closure
File "mercurial\util.pyo", line 716, in check
File "hgext\mq.pyo", line 3505, in mqcommand
File "mercurial\util.pyo", line 716, in check
File "mercurial\commands.pyo", line 6402, in update
File "mercurial\hg.pyo", line 535, in clean
File "mercurial\hg.pyo", line 520, in updaterepo
File "mercurial\merge.pyo", line 1140, in update
File "mercurial\merge.pyo", line 772, in applyupdates
File "mercurial\subrepo.pyo", line 246, in submerge
File "mercurial\context.pyo", line 252, in sub
File "mercurial\subrepo.pyo", line 341, in subrepo
File "mercurial\subrepo.pyo", line 1206, in __init__
File "mercurial\subrepo.pyo", line 1216, in _ensuregit
File "mercurial\subrepo.pyo", line 1294, in _gitnodir
File "subprocess.pyo", line 710, in __init__
File "subprocess.pyo", line 958, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified
The repo has git subrepos (these are public repos on GitHub). And hg-git works for me otherwise, I'm able to pull from and push to git repos from hg.
Anybody with an idea how to solve this?
Solved the issue: Lazy Badger pointed into the right direction. The issue was that the path to the git executable wasn't added to my PATH environment variable.
Adding C:\Program Files (x86)\Git\bin\ (or where you have git.exe on your system) to PATH with Rapid Environment Editor (I needed to use this tool as my PATH was over 1024 chars, so using setx wasn't working) to the System variables solved it.
Before I get started please excuse the complete newbie question (request for dummy steps). I recently started learning Python and the Django framework using tools like Codecademy and Pluralsight and was hoping to dig into this by running Pinry (a Pinterest clone) using PyCharm, my IDE of choice for Python and work on modifying it with what I've learned so far to see what happens. Unfortunately, I download the latest version of Pinry and when I try to run it in PyCharm on my local machine I get all sorts of errors.
Here are the steps I take:
Python, Django, PyCharm are all installed and configured.
Download a new copy of Pinry and open the directory in PyCharm
Click on Run - Edit Configuration
Click on the + button to add a new configuration and check Run browse, select the Python interpreter (with Django) and click on Fix to enable Django support for the project
In the Project - Django settings, add the Django project root, settings and manage script
Finally hit alt/option + R and runserver to get the app started
At this point I would expect the package to run but instead I get the list of errors below.
Has anyone had any success in running Pinry in PyCharm without making any code modifications? I am just not sure if these are issues with the package or if its settings in PyCharm that need to be modified to make this work. Any insights?
THANK YOU!
File "/Applications/PyCharm.app/helpers/pycharm/django_manage.py", line 23, in <module>
run_module(manage_file, None, '__main__', True)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/hussein/Desktop/pinry-master/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/management/base.py", line 279, in execute
saved_locale = translation.get_language()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 154, in get_language
return _trans.get_language()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 52, in __getattr__
if settings.USE_I18N:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/conf/__init__.py", line 49, in _setup
self._wrapped = Settings(settings_module)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/conf/__init__.py", line 151, in __init__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
In PyCharm "Project settings/Django" specify "settings/development.py" in "settings" field.
Like most other Mac/MySQL users with current versions of OS X, I went through the normal issues of getting Python, MySQL and MySQLdb (MySQL-Python) playing nicely together. That has been working for some time, but I'd like to use Aptana for debugging my work Django projects and when I try running either the debugger or running a project, I'm getting the dreaded "mach-o" error.
The interesting thing is that I've configured Aptana to use the same python I'm using (confirmed with a "which python" both within and outside of Aptana), and I've confirmed that the python that's being invoked by Aptana is 32-bit as it should be (same as system terminal reports). Also, when I use the Terminal in Aptana, using the interactive python shell I'm able to successfully 'import MySQLdb'. So I'm stumped.
Under arguments I'm adding this to program arguments per instructions:
runserver 8081 --noreload
But that shouldn't affect anything AFAIK. I'm at a loss of what to do next. Here is the error that Aptana is throwing when I try to launch:
pydev debugger: starting
Validating models...
Traceback (most recent call last):
File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062515/pysrc/pydevd.py", line 1392, in <module>
debugger.run(setup['file'], None, None)
File "/Applications/Aptana Studio 3/plugins/org.python.pydev_2.6.0.2012062515/pysrc/pydevd.py", line 1085, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/Users/my/path/project/manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 220, in execute
output = self.handle(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 67, in handle
self.run(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 78, in run
self.inner_run(*args, **options)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/Library/Python/2.7/site-packages/django/core/management/validation.py", line 28, in get_validation_errors
from django.db import models, connection
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 78, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 33, in load_backend
return import_module('.base', backend_name)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): no suitable image found. Did find:
/Library/Python/2.7/site-packages/_mysql.so: mach-o, but wrong architecture
Any ideas?
Take a look at: How do I force Python to be 32-bit on Snow Leopard and other 32-bit/64-bit questions on ways to configure Python to run in 32 bits (VERSIONER_PYTHON_PREFER_32_BIT environment variable seems a good choice).
Or maybe:
Troubles with PyDev and external libraries in OS X