3

Please help, i'm getting this error:

with open('Data/language.json') as settings_file:
TypeError: Required argument 'flags' (pos 2) not found

My code is:

import json
with open('Data/settings.json') as settings_file: 
 Settings = json.load(settings_file)
asked Jul 8, 2013 at 21:58
3
  • 3
    Did you happen to do from os import open? open (the built-in open that you don't need to import) automatically defaults to read mode. Commented Jul 8, 2013 at 22:01
  • 1
    yes, i did, i removed it and it works now, thanks :) Commented Jul 8, 2013 at 22:07
  • @Blender: Make it an answer. Commented Jul 9, 2013 at 5:59

1 Answer 1

5

It looks like you imported open from the os module with something like:

from os import open

os.open isn't the same as the builtin open function (which you don't need to import). Remove that import and you'll use the builtin open, which defaults to read mode.

answered Jul 9, 2013 at 6:01
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.