![]() |
|
#1
|
|||
|
|||
Hello,
This is a portion of my code.... import viz import vizinfo import viztask import vizmat import vizact viz.go() #These are for initializing the file file5 = open('response_demo1_repeated_d_button.txt', 'w') out = '' file5.write(out) file5.flush() key = None lastKey = None lastKeyTime = 0.0 timer1 = 1 timer2 = 2 def StartStory(): #Set variables count = 0 pool_number = 3 x_count = 0 y_count = 0 yield viztask.waitTime(2) sound_Instruction1.play() while count<1: ....some actions the avatar is performing... yield onKeyDown(key) . . . def onKeyDown(key): global lastKey,lastKeyTime elapsed = viz.tick() - lastKeyTime file6 = open('response_demo1_repeated_d_button.txt', 'r+') if key == 'd' and lastKey != 'a' and lastKey != 'b' and lastKey != 'c' and elapsed < 100: out = 'n' file5.write(out) file5.flush() lastKey = key lastKeyTime = viz.tick() viz.callback(viz.KEYDOWN_EVENT,onKeyDown) The error which I am getting.... Traceback (most recent call last): File "Sum08_Demo1_NEC_1A_4p5F.py", line 1880, in onKeyDown file6 = open('response_demo1_repeated_d_button.txt', 'r+') # opens file 'response_demo1_instructionscreen.txt' for reading TypeError: 'ActionData' object is not callable The code in blue is at line 1880. In fact, when on multiple press of my 'd' key, I am seeing that the .txt file has a number of 'n'. I am trying to read these muliple 'n' (representing 'd' key press). When I am placing the blue line on top, there is no error, but, in that case I cannot open my .txt file multiple times to get its updated contents. Actually, on every press of 'd' key, I will get an additional 'n' which I want to read. Actually I am confused with the ActionData error when simply I am trying to open a .txt file. Thanks in advance for the suggestion. Uttama |
#2
|
|||
|
|||
Hello,
I am facing the problem of multiple access (precisely...in opening a .txt file in read mode multiple times) so that I can get the updated contents of the .txt file each time. The error message which I am getting is due to my trying to open the .txt file in read mode multiple times within a loop. The error message which I am getting is in my last posting. I don't understand, how it is being deciphered by the program as ActioData. Hope I made my question clear......... If anyone has any suggestion....it would be really helpful to me. Thanks Uttama |
#3
|
|||
|
|||
That error is telling you that you have an ActionData object and you are trying to call it like a function, which it does not support. Since the only function call happening on that line of code is the call to open, that means somewhere above that line you have assigned an ActionData object to a variable called open. I cannot tell you exactly where this is happening because you didn't post all the code, but I'm pretty sure this is what is causing the error.
|
#4
|
|||
|
|||
Hello Farshizzo,
Really there was a open variable (for mouth open) several lines ahead in the program (somehow I missed it.....) Now I can open the file in write mode many times. Thanks for your brilliant suggestion. Uttama |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Could not find plugin to load objects... | halley | Vizard | 1 | 05-30-2006 11:01 AM |
file input | vsully | Vizard | 1 | 12-21-2004 10:51 PM |
avatar head texture issues | rconrey | Vizard | 3 | 11-17-2004 04:05 PM |
Closing file handles from within function | FlyingWren | Vizard | 1 | 10-01-2003 06:02 PM |
I cannot show wrl file with text node | sled | Vizard | 3 | 06-25-2003 07:52 AM |