Hello I'm new to python so I was thinking on building a simple neural network...I think I'm almost there and got an error, so I would really need a help right now.

from PIL import Image
from scipy.misc import imread
import matplotlib.pyplot as plt
import matplotlib.image as mpimg

from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets import SupervisedDataSet
from pybrain.supervised.trainers import BackpropTrainer
from scipy import misc

with open("a.png", "rb") as imageFile:
  f = imageFile.read()
  b = bytearray(f)

neuralNetwork = buildNetwork(2,3,1)
dataSet = SupervisedDataSet(2,1)

dataSet.addSample((b),(0,))
trainer = BackpropTrainer (neuralNetwork, dataSet)

error = 10
iteration = 0

 for i in range (1,10000):
        trainer.train()
        if (i % 1000 == 0):
            print(i)
            print(dataSet.activate((b),(0,)) )

print(dataSet.activate((b),(0,)) )

Any help will do, thanks :)

It seems that your code is trying to execute indirectly an invalid numpy broadcasting operation.

My guess is that one of your calls to the pybrain API receives an incorrect parameter. As I don't know this module, the best thing to do is to post here the whole error traceback sent to you by python in the console. This would tell us which call is faulty and which part of the API to check.