Search code examples
pythondouble-quotessingle-quotes

My python code works in one VM and not in the other ... complaining about quotes


I have 2 VM sessions.

In the VM session A, the script won't run right if I type python

if I don't put python3 the error I get

but if I type python3 it's fine.

When I move this script to my other VM session B, and I try to run it, it is spitting out (what I think) are issues with quotes. (VM B is a virtualized environment and I don't usually have to type python3 .. but I did it both ways here and it still fails.

the error I get in VMWare B no matter what I do

VM A is running python Python 2.7.15rc1 -- at least if I type python on the terminal it says that ... which confuses me why I type python3 to get it to run. I see code that is using some of the new formatting in python strings.

VM B is running Python 3.5.2.

Can someone help, I am a rookie here big time ... so appreciate it!


Solution

  • Your script uses f-strings (the f"\t- {house_1[0]} sq feet" thing), which were only added to Python in version 3.6. You need to either upgrade the Python 3 version on VM B or else rewrite your code to no longer use f-strings.