TraCI Module - Problems running traci.start(sumoCmd) - sumo

sumoBinary = "/usr/bin/sumo-gui"
sumoCmd = [sumoBinary, "-c", "map.sumo.cfg"]
import traci
traci.start(sumoCmd)
When I use the traci.start(sumoCmd) I get the following error:
AtributeError: 'module' object has no attribute 'start'
What is logical because if I search for the traci module, and use the dir command to analyze there is no start function at all:
['FatalTraCIError', 'Message', 'Storage', 'SubscriptionResults', 'TraCIException', '_DEBUG', '_RESULTS', '_STEPS2TIME', '_TIME2STEPS', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '_beginMessage', '_checkResult', '_connections', '_embedded', '_message', '_modules', '_readSubscription', '_recvExact', '_sendByteCmd', '_sendDoubleCmd', '_sendExact', '_sendIntCmd', '_sendReadOneStringCmd', '_sendStringCmd', '_subscribe', '_subscribeContext', 'areal', 'close', 'constants', 'edge', 'getParameterAccessors', 'getVersion', 'gui', 'inductionloop', 'init', 'isEmbedded', 'junction', 'lane', 'multientryexit', 'person', 'poi', 'polygon', 'print_function', 'route', 'simulation', 'simulationStep', 'socket', 'struct', 'switch', 'time', 'trafficlights', 'vehicle', 'vehicletype']
This function is well used and I thought it was included in the traci module.
As it can be seen: http://www.sumo.dlr.de/wiki/TraCI/Interfacing_TraCI_from_Python
Can anyone explain how can I locate it? Thanks
Also because of omnet++ I am using sumo-0.25.0 , was traci.start included in a later version?

Updated sumo traci module to a newer one (0.29) and it worked out.
Unfortunately, sumo-0.25 traci module doesn't have traci.start(sumoCmd) function

Related

How i can generate a content table in a pdf using wkhtml2pdf in a django application

My goal is to generate a pdf in my django application, i would like to set a content table in the second page(page 2 of the pdf) using wkhtml2pdf,
I have add these new lines where i have put "2"(number of page where i want to display my content table) in the option --dump-default-toc-xsl, and i have put in the option (--dump-outline and -xsl-style-sheet) the file name of my html pdf that i want to render it to a pdf.
'--outline': True,
'--dump-outline':'/home/dev/.virtualenvs/django-projects/project1/templates/pages/generate_pdf.html',
'-xsl-style-sheet':'/home/dev/.virtualenvs/django-projects/project1/templates/pages/generate_pdf.html',
'--dump-default-toc-xsl':2,
this all the code in my settings.py
WKHTMLTOPDF_CMD = '/usr/local/bin/wkhtmltopdf'
WKHTMLTOPDF_CMD_OPTIONS = {
'quiet':True,
'disable-smart-shrinking':True,
'enable-local-file-access':True,
'page-size':'A4',
'margin-right':'0',
'margin-top':'15',
'margin-bottom':'10',
'margin-left':'3',
'encoding':"UTF-8",
#'--outline': None,
"zoom":1,
'javascript-delay':1000,
'footer-center':'[page]/[topage]',
"no-stop-slow-scripts":True,
'outline': True,
'dump-outline':'/home/dev/.virtualenvs/django-projects/project1/templates/pages/generate_pdf.html',
'xsl-style-sheet':'/home/dev/.virtualenvs/django-projects/project1/templates/pages/generate_pdf.html',
'dump-default-toc-xsl':2,
}
------> those lines that i have add generate me an error said:
CalledProcessError at /report/
Command '['/usr/local/bin/wkhtmltopdf', '----dump-default-toc-xsl', '2', '----dump-outline', '/home/dev/.virtualenvs/django-projects/project1/templates/pages/generate_pdf.html', '----outline', 'True', '---xsl-style-sheet', '/home/dev/.virtualenvs/django-projects/project1/templates/pages/generate_pdf.html', '--disable-smart-shrinking', '--enable-local-file-access', '--encoding', 'UTF-8', '--footer-center', '[page]/[topage]', '--javascript-delay', '1000', '--margin-bottom', '10', '--margin-left', '3', '--margin-right', '0', '--margin-top', '15', '--no-stop-slow-scripts', '--page-size', 'A4', '--quiet', '--zoom', '1', '/tmp/wkhtmltopdf3m5sidam.html', '-']' returned non-zero exit status 1.
Is it possible to generate a content table in a pdf using wkhtml2pdf in a django application!
any help will be appreciated am stuck on.thanks in advance.

Catalog product page gives error 500 after upgrade from 1.7.3 to 1.7.6

I can't access the product catalog page or edit any products after upgrading from 1.7.3.1 to 1.7.6.1
It gives me two fatal php errors.
The first exception: Twig\Error\RuntimeError
in src/PrestaShopBundle/Resources/views/Admin/layout.html.twig (line 34)
layoutHeaderToolbarBtn is defined ? layoutHeaderToolbarBtn : [],
layoutDisplayType is defined ? layoutDisplayType : '',
showContentHeader is defined ? showContentHeader : true,
headerTabContent is defined ? headerTabContent : '',
enableSidebar is defined ? enableSidebar : false,
Line 34 help_link is defined ? help_link : ''
)
)) %}
{% import '#PrestaShop/Admin/macros.html.twig' as ps %}
The second exception: Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
in vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php (line 348)
if ($lev <= \strlen($id) / 3 || false !== strpos($knownId, $id)) {
$alternatives[] = $knownId;
}
}
throw new ServiceNotFoundException($id, null, null, $alternatives);
}[enter image description here][1]
}
/**
* Returns true if the given service has actually been initialized.
Cross posted here https://www.prestashop.com/forums/topic/1003821-catalog-product-page-gives-error-500-after-upgrade-from-173-to-176/
Error screenshot
Turns out, that the related products module was not updated. It's a module bought on the Marketplace. I checked the compatibility and it said it was compatible with 1.7.6.1, so for that reason, combined with my backoffice telling me i had 0 available updates and that the module was up to date, i assumed it was all good.
But apparently, modules bought on the marketplace, don't have their updates show up in prestashop. 
I fixed the issue, by uninstalling the related products module and downloading the newest one 1.6.4 instead of 1.6.3 from the prestashop marketplace.

Update Context in Odoo Controller (request.env.context)

I want to update request context,
request.env.context
At the moment I got this dictionary
{'lang': u'en_US', 'tz': False, 'uid': 21}
I wanna update lang key, and expected output of
request.env.context
{'lang': 'de_DE', 'tz': False, 'uid': 21}
Any idea how.
context = request.env.context.copy()
context.update({'lang': u'en_CA'})
request.env.context = context
Below code works well for me, I am guessing that you are working with a pos.order model
pos_order = request.env['pos.order'].with_context(
lang='de_DE')

BigQuery API Job AllowLargeResults

I am currently passing allowLargeResults:True to the BigQuery API via a Job, and I am getting the following error:
Reason:invalidQuery. Message:Unclosed string literal at: 1:779
The strange thing is that if I set it to False, it works fine.
My full job:
{u'status': {u'state': u'RUNNING'}, u'kind': u'bigquery#job',
u'statistics': {u'creationTime': u'1442029780703', u'startTime':
u'1442029780902'}, u'jobReference': {u'projectId': u'api-project-617799710969',
u'jobId': u'job_1UBxC6nXSBRRerkGNUNr6_DdyPU'},
u'etag': u'"m-xx"', u'user_email': u'xx#google.com', u'configuration':
{u'query': {u'query': u'SELECT * FROM table ', u'writeDisposition':
u'WRITE_TRUNCATE', u'allowLargeResults': True, u'destinationTable':
{u'projectId': u'api-project-617799710969', u'tableId': u'table',
u'datasetId': u'dataset'}}}, u'id': u'api-project-
617799710969:job_1UBxC6nXSBRRerkGNUNr6_DdyPU', u'selfLink':
u'https://www.googleapis.com/bigquery/v2/projects/api-project-617799710969/jobs/job_1UBxC6nXSBRRerkGNUNr6_DdyPU'}

Set default date in OpenERP

I'm working at creating a module for OpenERP 7 to set Today's Date as default value when creating a new Partner. I've installed the module, restarted the Openerp service and defaults aren't changed a bit. (I'd included a "goofball" field and bogus default data for the website field to make sure it's not a python lambda code problem. It wasn't...) Here's my code in partner.py:
from osv import osv, fields
import datetime
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {"goofball":fields.char('goofball', size=15)}
_defaults = {
'website': 'www.veppsight.com',
'date': lambda *a: datetime.date.today().strftime('%Y-%m-%d'),
}
The default data isn't entered for the website & date fields and the "goofball" field isn't create in the database which I verified in psql. What am I doing wrong?
Since V6.1 there is a new function to deal with today's date, called context_today.
You can check background on this at the following link...
http://openerp-expert-framework.71550.n3.nabble.com/Bug-925361-Re-6-1-date-values-that-are-initialized-as-defaults-may-appear-as-quot-off-by-one-day-quoe-td3741270.html
Based on that, you can just use...
_ defaults = {
'date1': fields.date.context_today,
}
Regards,
-Mario
Import time and In the defaults
_defaults = {
'website': 'www.veppsight.com',
'date': lambda *a: time.strftime('%Y-%m-%d'),
}
Use following code :
from osv import osv, fields
import time
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {"goofball":fields.char('goofball', size=15)}
_defaults = {
'website': 'www.veppsight.com',
'date1': time.strftime('%Y-%m-%d'),
}
AND IF POSSIBLE RENAME FIELD NAME DATE TO SOMETHING ELSE. AS DATE IS DT IN POSTGRESQL
Thank You
_defaults = {
'date': lambda self,cr,uid,context={}: context.get('date', fields.date.context_today(self,cr,uid,context=context)),
or
'date': lambda self, cr, uid, context={}: context.get('date', time.strftime("%Y-%m-%d %H:%M:%S")),
or
'date' : fields.date.context_today,
}
Lambda is a in line or anonymous function in python.
How about this:
from osv import osv, fields
import time
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {"goofball": fields.char('goofball', size=15)}
_defaults = {
'website': 'www.veppsight.com',
'date1': lambda *a: time.strftime('%Y-%m-%d'),
}
res_partner()