typeerror

"Cannot read property 'xxx' of null"

I've got a document fragment with children that I want to loop over (when possible). This is causing an error "Cannot read property 'xxx' of null". How do I test if this will be the case? ...

Python TypeError: an integer is required

import scipy,array def try_read_file(): def line_reader(lines): for l in lines: i = l.find('#') if i != -1: l = l[:i] l = l.strip() if l: yield l def column_counter(): inputer = (line.split() for line in line_reader(file('/home/kartik/Downloads/yahoo_dataset/set1...

Code don't work, can't read property 'className' of undefined

What is wrong with this code? var divarray = []; var articleHTML = []; var absHTML; var keyHTML; var bodyHTML = []; var i = 0; divarray = document.getElementById("yui-main").getElementsByTagName("div"); for ( var j in divarray) { if(divarray[i].className == "articleBody"){ articleHTML = divarray[i]; for( var k in art...

"Function object is unsubscriptable" in basic integer to string mapping function

I'm trying to write a function to return the word string of any number less than 1000. Everytime I run my code at the interactive prompt it appears to work without issue but when I try to import wordify and run it with a test number higher than 20 it fails as "TypeError: 'function' object is unsubscriptable". Based on the error message...

TypeError: unsupported operand type(s)

This is a program I'm writing that's supposed to display some text in a window... import pyglet from pyglet import window from pyglet.text.layout import TextLayout class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__(width = 800, height = 600, caption = "Proto...

Uncaught TypeError: Cannot set property 'src' of undefined

I have the following javascript code, which is doing an image rotation on a website I'm working on. It works correctly in Firefox, but not in Chrome or Safari. When I run the script console in firebug, it doesn't find an error, but when I run the script console in Chrome, it comes back with the error: Uncaught TypeError: Cannot set pro...

Flex/Actionscript Type error #1034

I'm trying to detect overlap between elements on my canvas. The attempt is to reuse some of the code for collision detection at http://www.gskinner.com/blog/archives/2005/08/flash_8_shape_b.html This is the smallest MXML sample I could come up with that gives me a type error. <s:Application xmlns:fx="http://ns.adobe.com/mxml/200...

Junit GWT error - Cannot find function attachEvent in object [object Window]

I try to create junit test for my GWT application. The application uses MathJax javascript library. I encounter an error that seems to be connected with javascript code. The listing of the full error message is here. I think that the core (main cause) of the error could be the following: TypeError: Cannot find function attachEven...

How do we throw and catch a RangeError, ReferenceError, TypeError in JavaScript?

Hi all, I was wondering if any of you have tried catching errors such as RangeError, ReferenceError and TypeError using JavaScript's exception handling mechnism? For instance for RangeError: try { var anArray = new Array(-1); // an array length must be positive throw new RangeError("must be positive!") } catch (error) { ...

TypeError: Error #1006: myInitializer is not a function. - AS3

Hello everyone, I'm having a difficult time working on my flash application. Everytime I run my code, this error bumps at me. TypeError: Error #1006: myInitializer is not a function. I am quite sure that my myInitializer() function is indeed a function: public class newClass extends MovieClip { public function newClass() { ...

A bug in rails? About model inherited.

My env: ruby-1.9.2-preview3; rails-3.0.0.beta3 class PostFather < ActiveRecord::Base def self.inherited(subclass) end end class Post < PostFather end In the console: > Post.new # => TypeError: can't dup NilClass > Post.all # => TypeError: can't dup NilClass > Post.scoped # => TypeError: can't dup NilClass You can try ...

numpy.isnan returns TypeError

I do: print "e: ", scaled_target, type(scaled_target) print "f: ", numpy.isnan(scaled_target) which returns e: [0.0 0.0 0.0 0.0] <type 'numpy.ndarray'> f: Traceback (most recent call last): File "./a.py", line 106, in <module> print "f: ", numpy.isnan(scaled_target) TypeError: function not supported for these types, and can't...

Unknown cause for TypeError in Python 2.6

I am writing a program which reads input from a file called 'votes.txt'. It reads in some line of information, each of which is a 'vote' with parties ordered by preference. The program needs to take this data, and output the winner of the election. My Code is as follows: # Define the count_votes() function def count_votes(to_count): ...

Ruby Hash bug help!

I'm trying to create a Ruby Hash of objects, where the keys are the object @name member: # m is an object with an @name instance variable (a string) myHash = {} myHash[m.name] = m It's giving this error: #<TypeError: can't convert String into Integer> Anyone know why? I'm sure that m.name is a valid string... ...

How do I down-cast a c++ object from a python SWIG wrapper?

The problem: I've wrapped some c++ code in python using SWIG. On the python side, I want to take a wrapped c++ pointer and down-cast it to be a pointer to a subclass. I've added a new c++ function to the SWIG .i file that does this down-casting, but when I call it from python, I get a TypeError. Here are the details: I have two c++ cl...

Ruby: erb throwing error "`result': can't convert String into Integer (TypeError)"

Quick background: I'm setting up a quick and dirty templating scheme where all of my template files are named '*.erb'. the fill in data resides in a yaml file. Output is to files with the name of the template, minus '.erb'. I haven't done much work with erb, and I'm getting the error "`result': can't convert String into Integer (TypeErr...