title: TypeError: not all arguments converted during string formatting - Python
body: <p>I am messing around trying to learn Python and am working through some examples on <a href="https://automatetheboringstuff.com/chapter14/" rel="nofollow">https://automatetheboringstuff.com/chapter14/</a> - this one is to pull simple weather data.  I am getting an error when running the script that I can't seem to find an answer for...primary, because I am not sure how to ask it, so here goes:</p>
  
  <p><strong>My Code (from the book)</strong></p>
  
  <pre><code>#! python3
  # quickWeather.py - Prints the weather for a location from the command line
  
  import json
  import requests
  import sys
  
  # Compute location from command line arguments.
  if len(sys.argv) &lt; 1:
      print('Usage: quickweather.py location')
      sys.exit()
  location = ' '.join(sys.argv[1:])
  
  # Todo: Download the json data from OpenWeatherMap.org's API
  
  url = 'http://api.openweathermap.org/data/2.5/forecast/city?id=5391811&amp;APPID=5103aa7d5415db6xxxxxxxxxxxxxxx' % (location)
  response = requests.get(url)
  response.raise_for_status()
  
  # Load JSON data into Python variable.
  weatherData = json.loads(response.text)
  
  w = weatherData['list']
  print('Current weather in %s:' % (location))
  print(w[0]['weather'][0]['main'], '-', w[0]['weather'][0]['description'])
  print()
  print('Tomorrow:')
  print(w[1]['weather'][0]['main'], '-', w[1]['weather'][0]['description'])
  print()
  print('Day after tomorrow:')
  print(w[2]['weather'][0]['main'], '-', w[2]['weather'][0]['description'])
  </code></pre>
  
  <p><strong>And My Console Error</strong></p>
  
  <pre><code>rooster@python_tests $ python3 quickWeather.py
  Traceback (most recent call last):
    File "quickWeather.py", line 16, in &lt;module&gt;
      url = 'http://api.openweathermap.org/data/2.5/forecast/city?id=5391811&amp;APPID=5103aa7d5415db6xxxxxxxxxxxxxxxx' %(location)
  TypeError: not all arguments converted during string formatting
  </code></pre>
  
  <p>If I remove the % (location) from the url path, console will print the data except for the location, which in this case is San Diego.</p>
  
  <p>I know this is bit of a trivial questions and if I knew more about Python, it would be easy to answer, but now, after 2 hours of messing with it, I am dying to know what the heck is up.  </p>
  
  <p>Thank you for your help.</p>