Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Libsumo for python

Thanks Michael,

I've been using the getSubscriptionResult and it works fine. I was just wondering if getAllSubscriptionResults would be faster. Will keep using the one by one method.

Regards,

	Didac

-----Original Message-----
From: Michael Behrisch <oss@xxxxxxxxxxx> 
Sent: 05 October 2018 23:02
To: Didac Busquets <didac.busquets@xxxxxxxxxx>; Sumo project User discussions <sumo-user@xxxxxxxxxxx>
Subject: Re: [sumo-user] Libsumo for python

Hi Didac,
the translation of the C++ to the Python object is still incomplete, but if you retrieve the results one by one (using something like
libsumo.lanearea.getSubscriptionResults(one_area)) you should get a normal python dict as result.

Best regards,
Michael

Am 05.10.18 um 13:09 schrieb Didac Busquets:
> Hi Michael,
> 
> I recompiled everything and now it works.
> 
> I now have another question. I'm using libsumo and subscriptions, and have some code similar to this:
> 
> libsumo.lanearea.subscribe(one_area, 
> (libsumo.constants.LAST_STEP_OCCUPANCY,libsumo.constants.JAM_LENGTH_ME
> TERS))
> ...
> result = libsumo.lanearea.getAllSubscriptionResults()
> 
> The type of result is SwigPyObject. How should I handle it to get the results of subscriptions?
> 
> Thanks,
> 
> 	Didac
> 
> 
> -----Original Message-----
> From: Michael Behrisch <oss@xxxxxxxxxxx>
> Sent: 27 September 2018 22:21
> To: Sumo project User discussions <sumo-user@xxxxxxxxxxx>; Didac 
> Busquets <didac.busquets@xxxxxxxxxx>
> Subject: Re: [sumo-user] Libsumo for python
> 
> Hi Didac,
> it should not be necessary to have tools/libsumo in the python path.
> Where does SUMO_HOME point to?
> 
> Best regards,
> Michael
> 
> Am 25.09.18 um 15:39 schrieb Didac Busquets:
>> Hi,
>>
>>  
>>
>> I've compiled v1.0.1 and when trying to use the python libsumo I get 
>> this error:
>>
>>  
>>
>> $ python
>>
>> Python 3.6.4 |Anaconda custom (64-bit)| (default, Jan 16 2018,
>> 10:22:32) [MSC v.1900 64 bit (AMD64)] on win32
>>
>> Type "help", "copyright", "credits" or "license" for more information.
>>
>>>>> import libsumo
>>
>> Traceback (most recent call last):
>>
>>   File "<stdin>", line 1, in <module>
>>
>>   File "C:\Program Files
>> (x86)\DLR\sumo-1.0.1\tools\libsumo\__init__.py", line 15, in <module>
>>
>>     from .libsumo import *  # noqa
>>
>>   File "C:\Program Files
>> (x86)\DLR\sumo-1.0.1\tools\libsumo\libsumo.py",
>> line 5896, in <module>
>>
>>     vehicle.addLegacy =
>> wrapAsClassMethod(_vehicle.VehicleDomain.addLegacy, vehicle)
>>
>> AttributeError: type object 'VehicleDomain' has no attribute 'addLegacy'
>>
>>  
>>
>> I've added both the tools and tools/libsumo in the PYTHONPATH env variable.
>>
>>  
>>
>> However, if I run it from the tools folder, libsumo loads correctly.
>>
>>  
>>
>> Am I missing something?
>>
>>  
>>
>> Thanks,
>>
>>  
>>
>>                Didac
>>
>>  
>>
>> Immense Simulations Limited <https://htmlsig.com/t/000001D1FAJA>
>>
>> https://s3.amazonaws.com/htmlsig-assets/spacer.gif
>>
>> Twitter
>> <https://htmlsig.com/t/000001DMCGQH>https://s3.amazonaws.com/htmlsig-
>> a
>> ssets/spacer.gifFacebook
>> <https://htmlsig.com/t/000001DRXRE6>https://s3.amazonaws.com/htmlsig-
>> a
>> ssets/spacer.gifLinkedIn
>> <https://htmlsig.com/t/000001CVTDTW>https://s3.amazonaws.com/htmlsig-
>> a
>> ssets/spacer.gif
>>
>> https://s3.amazonaws.com/htmlsig-assets/spacer.gif
>>
>> 	
>>
>> https://s3.amazonaws.com/htmlsig-assets/spacer.gif
>>
>> 	
>>
>> https://s3.amazonaws.com/htmlsig-assets/spacer.gif
>>
>> 	
>>
>> *Didac Busquets*/ Co-Founder and Chief Scientist 
>> didac.busquets@xxxxxxxxxx <mailto:didac.busquets@xxxxxxxxxx> / +44 
>> (0)
>> 7919 076 981
>>
>> https://s3.amazonaws.com/htmlsig-assets/spacer.gif
>>
>> *Immense Simulations Limited*
>> Studio J2, Witan Studios, 279 Witan Gate, Central Milton Keynes, MK9 
>> 1EJ
>> *w3w*: ourselves.depend.backpack
>> <:%20https:/map.what3words.com/ourselves.depend.backpack>
>> www.immense.ai <https://www.immense.ai/>
>>
>> https://s3.amazonaws.com/htmlsig-assets/spacer.gif
>>
>> https://s3.amazonaws.com/htmlsig-assets/spacer.gif
>>
>> This e-mail including any attachments is intended for the addressee 
>> only. It is private, confidential and may be covered by legal 
>> professional privilege. If you have received this message in error 
>> please notify us immediately and remove it from your system. Immense 
>> Simulations Limited is a Company registered in England and Wales No.
>> 09782647. Registered offices: International House, 24 Holborn 
>> Viaduct, City Of London, London, England, EC1A 2BN.
>>
>>  
>>
>>
>> _______________________________________________
>> sumo-user mailing list
>> sumo-user@xxxxxxxxxxx
>> To change your delivery options, retrieve your password, or 
>> unsubscribe from this list, visit 
>> https://dev.eclipse.org/mailman/listinfo/sumo-user
>>
> 
> 



Back to the top