Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


'name' can't be retrieved using getattr, always returns empty string #198

pyjsorg opened this Issue · 6 comments

1 participant

Seems that 'name' is actually a specially reserved attribute, or conflicts with the internal JS object representation somehow. Trying to retrieve it with getattr always returns the empty string. Here's the sample code:

class TestClass(object):

def __init__( self ): = 'foo'

test_class = TestClass()
my_name = getattr( test_class, 'name' )
print "my_name is: " + my_name
print "no, actually it is: " +

Original issue: (November 23, 2010 18:53:23)

From on November 23, 2010 19:57:02:
Which pyjamas version are you using and what are the compile options?
Which browser (if any)?

I get the following output:
my_name is: foo
no, actually it is: foo

From on November 23, 2010 21:12:32:
I'm using the git head, I've reproduced the issue on a separate machine. Here's the last commit:

commit 4820424
Author: Kees Bos
Date: Mon Nov 22 08:41:52 2010 +0100

Fixes issue 520 : Replaced eval() in sys.trackstackstr() with reference to

From on November 23, 2010 21:48:13:
Oh, I was just using regular pyjsbuild with no args. Though generally I try to use --strict.

From on November 24, 2010 09:34:24:
I've tried with several options. I still can't reproduce this.

What I've tried:
rm output/lib/.js; ./pyjsbuild --no-compile-inplace -O --print
rm output/lib/
.js; ./pyjsbuild --no-compile-inplace
rm output/lib/*.js; ./pyjsbuild --no-compile-inplace --strict

So, it should also work without --strict option. If you could provide more details to get to this problem, that s appreciated. (E.g. the test_getattr.js that's generated, assuming that you name your test file also ;-) )

Which browser do you use?

From on January 31, 2012 11:20:55:
I was able to reproduce this with chrome.

This bug should be fixed (commit c06a123)

I'll close this ticket, unless you still see the problem.

From on February 05, 2012 20:18:59:
apologies, kees - LibTest doesn't run (throws an exception with "CompileTest" no attribute named prototype) so i had to back this out (attached)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.