Python Forum
Syntax error while executing the Python code in Linux
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax error while executing the Python code in Linux
#4
(Jul-17-2023, 03:31 PM)deanhystad Wrote: Python 3 programs generally don't run under Python 2. There were many changes going from 2 to 3. For example, print was a statement (no parenthesis) in python 2, but in python 3 it is a function.

Does your linux have a python3? From a shell, try this:
Output:
python3 --version
If you don't get an error, you can run your script using python3 in place of python. If not, you can install python 3. You should look for instructions for your linux version to make sure you don't damage your python 2 installation.

The python version in linux is 2.6.6.It seems Python 3 cannot be installed in the Linux server atleast in the near future.I need to make this code compatible with 2.6. How can i achieve that.
Reply


Messages In This Thread
RE: Syntax error while executing the Python code in Linux - by DivAsh - Jul-18-2023, 05:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  is this really a syntax error? Skaperen 4 335 May-25-2024, 07:31 AM
Last Post: snippsat
  World Clock syntax error OscarBoots 1 300 May-03-2024, 05:20 AM
Last Post: snippsat
  Is possible to run the python command to call python script on linux? cuten222 6 923 Jan-30-2024, 09:05 PM
Last Post: DeaD_EyE
  Syntax error for "root = Tk()" dlwaddel 15 1,543 Jan-29-2024, 12:07 AM
Last Post: dlwaddel
Photo SYNTAX ERROR Yannko 3 537 Jan-19-2024, 01:20 PM
Last Post: rob101
  Code with empty list not executing adeana 9 3,900 Dec-11-2023, 08:27 AM
Last Post: buran
  Code error from Fundamentals of Python Programming van Richard L. Halterman Heidi 12 1,889 Jul-25-2023, 10:32 PM
Last Post: Skaperen
  Code is returning the incorrect values. syntax error 007sonic 6 1,399 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  Error 1064 (42000) when executing UPDATE SQL gratiszzzz 7 1,659 May-22-2023, 02:38 PM
Last Post: buran
  Compiles Python code with no error but giving out no output - what's wrong with it? pythonflea 6 1,724 Mar-27-2023, 07:38 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020