Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 syntax error near unexpected token
Hello! ultra noobie with all things programming and I am currently registered in an online python course. During the tutorials I got stuck when I was prompted to enter a line:

name="BRADY H".lower()
This happens in only Visual Studio Code

It is supposed to be an example of the various python functions you can use but when I use this or .upper() or .replace() or any of the other tutorial functions I keep getting the error

bash:syntax error near unexpected token `('
Also I have tried:

my_book="My favorite book is 'Tod Sawyer',".replace('Tod', 'Tom')
but get the same error...
This happens in both the editor (Visual Studio Code) and the shell/terminal on my computer. Please help as I am eager to learn but feel I can't even get started!
Yoriz wrote Apr-21-2019, 08:32 PM:
Please post all code, output and errors (in it's entirety) between their respective tags. I did it for you this time, Here are instructions on how to do it yourself next time.
Doesn't look like there is anything wrong with the code posted.
Could it have to do with the PATH when python was installed then? I'm sorry I wish I could give you more information but this is all I have to work with and why I am here on the forums. Also thank you for reformatting my question for me, my apologies.

Also when the functions are typed out in Visual studio code they do not change color to cyan, as illustrated in most tutorials. I don't think this would be the issue as the shell has no problem with it.
Your error starts with 'bash,' so you seem to be running the code in the bash shell rather than in Python. If it only happens in Visual Studio, I would guess you don't have Visual Studio set up correctly to run Python code. However, I am not familiar with Visual Studio, and would have no idea how to fix that.
Craig "Ichabod" O'Brien -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Make sure you have the python extension installed
Thank you this information is very helpful. Hopefully it will give me enough to troubleshoot the issue through google. I have also verified that the python extension within VSC is installed and active

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Need help in adding xsrf token keerthiprashanth 1 90 Aug-08-2019, 02:35 PM
Last Post: keerthiprashanth
  Syntax error for a reason I don't understand DanielCook 2 87 Aug-07-2019, 11:49 AM
Last Post: buran
  [split] Python beginner: Weird Syntax Error mnsaathvika 1 113 Jul-22-2019, 06:14 AM
Last Post: buran
  While True is a syntax error? Piethon 8 242 Jul-21-2019, 12:40 PM
Last Post: metulburr
  syntax error on list.sort() jjordan33 3 150 Jul-10-2019, 04:57 PM
Last Post: jefsummers
  Unexpected Output using classes and inheritance langley 2 145 Jul-04-2019, 09:33 AM
Last Post: langley
  pymysql.err.ProgrammingError : 1064 You have an error in your SQL syntax pradeepkumarbe 1 224 Jul-01-2019, 08:05 AM
Last Post: pradeepkumarbe
  Syntax Error EOL while scanning string literal intjuma 0 167 Jun-28-2019, 01:56 AM
Last Post: intjuma
  Syntax Error : I can't identify what's wrong! caarsonr 11 480 Jun-10-2019, 11:18 PM
Last Post: Yoriz
  AND Boolean operator syntax error jsb83 3 317 May-31-2019, 08:34 AM
Last Post: perfringo

Forum Jump:

Users browsing this thread: 1 Guest(s)