Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Typing with Pylance with parallelized simulations

Hi Patrick,
currently the traci library dynamically inserts the domains into the connection using setattr. This confuses most autocompletion tools which only do static analysis. Maybe this thread helps:
https://stackoverflow.com/questions/63436496/is-it-possible-to-have-python-ides-offer-autocompletion-for-dynamically-generate

If this does not help please consider opening a ticket at https://github.com/eclipse/sumo/issues and we will try refactoring the code.

Best regards,
Michael

Am 16.03.22 um 08:50 schrieb Patrick Göttsch:
Hello,

I run multiple parallelized sumo simulations using traci. This works out quite fine.

To mitigate the need to use always the traci switch command, I store for each simulation a traci.Connection object using traci_object: traci.Connection = traci.getConnection(id). This works fine.

But my issue with that way is, that in VS Code where I write my python code to interface SUMO using traci gives nice code completion when I use traci.vehicle.getSpeed(id) but not with traci_object.vehicle.getSpeed(id). There it does not offer vehicle.getSpeed(id) and marks it as "Cannot access member vehicle for type Connection". What would be the right way to write the code?

Thanks a lot,

Kind regards,

Patrick

_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user


Back to the top