View Full Version : Help with "NameError: global name 'NO_DIRECTION' is not defined"


RogerBacon
Aug 22, 2009, 07:25 AM
EDIT: Nevermind. I found the problem. I needed "DirectionTypes.NO_DIRECTION" instead of just NO_DIRECTION.


I am getting this python error with my initUnit function

NameError: global name 'NO_DIRECTION' is not defined

pPlayer.initUnit(pUnit.getUnitType(), pCity.plot().getX(), pCity.plot().getY(), UnitAITypes.NO_UNITAI, NO_DIRECTION)

I've tured DIRECTION_SOUTH and others but it doesn't seem to recognize them.

In cvEnums.h the direction types are defined and it says they are exposed to python


enum DirectionTypes // Exposed to Python
{
NO_DIRECTION = -1,

DIRECTION_NORTH,
DIRECTION_NORTHEAST,
DIRECTION_EAST,
DIRECTION_SOUTHEAST,
DIRECTION_SOUTH,
DIRECTION_SOUTHWEST,
DIRECTION_WEST,
DIRECTION_NORTHWEST,

#ifdef _USRDLL
NUM_DIRECTION_TYPES,
#endif

DIRECTION_NORTH_MASK = 1 << DIRECTION_NORTH,
DIRECTION_NORTHEAST_MASK = 1 << DIRECTION_NORTHEAST,
DIRECTION_EAST_MASK = 1 << DIRECTION_EAST,
DIRECTION_SOUTHEAST_MASK = 1 << DIRECTION_SOUTHEAST,
DIRECTION_SOUTH_MASK = 1 << DIRECTION_SOUTH,
DIRECTION_SOUTHWEST_MASK = 1 << DIRECTION_SOUTHWEST,
DIRECTION_WEST_MASK = 1 << DIRECTION_WEST,
DIRECTION_NORTHWEST_MASK = 1 << DIRECTION_NORTHWEST,
};


Any idea what is wrong?

strategyonly
Aug 22, 2009, 02:51 PM
You should put all python or SDK related items in that section, i dont think there was one when you were here last time, i've gotten alot of help from those guys so far, it all depends on how they feel, LOL