transition icon indicating copy to clipboard operation
transition copied to clipboard

pyTransition : Errors in sample code

Open tibobliss opened this issue 1 year ago • 2 comments
trafficstars

Two errors cause issues when running the sample code for request_accessibility_map:

  • lat/long are inverted
  • there is a trailing comma at the end of the parameters

image

tibobliss avatar Jun 25 '24 19:06 tibobliss

Also, those code example should be included in the README from external file so that we can CI test them.

greenscientist avatar Jun 25 '24 19:06 greenscientist

Another one. In the two samples for connecting to the server, the get_nodes() function is used as an example. It is called in two different ways: transition_instance.get_nodes() and Transition.get_nodes()

image

The first one gives the following error:

HTTPError: 500 Server Error: Internal Server Error for url: https://stmplanif.transition.city/api/v1/nodes (see issue #990), which means it actually manages to create a query.

While the second one gives the following error:

TypeError: Transition.get_nodes() missing 1 required positional argument: 'self'

So it seems that the first formulation should be used in all sample code.

tibobliss avatar Jun 25 '24 19:06 tibobliss

https://github.com/chairemobilite/transition/pull/1171 add a method to link actual script to the README to ease in testing. Some fixes were applied

greenscientist avatar Dec 19 '24 16:12 greenscientist

the trailling comma is not an issue in Python, but the other errors were fixed

greenscientist avatar Dec 19 '24 16:12 greenscientist