SDN k shortest path with pyretic - sdn

can anybody help me with this code?
if i run this code with pyretic, the pyretic will says
File "/home/ibrahim/pyretic/pyretic.py", line 313, in <module>
main()
File "/home/ibrahim/pyretic/pyretic.py", line 191, in main
module = import_module(module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/ibrahim/pyretic/pyretic/examples/kshortestpathpyretic.py", line 58
distances[node_start]=0
^
IndentationError: unindent does not match any outer indentation level
What s wrong with this code if i run this codewith pyretic
the image is the result if i run this code with pyretic controller

as the error messages said, You need to correct the indentation (tab between blocks) in the python source code.
I can't see your code as the link is not available.

Related

Incorrect context when trying to reload text

in order to develop my script in an external IDE, I'm trying to automatically reload a text in blender when it is modified from outside of Blender. I think I've got the idea of how it works, but there must be one tiny detail that completely blocks me from achieving my goal.
My script is the following:
import bpy
import sys
ctx = bpy.context.copy()
for area in ctx['screen'].areas:
if area.type == 'TEXT_EDITOR':
textEditor = area
for text in bpy.data.texts:
if text.name == 'main.py':
textEditor.spaces[0].text = text
bpy.ops.text.reload()
Output:
>>> exec(bpy.data.texts['reload.py'].as_string())
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
File "<string>", line 13, in <module>
File "/Applications/Blender.app/Contents/Resources/3.3/scripts/modules/bpy/ops.py", line 113, in __call__
ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.text.reload.poll() failed, context is incorrect
I cannot get what part of the context is correct. I found no solution on the Internet, even the doc recommends reading the source code to understand what might be the cause of this error, but I couldn't find it anyway in the source code.
Can someone tell me what I am missing here please?

How to have multi-page table row cells converted properly using rst2pdf Shpinx?

I have a table of which one-row cell has so much data that it could span multiple pages in the finally-generated PDF file. rst2pdf ungracefully fails when I feed it my file, with the following output:
[ERROR] pdfbuilder.py:161 Failed to build doc
Traceback (most recent call last):
File "/home/pwng/.local/lib/python3.9/site-packages/rst2pdf/pdfbuilder.py", line 158, in write
docwriter.write(doctree, destination)
File "/usr/lib/python3/dist-packages/docutils/writers/__init__.py", line 78, in write
self.translate()
File "/home/pwng/.local/lib/python3.9/site-packages/rst2pdf/pdfbuilder.py", line 697, in translate
createpdf.RstToPdf(
File "/home/pwng/.local/lib/python3.9/site-packages/rst2pdf/createpdf.py", line 689, in createPdf
pdfdoc.multiBuild(elements)
File "/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.py", line 1167, in multiBuild
self.build(tempStory, **buildKwds)
File "/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.py", line 1080, in build
self.handle_flowable(flowables)
File "/home/pwng/.local/lib/python3.9/site-packages/rst2pdf/createpdf.py", line 859, in handle_flowable
self.handle_frameEnd()
File "/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.py", line 726, in handle_frameEnd
self.handle_pageEnd()
File "/usr/lib/python3/dist-packages/reportlab/platypus/doctemplate.py", line 668, in handle_pageEnd
raise LayoutError(ident)
reportlab.platypus.doctemplate.LayoutError: More than 10 pages generated without content - halting layout. Likely that a flowable is too large for any frame.
FAILED
build succeeded.
and make latexpdf produce undesirable output depicted in the following screenshot.
Is there a way to remedy this problem using either latexpdf or rst2pdf? Ideally, I would like a solution that works for both spaced text (i.e. space-separated words) and consecutive, wrapped non-separated text.
This isn't the answer you want, but rst2pdf won't split the cell across pages, so if it doesn't fit onto the page, it won't be able to generate the document. The project (I'm a maintainer) is open to patches, in case you end up fixing it yourself. I'm not aware of a workaround, other than reformatting the content to be more printable.

Odoo 12: 'report.label.report_label' AttributeError

I am using a third-party module in Odoo to do mass label printing (https://www.odoo.com/apps/modules/12.0/label/) and despite the fact that the module claims to be compatible with version 12, I am getting server errors when trying to run the pdf rendering:
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1677, in report_download
response = self.report_routes(reportname, converter=converter, **dict(data))
File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1614, in report_routes
pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 677, in render_qweb_pdf
html = self.with_context(context).render_qweb_html(res_ids, data=data)[0]
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 710, in render_qweb_html
data = self._get_rendering_context(docids, data)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions_report.py", line 723, in _get_rendering_context
data.update(report_model._get_report_values(docids, data=data))
AttributeError: 'report.label.report_label' object has no attribute '_get_report_values'
Screenshot:
It may be an error related to the change of some Odoo version (or not, I don’t really know).
Does anyone know if this attribute exist? I haven’t been able to find this information in the Odoo documentation (it doesn’t seem very complete regarding these topic).
Here are some screenshots of the configurations I’m using:
Thank you for your help!
From the traceback you shared on first screenshot, the problem seems to be with report_model variable which is reference to report.label.report_label object, defined in label/report/dunamic_model.py file which contains the method get_report_values. But from odoo 12 community code, ir.actions.report is looking for _get_report_values, the mismatch between this two method name is actually causing the problem.

AttributeError when adding sharing permission to a user

When I assign a new sharing permission level to any user,
I get this error
It seems that any folder or user produces this error. There are some users with sharing permissions already, which means this used to work before. I'm not sure what happened from then until now that changed this.
Have any of you encountered this problem before?
Error log :
Traceback (innermost last):
Module ZPublisher.Publish, line 115, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 41, in call_object
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 14, in folder_localrole_edit
- <FSPythonScript at /intranet/folder_localrole_edit used for /intranet/service-areas/management-services>
- Line 14
Module <string>, line 4, in _facade
Module Products.Hotfix_20070320, line 68, in _curried
Module Products.CMFCore.MembershipTool, line 437, in setLocalRoles
Module Products.Archetypes.CatalogMultiplex, line 70, in reindexObjectSecurity
Module Products.ZCatalog.CatalogBrains, line 52, in _unrestrictedGetObject
Module OFS.Traversable, line 187, in unrestrictedTraverse
- __traceback_info__: (['mailer', 'formfolder.2009-03-22.3253705634', 'FormFolder', 'portal_factory'], 'one-melville-brand-update-2009-1')
Module Products.Five.traversable, line 126, in __bobo_traverse__
AttributeError: one-melville-brand-update-2009-1
It seems like your portal_catalog tool is inconsistent.
This means you have catalog entries (brain), with no real content (Archetype object).
You can solve this by "Clear and Rebuild" your catalog.
http://localhost:8080/${PATH_TO_PLONE}/portal_catalog/manage_catalogAdvanced -> Clear and rebuilt.
This action can take long time, depending on how many content you have.
Short explanation what seems to happen in your case:
After changing the local roles on a specific object, Plone tries to reindex the security relevant portal catalog indexes on the object itself and on all subobjects. While reindexing the subcontent it tries to get some data of a inexistent object (AttributeError while traversal).
With a fresh catalog you can avoid such errors.

Domain filter with '&' doesn't work in openerp7

Below is what i need to do
(Condition A and Condition B) or Condition C
(partner_id = partner_id **and** user_ids = context.get(uid)) **or** userid = 1
The possible domain filters i've tried are
domain="['|',('user_ids','=',1),'&',('partner_id','=',partner_id),('user_ids','=',context.get('uid'))]"
domain="['|','&',('partner_id','=',partner_id),('user_ids','=',context.get('uid')),('user_ids','=',1)]"
Nothing works out and the error i get is below
File "D:\workspace\Techtalk\openerp\modules\loading.py", line 76, in <lambda>
load_data = lambda *args: _load_data(cr, *args, kind='data')
File "D:\workspace\Techtalk\openerp\modules\loading.py", line 124, in _load_data
tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)
File "D:\workspace\Techtalk\openerp\tools\convert.py", line 941, in convert_xml_import
doc = etree.parse(xmlfile)
File "lxml.etree.pyx", line 2698, in lxml.etree.parse (src/lxml/lxml.etree.c:49590)
File "parser.pxi", line 1513, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:71423)
File "parser.pxi", line 1543, in lxml.etree._parseFilelikeDocument (src/lxml/lxml.etree.c:71733)
File "parser.pxi", line 1426, in lxml.etree._parseDocFromFilelike (src/lxml/lxml.etree.c:70648)
File "parser.pxi", line 997, in lxml.etree._BaseParser._parseDocFromFilelike (src/lxml/lxml.etree.c:67944)
File "parser.pxi", line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63820)
File "parser.pxi", line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:64741)
File "parser.pxi", line 565, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64084)
XMLSyntaxError: xmlParseEntityRef: no name, line 144, column 12
Links i've refered are
http://help.openerp.com/question/2170/domain-notation-using-multiple-and-nested-and/
OpenERP ver 7 Domain filter with more conditions
Additional Notes
I could not find a single domain filter with & operator in openerp source.
Am i missing something? Kindly suggest. Thanks for your time.
The error message suggests that your XML contains an invalid entity, i.e. a bare ampersand & character. As it is a predefined XML entity, you must escape it as &.
The reason why you may not find many domain using & in the OpenERP source code is because the AND (&) operator is the default one, so you can omit it entirely in most cases. And that's convenient because of the escaping problem.
Still, it may be necessary when you combine OR/AND operators, so you can find examples in advanced security rules, which also use the same domain syntax, such as here.
In general if you want (A and B) or C you can indeed write it as:
['|',C,'&',A,B]
which means your XML file should contain:
['|',C,'&',A,B]