ComponentLookupError: (<InterfaceClass zc.relation.interfaces.ICatalog>, '') with Dexterity references - reference

The following is a snippet from a dexterity content type which I'm working on. There are two content types, Programmes and Projects. It should be possible to associate a Project with a Programme (I've defined that below as a RelationChoice).
from five import grok
from plone.directives import dexterity, form
from zope import schema
from zope.schema.interfaces import IContextSourceBinder
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from zope.interface import invariant, Invalid
from z3c.form import group, field
from plone.namedfile.interfaces import IImageScaleTraversable
from plone.namedfile.field import NamedImage, NamedFile
from plone.namedfile.field import NamedBlobImage, NamedBlobFile
from plone.app.textfield import RichText
from z3c.relationfield.schema import RelationList, RelationChoice
from plone.formwidget.contenttree import ObjPathSourceBinder
from alteroo.programmeshowcase import MessageFactory as _
from alteroo.programmeshowcase.project import IProject
# Interface class; used to define content-type schema.
class IBaseProgramme(form.Schema, IImageScaleTraversable):
"""
Programme
"""
# If you want a schema-defined interface, delete the form.model
# line below and delete the matching file in the models sub-directory.
# If you want a model-based interface, edit
# models/progamme.xml to define the content type
# and add directives here as necessary.
form.model("models/programme.xml")
class IProgamme(IBaseProgramme):
"""A conference program. Programs can contain Sessions.
"""
project = RelationChoice(
title=_(u"Project"),
source=ObjPathSourceBinder(object_provides=IProject.__identifier__),
required=False,
)
The definition above results in an editing view that looks like this. When I try to add a related project it throws an error.
Here's the traceback I get when I try to add a related project:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module plone.z3cform.layout, line 66, in __call__
Module plone.z3cform.layout, line 50, in update
Module plone.dexterity.browser.add, line 112, in update
Module plone.z3cform.fieldsets.extensible, line 59, in update
Module plone.z3cform.patch, line 30, in GroupForm_update
Module z3c.form.group, line 141, in update
Module plone.app.z3cform.csrf, line 21, in execute
Module z3c.form.action, line 98, in execute
Module z3c.form.button, line 315, in __call__
Module z3c.form.button, line 170, in __call__
Module plone.dexterity.browser.add, line 99, in handleAdd
Module z3c.form.form, line 247, in createAndAdd
Module plone.dexterity.browser.add, line 78, in add
Module plone.dexterity.utils, line 167, in addContentToContainer
Module OFS.ObjectManager, line 358, in _setObject
Module zope.event, line 31, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module zope.component.event, line 32, in objectEventNotify
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module five.intid.intid, line 101, in addIntIdSubscriber
Module zope.event, line 31, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module z3c.relationfield.event, line 39, in addRelationsEventOnly
Module z3c.relationfield.event, line 28, in addRelations
Module z3c.relationfield.event, line 143, in _setRelation
Module zope.component._api, line 169, in getUtility
ComponentLookupError: (<InterfaceClass zc.relation.interfaces.ICatalog>, '')

You need to activate "Relation Field" (plone.app.relationfield) in the Addons control panel to install the relation catalog.

Related

AttributeError: module 'tensorflow' has no attribute 'placeholder' on Python 3.8 and Tensorflow 2.0 and Keras-Bert

I am getting this error on the line 273 even though I'm not using the placeholder in my code.
Using TensorFlow backend.
Traceback (most recent call last):
File "GA5.py", line 273, in <module>
model = load_trained_model_from_checkpoint(config_path,checkpoint_path,training=True,trainable=True,seq_len=SEQ_LEN)
File "/home/kosimadukwe/.local/lib/python3.8/site-packages/keras_bert/loader.py", line 163, in load_trained_model_from_checkpoint
model, config = build_model_from_config(
File "/home/kosimadukwe/.local/lib/python3.8/site-packages/keras_bert/loader.py", line 46, in build_model_from_config
model = get_model(
File "/home/kosimadukwe/.local/lib/python3.8/site-packages/keras_bert/bert.py", line 85, in get_model
inputs = get_inputs(seq_len=seq_len)
File "/home/kosimadukwe/.local/lib/python3.8/site-packages/keras_bert/layers/inputs.py", line 12, in get_inputs
return [keras.layers.Input(
File "/home/kosimadukwe/.local/lib/python3.8/site-packages/keras_bert/layers/inputs.py", line 12, in <listcomp>
return [keras.layers.Input(
File "/usr/pkg/lib/python3.8/site-packages/keras/engine/input_layer.py", line 175, in Input
input_layer = InputLayer(batch_input_shape=batch_shape,
File "/usr/pkg/lib/python3.8/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/usr/pkg/lib/python3.8/site-packages/keras/engine/input_layer.py", line 84, in __init__
input_tensor = K.placeholder(shape=batch_input_shape,
File "/usr/pkg/lib/python3.8/site-packages/keras/backend/tensorflow_backend.py", line 517, in placeholder
x = tf.placeholder(dtype, shape=shape, name=name)
AttributeError: module 'tensorflow' has no attribute 'placeholder'
I have searched similar errors and added these import lines as suggested
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
I am using Python3.8 and Tensorflow2.0 and Keras-bert. and from the tests ive done its most likely due to Keras-Bert.
Can anyone give me suggestions? I'm all out of options.

Error while creating a service using nameko for Pysnmp get_request--Attempted "nameko_entrypoints" operation on ASN.1 schema object

I am new to pysnmp and nameko. I have been assignment a work to create a service in nameko framework to perform snmp get_request using pysnmp library.
Below is the code i have tried
from pysnmp.hlapi import *
from nameko.rpc import rpc
class GreetingService(object):
name = "greeting_service"
#rpc
def getFunc(oid):
errorIndication, errorStatus, errorIndex, varBinds = next(
getCmd(SnmpEngine(),
CommunityData('public', mpModel=0),
UdpTransportTarget(('snmp.live.gambitcommunications.com', 161)),
ContextData(),
ObjectType(ObjectIdentity('SNMPv2-MIB', oid, 0)))
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
if __name__ == "__main__":
getFunc('sysName')
when i try to start the service using terminal with the following command
$ nameko run helloworld
I get the following error message.
syed#syed-ThinkPad-E480:~/Pysnmp$ nameko run helloworld
Traceback (most recent call last):
File "/home/syed/.local/bin/nameko", line 11, in <module>
sys.exit(main())
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/main.py", line 112, in main
args.main(args)
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/commands.py", line 110, in main
main(args)
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/run.py", line 181, in main
import_service(path)
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/run.py", line 71, in import_service
if inspect.getmembers(potential_service, is_entrypoint):
File "/usr/lib/python3.7/inspect.py", line 354, in getmembers
if not predicate or predicate(value):
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/run.py", line 35, in is_entrypoint
return hasattr(method, ENTRYPOINT_EXTENSIONS_ATTR)
File "/home/syed/.local/lib/python3.7/site-packages/pyasn1/type/base.py", line 221, in __getattr__
raise error.PyAsn1Error('Attempted "%s" operation on ASN.1 schema object' % attr)
pyasn1.error.PyAsn1Error: Attempted "nameko_entrypoints" operation on ASN.1 schema object
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/home/syed/.local/bin/nameko", line 11, in <module>
sys.exit(main())
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/main.py", line 112, in main
args.main(args)
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/commands.py", line 110, in main
main(args)
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/run.py", line 181, in main
import_service(path)
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/run.py", line 71, in import_service
if inspect.getmembers(potential_service, is_entrypoint):
File "/usr/lib/python3.7/inspect.py", line 354, in getmembers
if not predicate or predicate(value):
File "/home/syed/.local/lib/python3.7/site-packages/nameko/cli/run.py", line 35, in is_entrypoint
return hasattr(method, ENTRYPOINT_EXTENSIONS_ATTR)
File "/home/syed/.local/lib/python3.7/site-packages/pyasn1/type/base.py", line 221, in __getattr__
raise error.PyAsn1Error('Attempted "%s" operation on ASN.1 schema object' % attr)
pyasn1.error.PyAsn1Error: Attempted "nameko_entrypoints" operation on ASN.1 schema object
Please help me out to understand weather what i have tried is correct way or else it is wrong.. If so how to rectify the mistake.
Any help will be appreciable.
Thanks in advance
It has something to do with the way how nameko hooks up your code...
It seems to try looking up nameko_entrypoints attribute at all objects it can find in your module eventually running into ASN.1 schema objects (which are sacred and should not be used for anything other than blueprinting purposes).
My suggestion would be to replace from pysnmp.hlapi import * with specific imports of pysnmp classes/functions you are using in your code. That should hopefully hide fragile pieces out of nameko's sight.

Python3.7 is not compatible with Tensorflow?

I am trying to continue with a Rasa chatbot that I have not used since September and I find a syntax problem with the dependency of Tensorflow. I do not know if this is due to the fact that there are updates to be made with my dependencies or if it due to the fact that I use python3.7 as suggested by people on GitHub, or some other reason.
(moo_env) C:\Users\antoi\Documents\Programming\projects\moodbot>py train_online.py
Traceback (most recent call last):
File "train_online.py", line 37, in <module>
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/moodnlu')
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_core\interpreter.py", line 221, in __init__
self._load_interpreter()
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_core\interpreter.py", line 237, in _load_interpreter
self.interpreter = Interpreter.load(self.model_directory)
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\model.py", line 276, in load
skip_validation)
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\model.py", line 298, in create
components.validate_requirements(model_metadata.component_classes)
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\components.py", line 49, in validate_requirements
from rasa_nlu import registry
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\registry.py", line 23, in <module>
from rasa_nlu.classifiers.embedding_intent_classifier import \
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\classifiers\embedding_intent_classifier.py", line 32, in <module>
import tensorflow as tf
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 114
def TFE_ContextOptionsSetAsync(arg1, async):
SyntaxError: invalid syntax
You can find my code in Github repository
The reason is this line in pywrap_tensorflow_internal.py:
def TFE_ContextOptionsSetAsync(arg1, async):
Since Python 3.5, async (and await) are keywords and can no longer be used as identifiers. I assume you use a very outdated version of tensorflow.

when i run my code in pycharm it is working fine but when i try to run the same code from server i am getting error

hi i am new to selenium automation .
The code which i have written is working fine and executing in both pycharm and command prompt but when i try to execute the same code from remote server i am getting the below error .
I understand it as do something with pynput but i am not able to figure out how to solve it .
If anyone know about it please help me out .
File "/home/manoj/forum-test-suite/test_forum_page/PageObject/common_methods.py", line 6, in <module>
from pynput.keyboard import Key,Controller
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/__init__.py", line 23, in <module>
from . import keyboard
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/keyboard/__init__.py", line 49, in <module>
from ._xorg import KeyCode, Key, Controller, Listener
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/keyboard/_xorg.py", line 39, in <module>
from pynput._util.xorg import (
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/_util/xorg.py", line 40, in <module>
_check()
File "/home/manoj/newenv/lib/python3.6/site-packages/pynput/_util/xorg.py", line 38, in _check
display = Xlib.display.Display()
File "/home/manoj/newenv/lib/python3.6/site-packages/Xlib/display.py", line 89, in __init__
self.display = _BaseDisplay(display)
File "/home/manoj/newenv/lib/python3.6/site-packages/Xlib/display.py", line 71, in __init__
protocol_display.Display.__init__(self, *args, **keys)
File "/home/manoj/newenv/lib/python3.6/site-packages/Xlib/protocol/display.py", line 167, in __init__
raise error.DisplayConnectionError(self.display_name, r.reason)
The issue is with respect to the pynput , you need to go to your .bashprofile and append
the pynput path , in PYTHONPATH that you have set .By doing this i was able to solve this issue.

Tensorflow Object Detection Training Error

I am following tutorial for Tensorflow Object Detection
link
and getting the following command when i try this command
python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config
error:
FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
from ._conv import register_converters as _register_converters
Traceback (most recent call last):
File "train.py", line 49, in <module>
from object_detection import trainer
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\trainer.py", line 32, in <module>
from object_detection.utils import variables_helper
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\utils\variables_helper.py", line 23, in <module>
slim = tf.contrib.slim
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 53, in __getattr__
module = self._load()
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\python\util\lazy_loader.py", line 42, in _load
module = importlib.import_module(self.__name__)
File "C:\Users\ASUS PC\Anaconda3\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\__init__.py", line 37, in <module>
from tensorflow.contrib import distributions
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\distributions\__init__.py", line 39, in <module>
from tensorflow.contrib.distributions.python.ops.estimator import *
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\distributions\python\ops\estimator.py", line 21, in <module>
from tensorflow.contrib.learn.python.learn.estimators.head import _compute_weighted_loss
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\learn\__init__.py", line 95, in <module>
from tensorflow.contrib.learn.python.learn import *
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\__init__.py", line 28, in <module>
from tensorflow.contrib.learn.python.learn import *
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\__init__.py", line 40, in <module>
from tensorflow.contrib.learn.python.learn.experiment import Experiment
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\experiment.py", line 39, in <module>
from tensorflow.contrib.tpu.python.tpu import tpu_estimator
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\tpu\__init__.py", line 54, in <module>
from tensorflow.contrib.tpu.python import profiler
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\tpu\python\profiler\__init__.py", line 23, in <module>
from tensorflow.contrib.tpu.profiler.tpu_profiler_analysis_pb2 import *
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\tpu\profiler\tpu_profiler_analysis_pb2.py", line 16, in <module>
from tensorflow.contrib.tpu.profiler import tpu_profiler_pb2 as tensorflow_dot_contrib_dot_tpu_dot_profiler_dot_tpu__profiler__pb2
File "C:\Users\ASUS PC\Anaconda3\lib\site-packages\tensorflow\contrib\tpu\profiler\tpu_profiler_pb2.py", line 395, in <module>
_sym_db.RegisterServiceDescriptor(_TPUPROFILER)
AttributeError: 'SymbolDatabase' object has no attribute 'RegisterServiceDescriptor'
anybody faced this types of error? If so how can i solve the problem?
I is definitely related to something being off in your setup.py. Here is a thread that may help: https://github.com/GoogleCloudPlatform/cloudml-samples/issues/146. You may need to specify the version of the packages you are using as well.
link
In here the same issue is discussed and they found a solution. The problem is protobuf version i think.

Resources