global name 'dclass' is not defined?

My friend has made me a array packer for my server,

datagram = PyDatagram()
packer = DCPacker()

datagram.addUint8(7) #amount of items in your array
field = dclass.getField(13)
print field
field.packArgs(packer, [[0, 0, 0, 0, 1, 1, 0]])
if not packer.endPack():

But when using it, I got this.

  File "", line 166, in handleDatagram
    field = dclass.getField(13)
NameError: global name 'dclass' is not defined

Do you know what’s this error possibly means?

I believe that, in short, it means that at that point in execution, as far as Python is concerned the object named “dclass” hasn’t yet been created.

Looking at your code, this does indeed seem to be the case: you’re using an object named “dclass”, but don’t seem to actually create it (or import it) anywhere above that point.