Import .json to Database
<p>I successfully downloaded tweets into a json file. Now I try to import it in a database with this function:</p>

<pre><code>def import_json(fi):

logging.warning("Loading tweets from json file {0}".format(fi))
for line in open(fi, "rb"):
    data = json.loads(line.decode('utf-8'))
    database.create_tweet_from_dict(data)
</code></pre>

<p>the json-file "keywords_BVBS04.json" lays in a folder called <em>data</em> which is in the current directory. The function is in a file called <em>BVBS04.py</em></p>

<p>to start the import I type <em>BVBS04.import_json(keywords_BVBS04.json)</em> in ipython in the console. this is what I get back:</p>

<blockquote>
  <p>NameError                                 Traceback (most recent call
  last)  in ()
  ----> 1 BVBS04.import_json(keywords_BVBS04.json)</p>
  
  <p>NameError: name 'keywords_BVBS04' is not defined</p>
</blockquote>

<p>Now here comes the  is a beginner's question: Where/how do I have to define "keywords_BVBS04"? I tried a lot :(</p>

<p>Thanks!</p>