Hello

Im newbie in pytables and I have a question regarding to an error
message. I writing a program which basically read a text file to a
pytable  and then I want to modify one field in the table according to
a condition related to another field. the program is very simple and
I'm getting the following error:

  File "D:\python\prod_tests\src\test_receivers.py", line 54, in <module>
    check_receivers(path_r,1)
  File "D:\python\prod_tests\src\test_receivers.py", line 45, in check_receivers
    for row in ro_detector.where('completo <= 20000'):
  File "C:\Python26\lib\site-packages\tables\table.py", line 1210, in where
    return self._where(condition, condvars, start, stop, step)
  File "C:\Python26\lib\site-packages\tables\table.py", line 1226, in _where
    condvars = self._requiredExprVars(condition, condvars, depth=3)
  File "C:\Python26\lib\site-packages\tables\table.py", line 977, in
_requiredExprVars
    user_locals = user_frame.f_locals
  File "C:\Python26\lib\site-packages\psyco\support.py", line 124, in
__getattr__
    raise AttributeError, ("local variables of functions run by Psyco "
AttributeError: local variables of functions run by Psyco cannot be
accessed in any way, sorry
Closing remaining open files: temp.h5... done

I got the same error in Windows xp as well as  Ubuntu 10.4.

Could you please help me with that?

Regards

German

the source code is the following

import os
from tables import *
import numpy as np

def check_receivers(path_r,espaciamiento):


    class Detector(IsDescription):
        completo = FloatCol()
        punto    = FloatCol()
        fecha    = FloatCol()

    file = open(path_r,"r")

    filename = "temp.h5"
    hIndex1file = openFile(filename, mode = "w", title = "Test file")

    group_detector   = hIndex1file.createGroup("/", 'detector',
'Detector information')
    table_detector = hIndex1file.createTable(group_detector,
'preplot',Detector, "hh")
    row_detector   = table_detector.row

    while 1:
        line = file.readline()
        if len(line)>12:
            row_detector['completo']=
float(float(line[1:11])*1000000+float(line[11:21]))
            row_detector['punto']   = float(line[11:21])
            row_detector['fecha']   = float(0)
            row_detector.append()
        if not line:
            break
        pass # do something
    file.close()

    hIndex1file.close()

    filename = "temp.h5"
    hIndex1file = openFile(filename, mode = "a", title = "Test file")
    ro_detector= hIndex1file.root.detector.preplot
    fecha_ant=0

    for row in ro_detector.where('completo <= 20000'):
        row['fecha'] = 2
        row.update()
    hIndex1file.close()

if __name__=="__main__":
    import psyco
    psyco.full()
    path_r="D:/python/prod_tests/src/data/sourcesps_sim_select_s1143_r1117.r"
    check_receivers(path_r,1)

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to