f



Error: a=nominal([1 2 1 2]), b=getlevels(a), b(2)

According to documentation for "categorical", getlevels returns a uniquified version of its input, but is of the same type.  I am baffled by the differences in what I see in the input & output:

   a=nominal([1 2 1 2])
   b=getlevels(a)
   a(2)
   b(2)  % Error: Index exceeds matrix dimensions
   b(1)  % This scalar index returns all 2 elements
   numel(b) % Shows 2 unique elements

I tried a vertical "a", but "b" is still horizontal:

   a=nominal([1;2;1;2])
   b=getlevels(a) % 1x2 row array of unique numbers
   b(2)  % Error: Index exceeds matrix dimensions
   b(1)  % This scalar index returns all 2 elements in 1 row
   numel(b) % Shows 2 unique element's

The help pages for categorical data indicate that the following should be OK, but it generates errors:

   >> a(find(a==2))
   Error using nominalcheck (line 53)
   Invalid types for comparison.
   Error in nominal/eq (line 20)
   [acodes,bcodes] = nominalcheck(a,b);

In fact, even find(a==2) generates the same error, and I tacked it down to a==2.  This means that the following is erroneous as well:

   >> a(a==2)
   Error using nominalcheck (line 53)
   Invalid types for comparison.
   Error in nominal/eq (line 20)
   [acodes,bcodes] = nominalcheck(a,b);

I need to access elements in "a" based on a specified unique value.  I need to process the elements of "a" differently depending on the value used to select the elements.  I tried the following, which seems to work.

   b=unique(a)
   a(a==b(2))

So it seems that I can't use getlevels as an array of unique values in order to cycle through those values.  I have to resort to good old fashion unique.  I'm wondering if I'm using the nominal class in the way it was intended.
0
paul
1/23/2014 5:10:42 PM
comp.soft-sys.matlab 211266 articles. 17 followers. lunamoonmoon (258) is leader. Post Follow

6 Replies
530 Views

Similar Articles

[PageSpeed] 46

On Thursday, January 23, 2014 12:10:42 PM UTC-5, paul.d...@gmail.com wrote:
> According to documentation for "categorical", getlevels returns a
> uniquified version of its input, but is of the same type.  I am
> baffled by the differences in what I see in the input & output:
>=20
>    a=3Dnominal([1 2 1 2])
>    b=3Dgetlevels(a)
>    a(2)
>    b(2)  % Error: Index exceeds matrix dimensions
>    b(1)  % This scalar index returns all 2 elements
>    numel(b) % Shows 2 unique elements
>=20
> I tried a vertical "a", but "b" is still horizontal:
>=20
>    a=3Dnominal([1;2;1;2])
>    b=3Dgetlevels(a) % 1x2 row array of unique numbers
>    b(2)  % Error: Index exceeds matrix dimensions
>    b(1)  % This scalar index returns all 2 elements in 1 row
>    numel(b) % Shows 2 unique element's
>=20
> The help pages for categorical data indicate that the following
> should be OK, but it generates errors:
>=20
>    >> a(find(a=3D=3D2))
>    Error using nominalcheck (line 53)
>    Invalid types for comparison.
>    Error in nominal/eq (line 20)
>    [acodes,bcodes] =3D nominalcheck(a,b);
>=20
> In fact, even find(a=3D=3D2) generates the same error, and I tacked it
> down to a=3D=3D2.  This means that the following is erroneous as well:
>=20
>    >> a(a=3D=3D2)
>    Error using nominalcheck (line 53)
>    Invalid types for comparison.
>    Error in nominal/eq (line 20)
>    [acodes,bcodes] =3D nominalcheck(a,b);
>=20
> I need to access elements in "a" based on a specified unique value.
> I need to process the elements of "a" differently depending on the
> value used to select the elements.  I tried the following, which
> seems to work.
>=20
>    b=3Dunique(a)
>    a(a=3D=3Db(2))
>=20
> So it seems that I can't use getlevels as an array of unique values
> in order to cycle through those values.  I have to resort to good
> old fashion unique.  I'm wondering if I'm using the nominal class in
> the way it was intended.

BTW, I need the nominal class because I need LinearModel.fit to recognize t=
hat column of a dataset as categorical (and it is not ordinal).  In the rea=
l problem, the values in that field are strings, so I may yet encounter fur=
ther issues that don't show up in this simple example.
0
paul
1/23/2014 5:23:36 PM
For the record, and hopefully of help to those wandering down this path, I found that the following works as expected, with the exception of the last two.

   a=nominal({'x';'xx'})
   b=getlevels(a)'
   a==b              % Answer: 1 1
   b(1)              % 'x'
   isa(b(1),'char')  % Answer is false
   a==b(1)           % As expected
   size(b(1))        % Answer: 1 1
   a(1)==b(1)        % True

It seems that as long as I treat the elements of a & b as an unknown data type rather than as a string, things work.
0
paul
1/23/2014 5:35:52 PM
Scratch my optimistic last post.  Things get muddy with simple examples:

   >> % works
   >> a=nominal({'x';'xx'})
   >> a=='x'
   >>
   >> % Error
   >> a=nominal([1;2])
   >> a==1
   >>
   >> % Error on assignment
   >> a=nominal({1;2})
0
paul
1/23/2014 5:47:33 PM
I think I found a solution.  The reason why I needed nominal is because tha=
t column / variable in a dataset must be nominal in order for LinearModel.f=
it to recognize it as categorical.  I thought I needed to use nominal on th=
e same variable when submitting data to the LinearModel.predict method.  Be=
cause the help says that the variables must be of the same type.  It turns =
out I don't need nominal in that 2nd case (dataset argument to predict()) a=
s long as it was nominal in the creation of the LinearModel using LinearMod=
el.fit.  In fact, it doesn't matter whether the nominal column is a cell ar=
ray of strings or just a char matrix.

Hopefully, this saves someone a day or two.
0
paul
1/23/2014 6:32:52 PM
On Thursday, January 23, 2014 1:32:52 PM UTC-5, paul.d...@gmail.com
wrote:
> I think I found a solution.  The reason why I needed nominal is
> because that column / variable in a dataset must be nominal in order
> for LinearModel.fit to recognize it as categorical.  I thought I
> needed to use nominal on the same variable when submitting data to
> the LinearModel.predict method.  Because the help says that the
> variables must be of the same type.  It turns out I don't need
> nominal in that 2nd case (dataset argument to predict()) as long as
> it was nominal in the creation of the LinearModel using
> LinearModel.fit.  In fact, it doesn't matter whether the nominal
> column is a cell array of strings or just a char matrix.

Sorry, my mistake.  I dataset submitted to predict() had to have the catego=
rical data column as a non-nominal matrix of char.  A cell array of strings=
 causes errors because, out of necessity, the model was created with that c=
olumn as nominal, and the error is that there is no comparison operator for=
 this situation.

This is a serious problem (I mean for me, not for those who know the soluti=
on).  Regression models will be created with nominal variables, and predict=
ions have to be made on test data.  I expect that there must be a way to su=
bmit the test data to the predict() method.  At the following site, such a =
nominal column of data is submitted as a scalar, but the author is using fi=
tlm, which is not available in 2013a.  A scalar is not repmatted into a col=
umn/variable by LinearModel.predict, and the documentation describes the co=
nditions on the predict() arguments which precludes that.

http://www.mathworks.com/help/stats/group-comparisons-using-categorical-arr=
ays.html

Can anyone please describe how LinearModel.predict is used with a categoric=
al field?  While I'm new in this area of mathematics, I don't expect that t=
his is a unique problem by any means.
0
paul
1/23/2014 7:08:16 PM
OK, I think this is the final clincher on this topic.  The last post about =
LinearModel.predict choking on a cell array of strings for a categorical va=
riable...that was just me being my dumb self.  All the methods (dataset, Li=
nearModel.fit, and LinearModel.predict) work as advertised.  I had an extra=
 layer of cell wrapping that was (rightfully) causing the error.

And the real take-way?  Avoid all the problems I ran into with nominal by n=
ot using nominal.  Variable columns in dataset that are strings are interpr=
eted as categorical by default.  And the help for dataset provides ways to =
explicitly designate categorical variable colums for non-default cases.  So=
 despite my meandering on this thread, hope this saves someone 2 days or so=
!
0
paul
1/23/2014 8:43:20 PM
Reply:

Similar Artilces:

how can i write this statement labels=[1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;3;]; in compress fo
How to write it in compact form to avoid repetition "shah " <shahkhn3@gmail.com> wrote in message <lodugh$8hr$1@newscl01ah.mathworks.com>... > How to write it in compact form to avoid repetition You'll find in this thread different solutions for similar question http://www.mathworks.fr/matlabcentral/newsreader/view_thread/335814 Bruno ...

LaTex equation numbering like 2.1, 2.2, also 2.0.1, 2.0,2, 2.1.1, etc
David Roach wrote: > Is there a simple command to have latex number > the equations by the section numbers automatically. > > David From the LaTeX Companion (what a wonderful book!) %%%%%%%%%%%%%%%%%%%%%% % number equations within sections % In preamble \makeatletter \@addtoreset{equation}{section} \makeatother \renewcommand{\theequation}{\thesection.\arabic{equation}} %%%%%%%%%%%%%%%%%%%%%% Numbers within sections...I use this all the time in articles. Even works with ******************* ******************* Brilliant. And then I got numbering within subsections by repe...

[1 1 1 1 1 ;2 2 2 2 2 ;3 3 3 3 3 3;....;n n n n n]
Hi, Anybody knows how to create this matrix but without using any loops? a=[1 1 1 1 1 ;2 2 2 2 2 ;3 3 3 3 3 ;.......;n n n n n ] Thank you. Hana. Hana wrote: > Hi, > Anybody knows how to create this matrix but without using any loops? > a=[1 1 1 1 1 ;2 2 2 2 2 ;3 3 3 3 3 ;.......;n n n n n ] HELP REPMAT - Randy Hana wrote: > > > Hi, > Anybody knows how to create this matrix but without using any > loops? > a=[1 1 1 1 1 ;2 2 2 2 2 ;3 3 3 3 3 ;.......;n n n n n ] > > Thank you. > Hana. Hope this isn't homework. >> repmat([1:n]'...

Help construct a tree 1 -> 1.1 -> 1.2 -> 2 -> 2.1 -> 2.1.1 etc HELP !!!!!!!
Borland Guru's I need help I have a text file as follows: 1 2 1.1 1.1.1 3.3 2.3 etc I cannot use a control active x tree I need to read this file and 1 is a parent 1.1 is a child of parent 1 and 2 is a parent 2.3 is a child of parent 2 and construct in search a way using arrays or probably a recursive function No xml parsing just read a file. Does any body have a function "Mos" <lndebug@gmail.com> wrote in message news:c1aaeb20-3c1f-408d-9986-bb8d28a87509@s31g2000vbp.googlegroups.com... > I have a text file as follows: > 1 > 2 > 1.1 >...

Help construct a tree 1 -> 1.1 -> 1.2 -> 2 -> 2.1 -> 2.1.1 etc HELP !!!!!!!
Folks I need help. I have a view or(Text file) as follows: '1 2.1 1.1.1 1.1.1.1 2.2.1 1.3 2 Dim Parent() As String Dim Level1() As String Dim Level2() As String Dim Level3() As String etc .. How can I construct a tree. parent, children, grand children etc... and also figure out # of children # of grand children etc Thanks "Mos" <lndebug@gmail.com> wrote in message news:875cd1df-7605-45ab-9f7b-f1edec25d47b@r34g2000vbi.googlegroups.com... > Folks I need help. I have a view or(Text file) as follows: > > '1 > 2.1 > 1.1.1 > 1....

Help construct a tree 1 -> 1.1 -> 1.2 -> 2 -> 2.1 -> 2.1.1 etc HELP !!!!!!!
Folks I need help. I have a view or(Text file) as follows: '1 2.1 1.1.1 1.1.1.1 2.2.1 1.3 2 Dim Parent() As String Dim Level1() As String Dim Level2() As String Dim Level3() As String etc .. How can I construct a tree. parent, children, grand children etc... and also figure out # of children # of grand children etc Thanks "Mos" <lndebug@gmail.com> wrote in message news:875cd1df-7605-45ab-9f7b-f1edec25d47b@r34g2000vbi.googlegroups.com... > Folks I need help. I have a view or(Text file) as follows: > > '1 > 2.1 > 1.1.1 > 1....

Upgrade from VO 1 - 2 - 2..1 -2.2 - 2.3 -2.4 - 2.5 - 2.6 - 2.7
About upgrade 2.5 - 2.7 at $ 384.00 For most products I'm using - the updates (2.0 - 2.1 - 2.7) are free... 2.0 to 3.0 might be worth + 10-30% of the original price? VO is + full price again & again - Full program price for every minor upgrade/bug-fix? I dropped out of the money/bugs [VO] at 2.5 after starting at 1.0 more than 10 years ago. Certainly whoever is making VO have to make a living; earning moneys: - that is OK! A 10 years old VO site; - 10 years later, how much have changed? http://www.yi.com/prany/cavo/cavofront.htm Even MS is not ...

how to "(1-3*x^2)/(1-3*x+x^2+2*x^3) => 1/(1-2*x) + x/(1-x-x^2)"?
hi normal(1/(1-2*x) + x/ (1-x-x^2),expanded); 1/(1-2*x) + x/(1-x-x^2) => (1-3*x^2)/(1-3*x+x^2+2*x^3) how to do the reverse? dillogimp@gmail.com writes: > normal(1/(1-2*x) + x/ (1-x-x^2),expanded); > 1/(1-2*x) + x/(1-x-x^2) => (1-3*x^2)/(1-3*x+x^2+2*x^3) > how to do the reverse? convert(%,parfrac,x); -- Joe Riel ...

Re: Rational[a,b] vs Rational[1,2] #2 #2
I think this sort of thing has been discussed before in this list ad nauseam (although usually with respect to things involving I). On 2/21/2011 7:30 PM, Richard Fateman wrote: > I find it potentially hazardous that Head[] > does not distinguish the cases of Head[1/2] > > and Head[Rational[a,b]] > > Thus these both get transformed... > > 1/2 /. Rational[r_,s_]-> foo[r,s] > > Rational[a,b] /. Rational[r_,s_] -> foo[r,s] > > > but compare ... > > 1/2 /. 2->4 > > Rational[a,2] /. 2->4 > > I'm not saying I'm surprised by this, of course. > > Perhaps Rational[a,b] should be converted to a/b unless both > a and b are numbers. > > Oh, for some fun, try Rational[1/2,4]. > > > RJF > > PS, I used version 7. > > -- Murray Eisenberg murray@math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305 ...

Printing 2^1, 2^2, 2^3, 2^4 and 2^5
Hi, When I use a while loop, the output is: 2 4 8 16 32, as desired: <?php $c=1; while($c<=5) { $d = newpow(2, $c); print "$d "; $c++; } function newpow($base, $power) { // statements... } ?> The But when I use a for loop, the output is: 64: <?php for($c=1; $c<=5; $c++); { $d = newpow(2, $c); print "$d "; } function newpow($base, $power) { // statements... } ?> Why is this?? Many thanks, Michael mejpark wrote: > When I use a while loop, the output is: 2 4 8 16 32, as desired: [...] > The But when I use a for loop, the output is: 64...

Does 4/2/2= (4/2)/2 =1 OR = 4/(2/2)=4
I don't have matlab and I am trying to translate some simple matlab code. Does 4/2/2 = (4/2)/2 = 1 or 4/2/2 = 4/(2/2) = 4 On 9/11/2012 9:43 AM, sarah.englander@gmail.com wrote: > I don't have matlab and I am trying to translate some simple matlab code. > > Does 4/2/2 = (4/2)/2 = 1 yes. At a given precedence level (and obviously two of the same operators are the same level) evaluation proceeds from LtoR. ....snip... <http://www.mathworks.com/help/techdoc/matlab_prog/f0-40063.html#f0-38155> -- dpb <none@non.net> wrote in message <...

Porting BSP/Tornado 2.1.2 MIPS to Tornado 2.2.1
Dear all, I've just installed Tornado 2.2.1 for MIPS. To my horror, the VxWork project file I received from my customer is written on Tornado 2.1.2. My questions: 1. How to migrate from 2.1.2 to 2.2.1 without previously installing 2.1.2 ? 2. What's the fastest way to do the migration without prjMigrate tools ? Thank you in advance. ...

#1 #n+1 #2n+1 #2 #n+2 #2n+2 #3 #n+3 #2n+3 #n #2n #3n #1 #2 #3 #n #n+1 #n+2 #n+3 #2n #2n+1 100 Gbps aggregate stream of 64/66b words virtual lane markers virtual lane 1 virtual lane 2 virtual lan
#1 #n+1 #2n+1 #2 #n+2 #2n+2 #3 #n+3 #2n+3 #n #2n #3n #1 #2 #3 #n #n+1 #n+2 #n+3 #2n #2n+1 100 Gbps aggregate stream of 64/66b words virtual lane markers virtual lane 1 virtual lane 2 virtual lane 3 virtual lane n Simple 66-bit word level round robin distribution Transmit PM Transmit PM Receive PM Receive PM Transmit PC Receive PC 1 0.0 1.0 0.1 0.2 0.3 1.2 1.2 1.1 0.0 1.0 0.1 1.1 2.0 3.0 4.0 6.0 7.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 17.0 18.0 19.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 1...

do matlab has combination fuction? for example, I want to selcet 2 numbers from 1,2,3,4,5,then I want to get following array:[1,2],[1,3],.....
undefined In article <ef33da0.-1@webx.raydaftYaTP>, dincent <accessdxt123@163.com> wrote: > undefined I might have responded to this with a reasonable answer, had you NOT posted your entire question as the subject title and left the body of the post as "undefined". Too bad. John -- The best material model of a cat is another, or preferably the same, cat. A. Rosenblueth, Philosophy of Science, 1945 Those who can't laugh at themselves leave the job to others. Anonymous ...

Upgrade of Xalan 1.2.2 and Xerces 1.4.4 to Xalan 2.6 and Xerces 2.6.2
I've been tasked with upgrading the JVM from 1.3 to 1.4, and the third party libraries used by my company on our existing Java framework. I'm most worried about any problems that may occur due to upgrading Xalan and Xerces as our framework performs much XML transformation and processing. Does anyone have a link to known issues with such an upgrade (besides the Xalan / Xerces sites) ? Or has anyone done such an upgrade and can share their pearls of wisdom? Thanks Chris ...

(??] [2/4]
begin 644 TEST2.txt 186YO=&AE<B!T97-T+BXN+BX` ` end Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.usenet.com ...

Re: Convincing Mathematica that Sqrt[a+b]Sqrt[a-b]==Sqrt[a^2+b^2] #2
On 12/20/05 at 11:35 PM, hattons@globalsymmetry.com (Steven T. Hatton) wrote: >Is there a way to convince Mathematica to multiply >Sqrt[a+b]Sqrt[a-b] to produce Sqrt[a^2+b^2]? Well there is: In[1]:= z = Sqrt[a + b]*Sqrt[a - b]; Sqrt[Expand[z^2]] Out[2]= Sqrt[a^2 - b^2] -- To reply via email subtract one hundred and four ...

ihi = y[1]>y[2] ? (inhi=2,1) : (inhi=1,2);
Can someone tell me what the above is in "easy" C code, ie. using if and else? I think it's this: if y[1]>y[2] { inhi=2; ihi=1; } else { inhi=1; ihi=2; } but I'm not sure. Thanks. ihi = y[1]>y[2] ? (inhi=2,1) : (inhi=1,2); does indeed the same as > if y[1]>y[2] > { > inhi=2; > ihi=1; > } else { > inhi=1; > ihi=2; > } Is it meant to be an entry for the obfuscated C-code competition or something ? spibou@gmail.com wrote: > ihi = y[1]>y[2] ? (inhi=2,1) : (inhi=1,2); > does indeed the same as > > > if y[...

Blender 2.34 and Python 2.1, 2.2, 2.3
If you can run python scripts in blender 2.3x, I'll be glad to know which versions did you install. Checking at blender.org, I found that blender 2.34 is built with python 2.3. However, I don't want to perform an installation of python 2.3 if I'm not sure that it fixes my problem (I found some people saying that this problem is fixed by downgrading from python 2.3 to 2.2, and also the freeware.sgi.com python is still at 2.1.1, so I've no idea on the best option). Before playing with a custom installation of python, I'm posting the problem here with the hope that somebody experienced it and knows the solution). Here it goes: After installing Python 2.1.1 from freeware.sgi.com, setting PYTHONHOME to /usr/freeware, and installing the officially precompiled Blender 2.34, I still get this warning at Blender startup: 'import site' failed; use -v for traceback sys_init:warning - no sitedirs added from site module. Then, when I try to run the python script, I get an error stating "ImportError: No module named os". And, btw, it always dumps core with segmentation fault when I quit Blender (it doesn't matter if I tried to run the python script or not, it still dumps core if I just start blender and quit it immediatly without doing anything). cesar wrote: > If you can run python scripts in blender 2.3x, I'll be glad to know > which versions did you install. > > Checking at blender.org, I f...

"... WHERE (a, b) != (1,2) AND (a,b) != (1,3) ..."
Hi. I would like to retrieve all records from a table except these where the (a, b) combination has one of a series of specific values. For example, in MySQL I can given the table: a b 1 2 1 3 3 4 Do: SELECT a, b FROM tbl WHERE (a, b) != (1,2) AND (a, b) != (3,4) And get result: 1 3 Whats the DB2 equivalent? Thanks. Morten usenet@kikobu.com wrote: > > Hi. > > I would like to retrieve all records from a table except these where > the (a, b) combination has one of a series of specific values. For > example, in MySQL I c...

[News] 4 Linux Releases: Foresight Linux 1.1, Ubuntu CE 2.2, Kwort 2.2, Mandriva 2007.1 RC1
Foresight Linux 1.1 is out ! http://foresightlinux.com/downloads/ Kwort [Slackware derivative] 2.2 final released! ,----[ Quote ] | I'm proud to announce that Kwort 2.2 final version has been released | after a very long time (more than a year). The system is very stable | and very usable. `---- http://kwort.org/?page=NewsViewer&ID=45&PHPSESSID=1d286ac69fabebf18b4db27ded0b277d Mandriva Linux 2007 Spring RC1 (aka "Xianyang") ,----[ Quote ] | New since Mandriva Linux 2007: | | * Major desktop components | o KDE 3.5.6 | o GNOME 2.18 (RC: final release will include GNOME 2.18) | o OpenOffice.org 2.1 | o Mozilla Firefox 2.0 `---- http://wiki.mandriva.com/en/Releases/Mandriva/2007.1/Development/RC1 ...

devpi-{server-2.1.2,web-2.2.1}: bugfixes, streamlined web templates
devpi-server-2.1.2 and devpi-web-2.2.1 bring a host of fixes to the private pypi server system. You can upgrade without migrating your data if you run already with devpi-server-2.1.X. Find docs as usual at: http://doc.devpi.net Many thanks to Florian Schulze who did most of the changes in devpi-web. Have fun, holger krekel, merlinux GmbH devpi-server-2.1.2 ------------------ - fix issue172: avoid traceback when user/index/name/version is accessed. - fix issue170: ensure that we parse the prospective pip-6.0 user agent string properly so that using the user...

python 2.1 and 2.2
This is a multi-part message in MIME format. --------------090608080807070903010708 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, I remembered reading somewhere that Guido had demonstrated a significant speed increase from python 2.1 to python 2.2 (or something like that). Anyone knows how is the test done? Is it using pystone.py? Thanks maurice --------------090608080807070903010708 Content-Type: text/x-vcard; charset=utf-8; name="mauriceling.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="m...

cPickle from 2.2 to 2.1
hi list, I use cPickle in a small .cgi to save data. It run's fine on python 2.2.3 (used for development) but fails on 2.1.1 (webserver) with: File "spyblog.py", line 543, in __init__ self.entry = cPickle.load(open(log + self.filename, 'r+')) SystemError: Failed to import class _reconstructor from module copy_reg If I create the file on the webserver everything works, so apparently the 2.1.1 version of cPickle can't read files generated with the newer one. Does it mean the cPickle format is not compatible across versions? thx Paul [paul] > I use cPickle in a small .cgi to save data. It run's fine on python > 2.2.3 (used for development) but fails on 2.1.1 (webserver) with: > > File "spyblog.py", line 543, in __init__ > self.entry = cPickle.load(open(log + self.filename, 'r+')) > SystemError: Failed to import class _reconstructor from module > copy_reg > > > If I create the file on the webserver everything works, so apparently > the 2.1.1 version of cPickle can't read files generated with the newer > one. Does it mean the cPickle format is not compatible across > versions? Sorry, not enough information to say for sure. The specific error you're seeing *can* occur when trying to unpickle a pickle of a new-style class instance under a version of Python before new-style classes were introduced. Since new-style classes were introduced in 2.2, a pickle made u...

Web resources about - Error: a=nominal([1 2 1 2]), b=getlevels(a), b(2) - comp.soft-sys.matlab

Resources last updated: 3/6/2016 1:07:16 PM