why a global variable cannot be found ? 
Author Message
 why a global variable cannot be found ?

The interpreter prints out the following error upon getting to the line
where I ask the variable RescaleValue to be printed out. Please, notice
that such a variable is declared  "global" in the same
proc where the error occurs.
Maybe there is something the interpreter does not like before getting
to the point where such an error is signalled ????

Thank you in advance for your help,
Maura

_________________________________________________________________________-

Error: can't read "RescaleValue": no such variable.

Stack Trace:

can't read "RescaleValue": no such variable
    while executing
"puts "\n DRAW_CANVAS:  RescaleValue = $RescaleValue \n""
    (procedure "draw_canvas" line 10)
    invoked from within
"draw_canvas 0"
    (procedure "pick_hist" line 29)
    invoked from within
"pick_hist"
    invoked from within
".hist_info_frame.butbox.button_ok invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tkButtonUp" line 7)
    invoked from within
"tkButtonUp .hist_info_frame.butbox.button_ok
"
    (command bound to event)
**********************************************************************************************************************
**********************************************************************************************************************
proc draw_canvas { dur } {

    global plot
    global RescaleValue
    global hist_info
    global ihis
    global cur_Norm
    global base

puts "\n DRAW_CANVAS:  RescaleValue = $RescaleValue \n"
puts "\n proc draw_canvas: dur = $dur \n"

    set user_made_input [check_for_input]



Wed, 10 Dec 2008 00:17:59 GMT  
 why a global variable cannot be found ?

Quote:

> Error: can't read "RescaleValue": no such variable.

This is also the error you get if you declare it global and try to use
it without ever having [set] it (or otherwise assigned to it). Just
declaring it global doesn't create the variable.

--
   Darren New / San Diego, CA, USA (PST)
     Native Americans used every part
     of the buffalo, including the wings.



Wed, 10 Dec 2008 00:26:00 GMT  
 why a global variable cannot be found ?

Quote:

> The interpreter prints out the following error upon getting to the line
> where I ask the variable RescaleValue to be printed out.

What value does that variable have when you ask that?

If the variable has never been given a value, the error message
you report will be the result.

Can't read a variable before you write it.

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|



Wed, 10 Dec 2008 00:26:00 GMT  
 why a global variable cannot be found ?

Quote:


> > The interpreter prints out the following error upon getting to the line
> > where I ask the variable RescaleValue to be printed out.

> What value does that variable have when you ask that?

> If the variable has never been given a value, the error message
> you report will be the result.

> Can't read a variable before you write it.

> --
> | Don Porter          Mathematical and Computational Sciences Division |

> | http://math.nist.gov/~DPorter/                                  NIST |
> |______________________________________________________________________|

It makes sense. It was initialize to 1.0 in another proc.
The mechanism worked fine until I changed the proc where the variable
was initialized. By mistake its initialization ended up in a code
branch that is not always executed.
I moved the initialization up to level 1 and now it works again.
Thank you,
Maura


Wed, 10 Dec 2008 00:58:52 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. I am trying to find an equivalency to the global boolean found in labview 2

2. Why is my global variable not updating?

3. Why not global variables in LabVIEW

4. Why don't my global variables work?

5. Why so many references to global variables?

6. ET Question: Why are all variables global ?

7. Class variables / global variables / Init variables

8. Cannot find the right record using random read in TPS but can find in DBF

9. if I set $variable, then I cannot puts $$variable

10. Global Variable / Sessions / ASP Application type Variable

11. why why why oh why why baby

12. cannot find WordApplication object

 

 
Powered by phpBB® Forum Software