Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Using Python tools as reusable libraries

Hi all,

 

I am trying to use some of the Python scripts provided in the Tools folder of SUMO in my Python script as libraries. Basically, I want to avoid subprocess and executing python functions in shell. However, I have difficulties using them. For example I can use the randomTrips.py as suggested in a previous question as follows:

randomTrips.main(randomTrips.get_options(['-n', 'your.net.xml']))

 

However, this doesn’t work for duaIterate. There is no get_opetions class defined, So I thought I can just give in the arguments to the main class:

 

duaIterate.main(['-n', ‘Net.net.xml', '-D', ‘taz.add.xml' '-F', 'trips.trip.xml','-T', '-b', 0, '-e', '15000', '--router-verbose','--mesosim','-j'])

ipykernel_launcher.py: error: Either --trips, --flows, or --routes have to be given!

 

When I use the initOptions() class I get an error :

duaIterate.main(duaIterate.initOptions(['-n', ‘net.net.xml', '-D', ‘taz.add.xml' '-F', 'trips.trip.xml','-T', '-b', 0, '-e', '15000', '--router-verbose','--mesosim','-j']))

TypeError: initOptions() takes no arguments (1 given)

 

I tried the same on xml2csv where the get_options class is defined (similar to randomTrips) but I get the same error:

get_options() takes no arguments (1 given)

 

Does anyone know how can I pass arguments to these python libraries? Or maybe they are just not written as a reusable library, which I doubt?

 

Thanks,

Sasan

 

 


Back to the top