Hi Harald, Thanks for your reply. Yes, I have used the line in command line and it works. Even from inside Python by os.system(...) it works. I am just wondering why randomTrips works without any issues but xml2csv or duaIterate don't. xml2csv seems to have the same get_options class, yet I can't use it...
Sasan From: [email protected] [mailto:[email protected]] On Behalf Of Harald Schaefer Sent: Tuesday, 16 July 2019 19:12 To: [email protected] Subject: Re: [sumo-user] Using Python tools as reusable libraries Hi Sasan, duaIterate is callable as library as well as randomTrips.py Some script called by duaIterate complains about missing trips, flows or routes. Have you tried calling duaIterate.py with the same parameters from the command line? Greetings Harald Am 16.07.19 um 10:16 schrieb Sasan Amini: 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 _______________________________________________ sumo-user mailing list [email protected]<mailto:[email protected]> To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________ sumo-user mailing list [email protected] To change your delivery options, retrieve your password, or unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
