-1

The name of my file is Step1.py and it is meant to open a page on google maps. I'm running El Capitan on a macbook air. It's saved in my home file and I gave it the permissions it needs (I think). Here's Step1.py:

#! 

import pprint
import webbrowser
def launchweb(location):
   web = 'https://www.google.com/maps/place/'
   location = input('Gimmi Yo Adress: ')
   rlocation = (location.replace(',', ''))
   rlocation = rlocation.split()
   for i in range(len(rlocation)):
      if i != len(rlocation) - 1:
          rlocation[i] = rlocation[i] + '+'
   for i in rlocation:
      web = web + i
   return web
webbrowser.open(launchweb(12))

I entered chmod +x Step1.py into the terminal, then I tried to run python ./Step1.py

It promted an address, and I entered one Gimmi Yo Adress: 1234 fake st, san fransisco, ca

Then it gave me this:

 Traceback (most recent call last):
   File "./Step1.py", line 16, in <module>
     webbrowser.open(launchweb(12))
   File "./Step1.py", line 7, in launchweb
     location = input('Gimmi Yo Adress: ')
   File "<string>", line 1
     1234 fake st, san fransisco, ca
             ^
 SyntaxError: invalid syntax

What is the proper syntax?

Elazar
  • 20,415
  • 4
  • 46
  • 67
Travasaurus
  • 601
  • 1
  • 8
  • 26

1 Answers1

0

Try putting you address in quotes.

Gimmi Yo Adress: "1234 fake st, san fransisco, ca"

There are more issues, but I will leave that to you. It should open.

C_Rod_27
  • 61
  • 3
  • 5