Pythons's AttributeError: 'NoneType' object has no attribute 'errors'
<p>I know it's been here a lot of times but I didn't find the right answer for my case.<br>
<strong>First:</strong> I'm making an easy database system (for myself) that will run with no hashes etc. (for now at least). Now I got stuck.</p>

<pre><code>import sys
import os

filename = ""
database = ""
path = ""
table = ""

class Nollty:
    returns = 0
    errors = 0

    def __init__(self, filename, database):
        self.filename = filename
        self.database = database
        self.path = self.filename + "databases/" + self.database
        openfile = open(self.path + "/db_required", "r")
        if not openfile.errors:
            self.returns = 1
        if not os.path.exists(self.path + "/db_required"):
            self.returns = 0
        openfile.close();

    def select(self, table):
        errors = 0
        self.table = table
        openfile = open(self.path + "/" + self.table, "r")
        if not openfile.errors:
            errors = 1
        if not os.path.exists(self.path + "/" + self.table):
            errors = 0
        openfile.close();


nollty = Nollty("", "test")
if nollty.returns == 1:
    print "Successfully connected to the database!"

query = nollty.select("aaa_auto")
if query.errors == 0:
    print "Successfully chosen the table!"
</code></pre>

<p>The error output is:</p>

<pre><code>Traceback (most recent call last):
File "/home/spotrudloff/Python/Nollty/nollty.py", line 40, in &lt;module&gt;
if query.errors == 0:
AttributeError: 'NoneType' object has no attribute 'errors'
</code></pre>

<p>The problem is probably that I'm PHP programmer, and I learnt Python today in a few hours (so my thinking is still "PHPy").</p>

<p>Thanks for all the responses.</p>
