I have been using Python for a few months in a Windows environment with IDLE.

I installed Python on my (new) Macbook and opened the same files, but am now getting strange results. These are scripts that worked fine in Windows:

  1. When I use a function to open and print a text file, nothing seems to happen. The text file is in the same folder as the script file.

  2. I am getting syntax errors that didn't happen in Windows- mostly the print function: it doesn't seem to like the string concatenation (the + symbol).

Has anyone else had this experience? Do you think that my install is faulty or is there something about Macs that I am missing?

Thank you.

Recommended Answers

All 2 Replies

SyntaxError with print often means that you are running in python 3 code written for python 2.

Gribouillis- yep, that's what happened. My print statements were not followed by parentheses. I fixed it and now it works! Thanks for pointing me in the right direction.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.