Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6798477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:44:05+00:00 2026-05-26T18:44:05+00:00

I am currently testing on a Mac a python program developed in Windows on

  • 0

I am currently testing on a Mac a python program developed in Windows on Python 3.2. When the program is run on Windows there is no problem, but when run on a Mac I get a syntax error pointing to the following print function:

LOGFILE = open('./test.log','w')
print('Testing Started\n', file = LOGFILE)
                                ^
SyntaxError: invalid syntax

I am running Python 3.2.2, so I think this is the correct syntax – I cannot understand what is wrong. Bizarrely, when I changes to the old 2.X syntax,

print >>LOGFILE, "Test Started\n"

it ran without error.

could there be some reason my python interpreter is using the old syntax even though it is version 3.2.2?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:44:06+00:00Added an answer on May 26, 2026 at 6:44 pm

    The most likely explanation is that you’re running your script using Python 2.x. There could be multiple interpreters installed on the system, so I’d suggest making sure that you’re using the interpreter that you think you’re using.

    Try printing out sys.version from within your script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently testing a .NET 2.0 client application for Windows 7 Software Logo compliance
We currently use LoadRunner for performance testing our web apps, but we also have
I'm currently testing Memcached in a Windows machine and we are planning to use
I'm writing a game for Mac using Cocoa. I'm currently implementing hit testing and
I'm currently testing Lucene.Net, and it's perfect for my needs but I've seen this
We have a client and server application currently testing on the same Windows 7
I'm currently testing all ways to get it done. I will host a website
I am currently testing this in Mozilla FireFox 3.0.5 using FireBug 1.3.0 with jQuery
I'm currently testing a new version of an app of mine on OSX 10.5
I'm currently testing an OpenID implementation, and I'm noticing that Google sends a different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.