Supporting coredata - core-data

I am using https://stackoverflow.com/a/20161667/644149 this link to support coredata in apportable.
1- i had number of model versions of my database so what name should i give in plutil command.
plutil -convert xml1 <ModelName>.mom -o <pathNearYourApprojFolder>/<ModelName>.mom
2- when i put .mom file path in asset it gives given below error,
Thanks in advance
ROOTED=yes MTP=no apportable debug
Building with TARGET_ARCH_ABI:armeabi ARM_NEON:False
Building to /Users/username/.apportable/SDK/Build/android-armeabi-debug
Loading configuration.
Traceback (most recent call last):
File "/Users/username/.apportable/SDK/bin/apportable", line 820, in <module>
run(env)
File "/Users/username/.apportable/SDK/bin/apportable", line 756, in run
results = actions[args.action](env)
File "/Users/username/.apportable/SDK/bin/apportable", line 106, in DebugAction
return env.DebugApp(site_init.BuildApplication(env, env['BUILD_TARGET']))
File "/Users/username/.apportable/SDK/site_scons/site_init.py", line 401, in BuildApplication
return build.App(env, app_sconscript)
File "/Users/username/.apportable/SDK/site_scons/build/__init__.py", line 527, in App
(sources, headers, defines, flags, configs, deps, libs, java_libs, assets, pchs, modules, java_sources, java_res_dirs, java_sourcepaths, link_flags) = Script(env, path, contents, use_absolute_paths=True, is_application=True)
File "/Users/username/.apportable/SDK/site_scons/build/__init__.py", line 423, in Script
if icon == asset['target']:
TypeError: string indices must be integers

Apportable now supports binary .mom files, so the conversion step to xml is no longer needed.
The format of the files added to the "assets" section in "add_params" of configuration.json should be wrapped in double quotes and comma separated.

Related

Can't load custom pylint module

I am following a simple tutorial that creates a custom checker/module for Pylint. The code looks like this.
bad_code.py
def func():
print("Bad code")
return
useless_return.py (This is the checker)
import astroid
from pylint import checkers
from pylint import interfaces
from pylint.checkers import utils
class UselessReturnChecker(checkers.BaseChecker):
__implements__ = interfaces.IAstroidChecker
name = 'useless-return'
msgs = {
'R2119': ("Useless return at end of function or method",
'useless-return',
'Emitted when a bare return statement is found at the end of '
'function or method definition'
),
}
#utils.check_messages('useless-return')
def visit_functiondef(self, node):
"""
Checks for presence of return statement at the end of a function
"return" or "return None" are useless because None is the default
return type if they are missing
"""
# if the function has empty body then return
if not node.body:
return
last = node.body[-1]
if isinstance(last, astroid.Return):
# e.g. "return"
if last.value is None:
self.add_message('useless-return', node=node)
# e.g. "return None"
elif isinstance(last.value, astroid.Const) and (last.value.value is None):
self.add_message('useless-return', node=node)
def register(linter):
"""required method to auto register this checker"""
linter.register_checker(UselessReturnChecker(linter))
Note that both files are in the project root.
Then I executed the following command to test it.
$ pylint --load-plugins=useless_return bad_code.py
It throws errors:
Traceback (most recent call last):
File "/path/to/my/project/venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 609, in load_plugin_configuration
module = astroid.modutils.load_module_from_name(modname)
File "path/to/my/project/venv/lib/python3.8/site-packages/astroid/modutils.py", line 228, in load_module_from_name
return importlib.import_module(dotted_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 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'useless_return'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "path/to/my/project/venv/bin/pylint", line 8, in <module>
sys.exit(run_pylint())
File "path/to/my/project/venv/lib/python3.8/site-packages/pylint/__init__.py", line 24, in run_pylint
PylintRun(sys.argv[1:])
File "path/to/my/project/venv/lib/python3.8/site-packages/pylint/lint/run.py", line 383, in __init__
linter.load_plugin_configuration()
File "path/to/my/project/venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 613, in load_plugin_configuration
self.add_message("bad-plugin-value", args=(modname, e), line=0)
File "path/to/my/project/venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1519, in add_message
self._add_one_message(
File "path/to/my/project/venv/lib/python3.8/site-packages/pylint/lint/pylinter.py", line 1456, in _add_one_message
self.stats.increase_single_module_message_count(self.current_name, msg_cat, 1)
File "path/to/my/project/venv/lib/python3.8/site-packages/pylint/utils/linterstats.py", line 296, in increase_single_module_message_count
self.by_module[modname][type_name] += increase
KeyError: None
Note that I don't have pylint installed globally, only in my venv.
The command which pylint returns path/to/my/project/venv/bin/pylint.
Help is much appreciated.
I can't confirm this is the best way to test a custom checker. But the only way that I found is to copy the custom module into pylint/checkers and run the command. To test only the custom checker
$pylint --load-plugins=useless_return --disable=all --enable=useless-return bad_code.py
EDIT: Discussion with Pylint maintainers going very well, it seems like a really responsive project. The recommendation from them is definitely to install your custom checker as part of a module, like any other library you might install with pip. Expect to see some changes around this to bring more clarity soon!
I had a similar problem, and I think I've identified the root cause. I've opened an issue with pylint: PyCQA/pylint#7264
TL;DR when you specify the module using the command line, it tries to load and register it without the current directory added to the sys path (even if your init-hook does this), so cannot find the file to import.
Workarounds
Until such time as there is a fix, or this is called out in documentation, you have a couple of options:
As OP found, putting the module in pylints checkers directory does solve this. You can put it in any sys.path directory other than the current working dir. EDIT: pylint maintainers recommend installing your custom checker into your site packages as its own package.
Do not use the command line argument for --load_plugins, instead use a pylintrc file, in the same directory as your code, that specifies at least the following two things:
[MASTER]
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
init-hook="from pylint.config import find_pylintrc; import sys; sys.path.append(os.path.dirname(find_pylintrc()))"
# List of plugins (as comma separated values of python module names) to load,
# usually to register additional checkers.
load-plugins=your_custom_checker

Key error while updating all modules in oddo10

using command - python3 odoo-bin --addons=addons,/opt/git_addons/project_abcd -u all &
when i tryied to update modules on server, I am geeting Internal server Error and Error log says:
Traceback (most recent call last):
File "/opt/odoo/odoo/modules/registry.py", line 83, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo/odoo/modules/loading.py", line 373, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/opt/odoo/odoo/modules/loading.py", line 270, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/opt/odoo/odoo/modules/loading.py", line 153, in load_module_graph
registry.setup_models(cr, partial=True)
File "/opt/odoo/odoo/modules/registry.py", line 300, in setup_models
model._setup_fields(partial)
File "/opt/odoo/odoo/models.py", line 2853, in _setup_fields
field.setup_full(self)
File "/opt/odoo/odoo/fields.py", line 505, in setup_full
self._setup_regular_full(model)
File "/opt/odoo/odoo/fields.py", line 2178, in _setup_regular_full
invf = comodel._fields[self.inverse_name]
KeyError: 'standard_id'
Please help to resolve this error.
Please find the standard_id field in all modules.
Upgrade module which have standard_id field.
If you update -u all with this command line interface then it'll update all your base module first and then you custom modules.
So it might be the reason where your module consist this field and odoo registry can't find it.
With this information it's impossible to say reason for this. One of your modules is trying to refer to a field named stadard_id which doesn't exist.
Try to update your modules one by one and see which one gives this error. Then it's easier to troubleshoot it further.
There may be some dependencies missing from __manifest__.py file.

tensorflow.python.framework.errors_impl.NotFoundError adds $ sign

I'm trying to train a pre-trained object detection model to detect objects from my custom dataset. All is running on Google Colab. I prepared the images, created TFRecord files for train and test, installed Tensorflow Object detection API from source, and tested that it works.
First I suspected it is a PYTHONPATH problem, but even when adding the folder with the config to path, it does not work.
This is my command line (I invoke the script from research folder, as in documentation):
#From the tensorflow/models/research/ directory
PIPELINE_CONFIG_PATH='/content/gdrive/My\ Drive/AI/grape4/work/model/ssd_mobilenet_v2_oid_v4.config'
MODEL_DIR=os.path.join('/content/gdrive/My\ Drive/AI/grape4/work', 'model')
NUM_TRAIN_STEPS=5000
NUM_EVAL_STEPS=1000
!python object_detection/model_main.py \
--pipeline_config_path=${PIPELINE_CONFIG_PATH} \
--model_dir=${MODEL_DIR} \
--num_train_steps=${NUM_TRAIN_STEPS} \
--num_eval_steps=${NUM_EVAL_STEPS} \
--alsologtostderr
Below is the error I'm getting. I confirm the mentioned file exists in the folder. But what is strange to me is the added $ sign (dollar sign) in the trace:
Traceback (most recent call last):
File "object_detection/model_main.py", line 109, in <module>
tf.app.run()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "object_detection/model_main.py", line 71, in main
FLAGS.sample_1_of_n_eval_on_train_examples))
File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/model_lib.py", line 605, in create_estimator_and_inputs
pipeline_config_path, config_override=config_override)
File "/usr/local/lib/python3.6/dist-packages/object_detection-0.1-py3.6.egg/object_detection/utils/config_util.py", line 103, in get_configs_from_pipeline_file
proto_str = f.read()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/file_io.py", line 122, in read
self._preread_check()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/lib/io/file_io.py", line 84, in _preread_check
compat.as_bytes(self.__name), 1024 * 512)
tensorflow.python.framework.errors_impl.NotFoundError: $/content/gdrive/My Drive/AI/grape4/work/model/ssd_mobilenet_v2_oid_v4.config; No such file or directory
Does anyone know where the problem might be?
I cannot exactly point what the problem is. But I think there might be 2 problems:
1. The path thats pointing to the .config file might be wrong.
2. The .config file might be corrupted.
Please take a look at this issues where problems #1 and #2 are being discussed clearly. I hope this helps!

How to use sub-projects with targets with same names in Apportable?

Currently, Apportable cannot build a project with targets with same names. This happens because of sub-projects. I have several sub-projects which all contains target named iOS Static Library and OS X Static Library. And their PRODUCT_NAME is overridden to prevent .a file name duplication.
Anyway, when I see build log, Apportable seem to use target name as a kind of a global identifier. And crashes while building.
How can I use targets with same names over multiple sub-projects?
Here's full build log.
Erionirr:Test9 Eonil$ apportable uninstall; rm -rf ~/.apportable/SDK/Build/android-armeabi-debug; rm -rf *.approj; apportable debug
Building to /Users/Eonil/.apportable/SDK/Build/android-armeabi-debug
Loading configuration.
Finished parsing configuration.
Loading configuration.
Finished parsing configuration.
Loading configuration.
Finished parsing configuration.
scons: Building targets ...
scons: *** [Build/android-armeabi-debug/Test9/Test9-debug.apk_debug] Source `Build/android-armeabi-debug/Test9/Test9-debug.apk' not found, needed by target `Build/android-armeabi-debug/Test9/Test9-debug.apk_debug'.
scons: building terminated because of errors.
Building to /Users/Eonil/.apportable/SDK/Build/android-armeabi-debug
Updating configuration parameters... Building Xcode project /Users/Eonil/Desktop/Apportable Knowledge Base and Bug Reporting/Running Test/Test9/Test9
Scanning build configuration for target Test9
Merging configuration parameters.
It looks like you're compiling this app for the first time.
Test9.approj/configuration.json will be created for you.
A few quick questions and you'll be on your way:
If the app is using OpenGL ES, does it use ES1 or ES2? (Cocos2D 1.X uses ES1, 2.X uses ES2)
[1/2] 2
Should the app initially launch in landscape or portrait orientation? (default: landscape)
[L/p] p
Loading configuration.
Finished parsing configuration.
Merging configuration parameters.
Loading configuration.
Finished parsing configuration.
Merging configuration parameters.
Loading configuration.
Finished parsing configuration.
Traceback (most recent call last):
File "/Users/Eonil/.apportable/SDK/bin/apportable", line 701, in <module>
run(env)
File "/Users/Eonil/.apportable/SDK/bin/apportable", line 677, in run
results = actions[args.action](env)
File "/Users/Eonil/.apportable/SDK/bin/apportable", line 95, in DebugAction
return env.DebugApp(site_init.BuildApplication(env, env['BUILD_TARGET']))
File "/Users/Eonil/.apportable/SDK/site_scons/site_init.py", line 351, in BuildApplication
return build.App(env, app_sconscript)
File "/Users/Eonil/.apportable/SDK/site_scons/build/__init__.py", line 619, in App
results = env.BuildApp(sources=sources, header_paths=headers, defines=defines, flags=flags, config=configs, deps=deps, libs=libs, java_libs=java_libs, assets=assets, pch=pchs, modules=modules, java_sources=java_sources, java_sourcepaths=java_sourcepaths, java_res_dirs=java_res_dirs)
File "/Users/Eonil/.apportable/SDK/lib/scons/engine/SCons/Environment.py", line 223, in __call__
return self.method(*nargs, **kwargs)
File "/Users/Eonil/.apportable/SDK/site_scons/site_init.py", line 915, in BuildApp
build.Module(env, module["build_cwd"], module)
File "/Users/Eonil/.apportable/SDK/site_scons/build/__init__.py", line 681, in Module
env.BuildModule(target["target"], sources=sources, header_paths=headers, defines=defines, flags=flags, deps=deps, libs=libs, java_libs=java_libs, assets=assets, pch=pchs, modules=modules, java_sources=java_sources, java_sourcepaths=java_sourcepaths, java_res_dirs=java_res_dirs)
File "/Users/Eonil/.apportable/SDK/lib/scons/engine/SCons/Environment.py", line 223, in __call__
return self.method(*nargs, **kwargs)
File "/Users/Eonil/.apportable/SDK/site_scons/site_init.py", line 1014, in BuildModule
BuildLibrary(env, name, sources=sources, header_paths=header_paths, static=True, defines=defines, flags=flags, deps=deps, libs=libs, pch=pch, app=True)
File "/Users/Eonil/.apportable/SDK/site_scons/site_init.py", line 755, in BuildLibrary
lib = building_env.StaticLibrary(name, objects)
File "/Users/Eonil/.apportable/SDK/lib/scons/engine/SCons/Environment.py", line 259, in __call__
return MethodWrapper.__call__(self, target, source, *args, **kw)
File "/Users/Eonil/.apportable/SDK/lib/scons/engine/SCons/Environment.py", line 223, in __call__
return self.method(*nargs, **kwargs)
File "/Users/Eonil/.apportable/SDK/lib/scons/engine/SCons/Builder.py", line 632, in __call__
return self._execute(env, target, source, OverrideWarner(kw), ekw)
File "/Users/Eonil/.apportable/SDK/lib/scons/engine/SCons/Builder.py", line 556, in _execute
_node_errors(self, env, tlist, slist)
File "/Users/Eonil/.apportable/SDK/lib/scons/engine/SCons/Builder.py", line 315, in _node_errors
raise UserError(msg)
SCons.Errors.UserError: Multiple ways to build the same target were specified for: Build/android-armeabi-debug/Eonil.Test9/iOS Static Library/libiOS Static Library.a (from ['Build/android-armeabi-debug/Eonil.Test9/Users/Eonil/Desktop/Apportable Knowledge Base and Bug Reporting/Running Test/Test9/Subproject1/Subproject1/Subproject1.m.o'] and from ['Build/android-armeabi-debug/Eonil.Test9/Users/Eonil/Desktop/Apportable Knowledge Base and Bug Reporting/Running Test/Test9/Subproject2/Subproject2/Subproject2.m.o'])
Erionirr:Test9 Eonil$
Currently this is not supported, we have been discussing internally on different methods to approach naming libraries that will avoid this issue but still keep linking somewhat streamlined. Keep tuned to our release notes page, when we get a solution for this we will definitely note it there with the user effective changes.
If it is not too inconvenient, giving your targets unique names like "iOS Static Library Cocos2D" should fix the issue until we can resolve this at the build system level.

Pyramid mongodb scaffold failing on Python 3 due to Paste

Environment:
Python 3.2.3 (using virtualenv)
Pyramid 1.4
pyramid_mongodb scaffold
After installing myproject using pyramid_mongodb scaffold I ran python setup.py test -q and it's failing with below errors.
running build_ext
Traceback (most recent call last):
File "setup.py", line 33, in <module>
""",
File "/usr/lib/python3.2/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.2/distutils/dist.py", line 917, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.2/distutils/dist.py", line 936, in run_command
cmd_obj.run()
File "/root/App/Big3/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg/setuptools /command/test.py", line 137, in run
self.with_project_on_sys_path(self.run_tests)
File "/root/App/Big3/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg/setuptools /command/test.py", line 117, in with_project_on_sys_path
func()
File "/root/App/Big3/lib/python3.2/site-packages/distribute-0.6.24-py3.2.egg/setuptools /command/test.py", line 146, in run_tests
testLoader = loader_class()
File "/usr/lib/python3.2/unittest/main.py", line 123, in __init__
self.parseArgs(argv)
File "/usr/lib/python3.2/unittest/main.py", line 191, in parseArgs
self.createTests()
File "/usr/lib/python3.2/unittest/main.py", line 198, in createTests
self.module)
File "/usr/lib/python3.2/unittest/loader.py", line 132, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python3.2/unittest/loader.py", line 132, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python3.2/unittest/loader.py", line 91, in loadTestsFromName
module = __import__('.'.join(parts_copy))
File "/root/App/Big3/Lime/lime/__init__.py", line 1, in <module>
from pyramid.config import Configurator
File "/root/App/Big3/lib/python3.2/site-packages/pyramid-1.4.1-py3.2.egg/pyramid/config /__init__.py", line 10, in <module>
from webob.exc import WSGIHTTPException as WebobWSGIHTTPException
File "/root/App/Big3/lib/python3.2/site-packages/WebOb-1.2.3-py3.2.egg/webob/exc.py", line 1115, in <module>
from paste import httpexceptions
File "/root/App/Big3/lib/python3.2/site-packages/Paste-1.7.5.1-py3.2.egg/paste /httpexceptions.py", line 634
except HTTPException, exc:
^
SyntaxError: invalid syntax
I understand the error, that Paste is not python3 compatible. I also know how to fix it but that would essentially mean porting Paste to python3 (which is something I don't want to do), so can anyone tell what I can do?
From the error stack I see that webob/exc.py is doing from paste import httpexceptions but when I checked the code I see that the import is under a try except block (without raising any error in except), so I even tried the test after removing paste from the lib but then when I run the test, I see that the setup.py is installing paste again
running test
Checking .pth file support in .
/root/App/Big3/bin/python -E -c pass
Searching for Paste>=1.7.1
I checked .pth files and removed reference to paste and then started re-installation of project but somehow it still sees paste as required
Installed /root/App/Big3/Myproject
Processing dependencies for Myproject==0.0
Searching for Paste>=1.7.1
Reading http://pypi.python.org/simple/Paste/
My setup.py file is same as this
Can someone tell me where is this paste dependency coming into my project.
I didn't intend to answer my own question but since I have made changes which are working for me, I thought I will share it here (assuming that there would be other folks wanting to have pyramid_mongodb scaffold work on python3)
Changes in development. ini
Removed
[pipeline:main]
pipeline =
egg:WebError#evalerror
{{project}}
Changed
[app:{{project}}] to [app:main]
Added (optional)
pyramid.includes =
pyramid_debugtoolbar
Changed server (from paste to waitress)
[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543
Changes in Setup.py
changed requires from
requires = ['pyramid', 'WebError', 'pymongo']
to
requires = ['pyramid', 'pyramid_debugtoolbar', 'pymongo', 'uwsgi', 'waitress']
It's important to remove webError
The application is now working...

Resources