I am trying to use this python program for vehicle routing using OR tools to create a 'data matrix.' The example program is posted at https://developers.google.com/optimization/routing/vrp It is the full program at the very bottom of the page. The program is supposed to take data from GoogleDistance Matrix API and print out a data matrix to use for vehicle routing/ optimization problems, using the adresses entered. But I am getting errors instead. The program seems to run error free if I take out the last lines ( but then, of course the desired data is not printed) I have working API key, and OR tools installed, so that is not the problem.
I get these errors when I run the complete program
Traceback (most recent call last):
File "C:\Users\shane\exampleprogram.py", line 94, in <module>
main()
File "C:\Users\shane\exampleprogram.py", line 91, in main
distance_matrix = create_distance_matrix(data)
File "C:\Users\shane\exampleprogram.py", line 46, in create_distance_matrix
response = send_request(origin_addresses, dest_addresses, API_key)
File "C:\Users\shane\exampleprogram.py", line 71, in send_request
jsonResult = urllib.urlopen(request).read()
AttributeError: module 'urllib' has no attribute 'urlopen'
Is there something simple I can modify to make this program work as intended on my computer/ what is going on here? Please note I've run the program exactly as posted on Google's site with the exception of inserting my own API key (which itself works, but am not posting). For instance line 94 is the very bottom of the program that reads "main()" Here's a picture of my code if it also useful. codeimage Any useful suggestions would be appreciate. Thanks.