[Pytables-users] Puzzling error when moving from example...

2007-09-22 Thread Vince Fulco
Dear Pytable Experts-

Making my first leap to an actual table creation exercise and am
unable to define the table columns specifically enough.  I've tried
modding both the "Particle" class example and the "Event" example to
know avail.  The error message begins with the first column header
type "not defined".  Could someone clarify if the column types are too
generic (having taken them from the examples as is) or if the data I
am trying to import into the table is not a fit.  I am trying to
import a list of numpy ndarrays.  I was under the impression from the
examples that it was not necessary to describe each column down to the
minute detail and the software had some auto-config capabilities.

I am using an ancient laptop running Windows XP with python 5.0,
pytables 2.0 and the most recent version of numpy.  All tests passed.

Snippet of code is below..
#
class prices(IsDescription):
yy = Int8Col()
mm = Int16Col()
dd = Int16Col()
hh = Int16Col()
mn = Int16Col()
ss = Int16Col()
priceone = Float16Col()
pricetwo = Float16Col()
pricethree = Float16Col()
pricefour = Float16Col()
activity = Int16Col()
"""
Or
#
Event = {
"yy" : Int8Col(),
"mm" : Int8Col(),
"dd" : Int8Col(),
"hh" : Int8Col(),
"mn" : Int8Col(),
"ss" : Int8Col(),
"priceone" : Float16Col(),
"pricetwo" : Float16Col(),
"pricethree" : Float16Col(),
"pricefour" : Float16Col(),
"activity" : Int8Col(),
}


#
error code
Traceback (most recent call last):
  File "C:\datamung\numpy2pytablesv03.py", line 41, in 
"yy" : Int8Col(),
NameError: name 'Int8Col' is not defined

#

Thanks much, Vince Fulco

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users


Re: [Pytables-users] Puzzling error when moving from example...

2007-09-22 Thread Hans Fangohr
Hi Vince,

On 23 Sep 2007, at 01:52, Vince Fulco wrote:

> Dear Pytable Experts-
>
> Making my first leap to an actual table creation exercise and am
> unable to define the table columns specifically enough.  I've tried
> modding both the "Particle" class example and the "Event" example to
> know avail.  The error message begins with the first column header
> type "not defined".  Could someone clarify if the column types are too
> generic (having taken them from the examples as is) or if the data I
> am trying to import into the table is not a fit.  I am trying to
> import a list of numpy ndarrays.  I was under the impression from the
> examples that it was not necessary to describe each column down to the
> minute detail and the software had some auto-config capabilities.
>
> I am using an ancient laptop running Windows XP with python 5.0,
> pytables 2.0 and the most recent version of numpy.  All tests passed.
>
> Snippet of code is below..
> #
> class prices(IsDescription):
> yy = Int8Col()
> mm = Int16Col()
> dd = Int16Col()
> hh = Int16Col()
> mn = Int16Col()
> ss = Int16Col()
> priceone = Float16Col()
> pricetwo = Float16Col()
> pricethree = Float16Col()
> pricefour = Float16Col()
> activity = Int16Col()
> """
> Or
> #
> Event = {
> "yy" : Int8Col(),
> "mm" : Int8Col(),
> "dd" : Int8Col(),
> "hh" : Int8Col(),
> "mn" : Int8Col(),
> "ss" : Int8Col(),
> "priceone" : Float16Col(),
> "pricetwo" : Float16Col(),
> "pricethree" : Float16Col(),
> "pricefour" : Float16Col(),
> "activity" : Int8Col(),
> }
>
>
> #
> error code
> Traceback (most recent call last):
>   File "C:\datamung\numpy2pytablesv03.py", line 41, in 
> "yy" : Int8Col(),
> NameError: name 'Int8Col' is not defined
>
> #
>

I think to remember that the examples assume that you have a line like::

   from tables import *

at the beginning of your code. Then, all these objects should be  
visible.

Alternatively, if you don't like to 'pollute' your name space with  
all the pytables objects, could use ``tables.Int8Col()`` in your  
source instead of ``Int8Col()``.

Hope that helps,

Hans


> Thanks much, Vince Fulco
>
> -- 
> ---
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
> ___
> Pytables-users mailing list
> Pytables-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pytables-users
>
>

--
Hans Fangohr
School of Engineering Sciences
University of Southampton
Phone: +44 (0) 238059 8345

Email: [EMAIL PROTECTED]
http://www.soton.ac.uk/~fangohr







-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users