Attn: Blender / Chicken Pros. "module object" erro

So I’m trying to export a robot from Blender using Chicken, but when I do I get this error:
“AttributeError: ‘module’ object has no attribute ‘reduce’”

I have no idea what that means.

I have python version 2.6.2, blender Ve: 438, and Chicken version .91.

Does anybody know what this means or how to fix it?

I’ve had similar errors before, and I’ve found it’s usually because I’m misusing a function or method. It would seem to me that you are using a .reduce or .reduce() somewhere in your code; could you maybe post the relevant sections, so we can have a better idea of what’s going on? Errors like this are usually easy to fix, once you see what’s wrong.

Hmmm, well I’m just starting out, so my code is nothing special;

from math import pi, sin, cos

from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.actor.Actor import Actor
from direct.interval.IntervalGlobal import Sequence
from pandac.PandaModules import Point3

class MyApp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        
        #load the small room (orientation = spawn camera)
            #textures
        self.groundTexture = self.loader.loadTexture("myWork/myTextures/groundTexture.bmp")
        self.wallTexture = self.loader.loadTexture("myWork/myTextures/wallTexture.bmp")
        self.wallTexture2 = self.loader.loadTexture("myWork/myTextures/wallTexture2.bmp")
        self.charlesTexture = self.loader.loadTexture("myWork/myModels/charles.tga")
            #ground
        self.groundOrig = self.loader.loadModel("myWork/myModels/ground")
        self.groundOrig.reparentTo(self.render)
        self.groundOrig.setScale(0.25, 0.25, 0.25)
        self.groundOrig.setPos(0, 5, -1)
        self.groundOrig.setTexture(self.groundTexture)
            #left wall
        self.wallL1 = self.loader.loadModel("myWork/myModels/wall")
        self.wallL1.reparentTo(self.render)
        self.wallL1.setScale(0.25, 0.25, 0.25)
        self.wallL1.setPos(-2.2, 5.25, 0.01)
        self.wallL1.setTexture(self.wallTexture)
            #right wall
        self.wallR1 = self.loader.loadModel("myWork/myModels/wall")
        self.wallR1.reparentTo(self.render)
        self.wallR1.setScale(0.25, 0.25, 0.25)
        self.wallR1.setPos(2.2, 5.25, 0.01)
        self.wallR1.setTexture(self.wallTexture)
            #back wall
        self.wallB = self.loader.loadModel("myWork/myModels/wall2")
        self.wallB.reparentTo(self.render)
        self.wallB.setScale(0.25, 0.25, 0.25)
        self.wallB.setPos(0, 7, 0)
        self.wallB.setTexture(self.wallTexture2)
        #load the player
            #load Charles, the robot
        self.charles = self.loader.loadModel("myWork/myModels/charles")
        self.charles.reparentTo(self.render)
        self.charles.setScale(0.25, 0.25, 0.25)
        self.charles.setPos(0, 5, -.4)
        self.charles.setTexture(self.charlesTexture)
        
app = MyApp()
app.run()

I don’t see anything other than the setScale that would determine the size- could there be a problem there?

But wait, how does my program have anything to do with Blender? The problem is in the console of Blender, before I even try to run my program.

It is always a good idea to describe problems you see as precise as possible. People don’t have to ask a dozen questions (and spend time) before they can see what your problem is, and maybe help. So:

  1. Where do you get this error? From your description it seems that you get the error when ‘exporting from blender’ using chicken, and not when running your code.

  2. Usually you get a traceback when you see an error (the lines above the error). It tells where in the code the error has occurred. The full traceback is probably the most important information. Post it whenever you talk about a Python error.

I get the error in the console that opens when Blender opens. The trace back is as follows:

Also, I’ve noticed this only happens when I try to export a model, using Chicken, that has a UV texture; Even though I managed to export the same model with a slightly different image; using the exact same method.

Ok, so this problem is related to exporting from Blender, using the Chicken .egg exporter (version R91).

Forget about the posts by GarrickW - he thought you are talking about a problem with game code you have written yourself.

I am not an expert on Chicken, so I can’t help with the matter itself. But I can give you advice how to get help:

  1. Change the title of your post, to reflect that you have a problem with chicken. This might draw the attention of chicken experts to your post.

  2. If this doesn’t help and you don’t get replies: lethe is the one who has been writing the Chicken exporter as far as I know. Send him a private message.

Alright, thanks for the advice- I’ll try that out

Well, it appears I have been summoned! I didn’t realise that putting Chicken in a forum post was the preferred incantation, but ho hum;-)

Anyway, as for the error its a new one, and quite strange really. Its claiming it can’t look up the reduce function, when it is a built in function that comes with the language, which makes no sense. Your comment about uv-s makes sense as that code is explicitly concerned with error checking uv information, and it wouldn’t run it if you didn’t have them.

So, a few questions -

  • Which version of Blender are you using? (You put Ve: 438 - if you read that off the bar at the top of Blender then its the number of vertices in your selection, not the version - look at the splash screen:-) )
  • Did you explicitly tell Blender to use the version of python you listed?
  • Has your computer had other versions of python installed at any point?

This is sufficiently strange that it might be that something has gone really screwy, and require re-installation, but at the very least we will need to identify what first.

Haha well I was going to try a spot light with a chicken filter, but I figured changing the title would work just as well.

Ok, to answer your questions:
-…and now I’m embarrassed… There’s a reason I’m a programmer. My blender version is actually 249.2

-I assume I have Python properly installed- I even set a PYTHONPATH environment variable. (same place where you change the PATH variable). When I start up Blender, the console that pops up with it says “Compiled with Python version 2.6.2. Checking for installed Python… got it!” So I assume everything is ok. Plus I’ve exported a model with a UV texture before- my error occurred when I changed the texture and tried to re-export (I did save the .tga over the old one)

-I did have Python 3.1 installed, but I uninstalled it, deleted the file, uninstalled Chicken and Blender then installed Python, Blender and Chicken (in that order) again.

While I have your attention… :smiley:
Where am I supposed to save the .tgas? or does it matter? I have my .blender files separated from my .egg files.

Well, it sounds like everything is ok, which is a problem, as I really have no idea what could cause this - as I said, its complaining that a built in feature of the language doesn’t exist, which is nonsense. I have previously come across cases of a corrupt Blender file causing random errors - you might want to try recreating parts of the file, i.e. removing and recreating uv’s, textures, materials - that kind of thing - problem might go away. Given that you have had uv-s working before that suggests such an error to me. Alternatively/additionally if your willing to email me the file then I will be happy to see what happens on one of my machines.

For textures it (By default.) writes into the egg file the path to each texture relative to the .blend file - if you save the egg file elsewhere then you need to have the textures in the same relative positions to the new position of the egg file. Not ideal in all situations, but a good trade off between handling most situations and complexity. I myself keep the .blends separate from the game tree, but I save .eggs into the same directory as the .blend and then copy across, by script if need be.

I’ll try different things to see if it will work, in the mean time I’ll get you the model and texture I’ve been using.

Ok, so the .egg needs to be in the same directory as the texture.

Not quite. Open the egg file with an editor (Notepad++ or Gedit or something). In the first few lines you’ll find the texture entries and the paths along with those. These paths can be either relative or absolute, but relative paths make way more sense in most cases.

Ah, ok- sounds good. Thank you

Hi,

This is my first post to this board. So… I was running into the same problem exporting from blender 3d to .egg for panda 3d. I was getting a similiar error about reduce().

One side note: Open Source software is not like commercial software. Getting the latest versions is not always the best idea.

Short answer get Bender 3D v 2.48a and Panda 3D v 1.6.2. That seemed to solve my problem. For the longer answer keep reading.

Bender 3d version 2.49b uses Python 2.6.2 and in my case I was running panda3D v.1.6.2 which uses Python 2.5.x. When Chicken exports to .egg it calls Panda 3D. As far as I can tell this causes the error. My solution was to find a version of Bender 3d that uses the same version of Python, in my case it is Blender 3d v. 2.48a.

Hope that helps.

Thanks!
I had a similar problem:

Traceback (most recent call last):
  File "G:\Documents and Settings\levente\Application Data\Blender Foundation\Bl
ender\.blender\scripts\bpydata\chicken/eggoctree.py", line 29, in <module>
    import sys, getopt
  File "G:\Python26\lib\getopt.py", line 37, in <module>
    import os
  File "G:\Python26\lib\os.py", line 758
    bs = b""
           ^
SyntaxError: invalid syntax

They said on my Python forums that it’s a mismatch between Python 2.6 and 2.4(but it seems 2.5 has the same issue). I’ll soon try your advice.