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

  • SEARCH
  • Home
  • 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 6346437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:00:57+00:00 2026-05-24T21:00:57+00:00

I read through Add to python path mac os x and I figured doing

  • 0

I read through Add to python path mac os x and I figured doing that is a good idea, but still IDLE gives me a syntax error for a simple call of open(filename, mode), so I looked a little bit further and I found that I am able to do as stated in http://developer.apple.com/library/mac/#qa/qa1067/_index.html and set up an environment.plist in a .MacOSX folder, so I did that in my home dir and still no changes … I am now lost 🙂

Thats what I added as my python-path in .bash_profile and the same path in my environment.plist (without the :$PYTHONPATH):

PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7:$PYTHONPATH"
export PYTHONPATH

EDIT:
Thats where I get the syntax-Error… works fine in the interpreter

import xml.etree.ElementTree as et 
import json

app = Bottle()

@app.route('/proPass', method ='POST')

#here happens here, need it further down in the code... which is not really relevant 
f = open('/Users/mohi/Desktop/proPass_project/server_service/systems.xml', 'rw')

def getData():
    timestamp = request.POST.get('timestamp', '').strip()
    data = request.POST.get('data', '').strip()

    if timestamp:
        processData(data, timestamp)
run()

The error:

    File "proPass_script.py", line 9
    f = open('/Users/mohi/Desktop/proPass_project/server_service/systems.xml', 'rw')
    ^
    SyntaxError: invalid syntax

  • 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-24T21:00:58+00:00Added an answer on May 24, 2026 at 9:00 pm

    PYTHONPATH doesn’t effect whether or not you get a SyntaxError — only an ImportError. So, if you’re getting a SyntaxError, you’ve got another problem with your code. Please post the code and we’ll point it out.

    Edit: Your error is on this line:

    @app.route('/proPass', method ='POST')
    

    The @ designates a decorator, which is only valid on the line immediately before a function definition (def), a class definition (class), or another decorator.

    It shows the error on the first character of the open line because it’s expecting a function or class definition there.

    See the docs for function definitions for more info on decorators.

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

Sidebar

Related Questions

Hi I have read through some of the relevant questions in stackoverflow but still
I read through quite a few similar questions here on SO but none were
I read through the javadoc and couldn't find anything that resembles it.
I've read through some of the post on here about closures and currying but
I have read through the solutions to similar problems, but they all seem to
I recently read through Code Complete, and it recommends that I create a project
I have read through this SO question about 32-bits, but what about 64-bit numbers?
I've already read through a few of the answers on this site but none
I've read through some of the other posts and followed their suggested advice but
I understand that this problem is incredibly common and I have read through quite

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.