Skip to content

Instantly share code, notes, and snippets.

@barneygale
Created June 20, 2012 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barneygale/2959824 to your computer and use it in GitHub Desktop.
Save barneygale/2959824 to your computer and use it in GitHub Desktop.
import json
import nerdnu
import os
import re
import reddit
from nerdnu import app
data_dir = 'data'
def write_raw(filename, data):
with app.open_resource(os.path.join(data_dir, filename), 'w') as handle:
handle.write(data)
def write_json(filename, data):
write_raw(filename, json.dumps(data, indent=4))
import subreddit, wiki, forum, query, logs
@barneygale
Copy link
Author

Traceback (most recent call last):
File "compile.py", line 20, in
m.compile()
File "/home/reddit/nerdnu/nerdnu/compile/query.py", line 160, in compile
write_json('statuses.json', out)
File "/home/reddit/nerdnu/nerdnu/compile/init.py", line 17, in write_json
write_raw(filename, json.dumps(data, indent=4))
File "/home/reddit/nerdnu/nerdnu/compile/init.py", line 13, in write_raw
with app.open_resource(os.path.join(data_dir, filename), 'w') as handle:
TypeError: open_resource() takes exactly 2 arguments (3 given)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment