WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 32 votes, 4.38 average. Display Modes
  #1  
Old 05-12-2006, 05:52 PM
enkeli enkeli is offline
Member
 
Join Date: Mar 2006
Location: Isla Vista
Posts: 24
'int' object not callable

Quote:
Traceback (most recent call last):
File "C:\Program Files\Vizard25\viz.py", line 5916, in mytimer
curAction.update(elaps,curAction._obj_)
File "C:\Program Files\Vizard25\vizact.py", line 1199, in update
sample = int(p * self.numsamples)
TypeError: 'int' object is not callable
Traceback (most recent call last):
File "DecisonMaking.py", line 1010, in trial
peopleGiveResponse( i, slideNumber )
File "DecisonMaking.py", line 816, in peopleGiveResponse
lookAbout = whrandom.randrange( -1 ,2 ) # -1,0,1
File "C:\Program Files\Vizard25\bin\lib\whrandom.py", line 103, in randrange
istart = int(start)
TypeError: 'int' object is not callable
Traceback (most recent call last):
File "DecisonMaking.py", line 1108, in timer
viz.starttimer( TIMER_BLINK_CLOSE[ i ], whrandom.randrange( 3, 7 ) )
File "C:\Program Files\Vizard25\bin\lib\whrandom.py", line 103, in randrange
istart = int(start)
TypeError: 'int' object is not callable
I am getting these errors sometimes from my program (which has also started crashing/closing on me without any error messages)

These errors appear to be from inside the whrandom, what can I do?

Last edited by enkeli; 05-12-2006 at 05:59 PM.
Reply With Quote
  #2  
Old 05-15-2006, 07:02 AM
halley halley is offline
Member
 
Join Date: Oct 2005
Posts: 27
That module defines a class called whrandom. You must create an instance of the whrandom class, and then that instance can provide a stream of numbers. This works a bit differently from a simple function.

Code:
import whrandom
rng = whrandom.whrandom()
for loop in range(10):
    num = rng.randrange(1, 5)
    print num
This is a complete example. It loads the whrandom module. It creates an instance of the whrandom class, and we refer to it with the variable "rng". The instance decides on a seed to begin automatically. It then uses that instance to fetch new random numbers. Keep the instance for as long as you need to generate numbers.
__________________
--
[ e d h a l l e y ]
I'm just a user, not a representative of WorldViz. Hope I've been helpful.
Reply With Quote
  #3  
Old 05-15-2006, 03:44 PM
enkeli enkeli is offline
Member
 
Join Date: Mar 2006
Location: Isla Vista
Posts: 24
Thank you. I changed the whrandom, but I still get the same error from a different source (viz.py and vizmat.py and vizact.py)

Quote:
Traceback (most recent call last):
File "C:\Program Files\Vizard25\viz.py", line 5916, in mytimer
curAction.update(elaps,curAction._obj_)
File "C:\Program Files\Vizard25\vizact.py", line 1153, in update
quat = vizmat.slerp(self.beginRot,self.endRot,p)
File "C:\Program Files\Vizard25\vizmat.py", line 173, in slerp
return (qFrom*scale_from) + (quatTo*scale_to)
File "C:\Program Files\Vizard25\vizmat.py", line 348, in __mul__
if isinstance(other,Quat) or (type(other) == type([]) and len(other) >= 4):
TypeError: 'int' object is not callable
Traceback (most recent call last):
File "C:\Program Files\Vizard25\viz.py", line 5916, in mytimer
curAction.update(elaps,curAction._obj_)
File "C:\Program Files\Vizard25\vizact.py", line 1199, in update
sample = int(p * self.numsamples)
TypeError: 'int' object is not callable
"C:\Program Files\Vizard25\vizact.py", line 1153, in update
quat = vizmat.slerp(self.beginRot,self.endRot,p)
File "C:\Program Files\Vizard25\vizmat.py", line 173, in slerp
return (qFrom*scale_from) + (quatTo*scale_to)
File "C:\Program Files\Vizard25\vizmat.py", line 348, in __mul__
if isinstance(other,Quat) or (type(other) == type([]) and len(other) >= 4):
TypeError: 'int' object is not callable

Last edited by enkeli; 05-15-2006 at 03:48 PM.
Reply With Quote
  #4  
Old 05-16-2006, 01:48 PM
enkeli enkeli is offline
Member
 
Join Date: Mar 2006
Location: Isla Vista
Posts: 24
Exclamation

I just got an error even with the whrandom change...

Code:
rand = whrandom.whrandom()
Quote:
Traceback (most recent call last):
File "DecisonMaking.py", line 1114, in timer
viz.starttimer( TIMER_BLINK_CLOSE[ i ], rand.randrange( 3, 7 ) )
File "C:\Program Files\Vizard25\bin\lib\whrandom.py", line 115, in randrange
return istart + int(self.random() *
TypeError: 'int' object is not callable
Help?
Reply With Quote
  #5  
Old 05-16-2006, 05:04 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
The “TypeError: 'int' object is not callable” error message indicates that python expected a function in the place of an int object type. Perhaps there is a variable named int like in the following code.

Code:
import viz
viz.go()

int = 4
print int(1.1)
Reply With Quote
  #6  
Old 05-16-2006, 05:10 PM
enkeli enkeli is offline
Member
 
Join Date: Mar 2006
Location: Isla Vista
Posts: 24
In my code, there are no variables named "int"
Reply With Quote
  #7  
Old 05-16-2006, 05:47 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Guess I am a little stumped without your complete code context. I suggest that you focus your debuging on the fact that you are getting a Type Error. You could also try utilizing the newer ‘random’ module instead of whrandom.
Reply With Quote
  #8  
Old 05-16-2006, 06:01 PM
enkeli enkeli is offline
Member
 
Join Date: Mar 2006
Location: Isla Vista
Posts: 24
Thank you for responding. The trouble with debugging is the fact that this is an intermittent problem which does not occur every time the code is run. And as in one of the earlier posts, the 'int' object not callable error occurs with other modules than just the whrandom.
Reply With Quote
  #9  
Old 10-22-2009, 04:12 PM
onina onina is offline
Member
 
Join Date: Oct 2009
Posts: 1
I had the same problem. My mistake was to have declared use the name "range" as a variable before I called the function range(10).
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:20 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC