Traceback (most recent call last):
  File "C:/Users/James/Desktop/hugevar.py", line 2, in <module>
    class var(tempfile.TemporaryFile):
TypeError: Error when calling the metaclass bases
    function() argument 1 must be code, not str

Why does this happen and how can I fix it?

Give us some code!

TemporaryFile is not a class. Use aggregation

class Var(object):
    def __init__(self):
        self._file = tempfile.TemporaryFile()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.