0
$\begingroup$

When I name a module script wave.py it breaks and I get this in the console:

Python controller found the module but could not access the function - object 'Cube', controller 'Python':
AttributeError: module 'wave' has no attribute 'main'

Any other (valid) name seems to work as expected.

Is "wave" a reserved name in Blender's API? If so, are there other such reserved names specific to Blender? Or have I overlooked something else?

Broken example (wave.py):

Working example (script.py):

Update:

I found that there is a module called "wave.py" included in Lib...

I also found this list of built-in Python functions, but it appears not to be exhaustive since wave.py is not included.

If someone can verify that this is the problem, and link to a complete list of built-in functions, I would consider it a satisfactory answer.

Update 2:

A complete list of built-in Python functions has been asked for on Stack Overflow. But the answers listed do not include wave.py, so is it not considered built-in? I'll rephrase the question: What are all the names I cannot use for Python scripts in the BGE?

$\endgroup$

1 Answer 1

1
$\begingroup$

wave is indeed a module from Python's standard library, as you can see in the link below. As it deals with heavy data processing (wave sound files manipulation), it is probably a compiled C extension, and you may find it as a .pyd file extension (which is equivalent to a Windows DLL). Refer to Python standard library to avoid using already taken module names and be a bit more specific about your own module names (like game_wave, and so on).

wave module on Python standard library documentation: https://docs.python.org/3/library/wave.html

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .