"Impossible to get parent..."

cfab - August 17, 2009 - 02:44
Project:Taxonomy CSV import/export
Version:6.x-4.1
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi

I've a 1200 lines file to import, I encounter a lot of such errors and can't figure why...

For instance, when parsing these two lines ("|" being my fields separator and "¤" the text separator) :

||¤Equipement 19 Rack¤|
||¤Câbles pour patchs¤|

The first one goes well and the second doesn't giving me an error message on the parent item of the previous line...

Anyone to help?

#1

cfab - August 18, 2009 - 02:30

I've bypassed the test leading to this error, all terms are presents but indeed some are at the wrong position... I shall move them, It's not solved but I have my vocab initialized at least.

Well, as I supposed, there's a problem during parsing and the process looses the parent. As I saw, errors occur on the restart points : when I look at the progress bar, each time there's a progress, there's an error and the process makes terms orphans...

[Edit] The batch process leads to such an error when progressive mode is enabled. Non progressive mode is ok. I think the static variable $previous_imported_line is not correctly handled during the batch slices changes.[/Edit]

#2

Daniel_KM - August 18, 2009 - 07:11

Hi,

"||¤Equipement 19 Rack¤|" and "||¤Câbles pour patchs¤|" (which mean in a more used format csv : ,,"Equipement 19 Rack", and ,"Câbles pour patchs", ) are used to import structure with one term by line method. Currently, multistep import is not compatible with one line by term import. Next version (4.3) will do it.

Regards,

Daniel Berthereau
Knowledge manager

#3

cfab - August 18, 2009 - 15:42

Yes, I've tried a different format for the test. even with the simplest format it failed.

Well, I didn't say I was on a multistep process which I saw it failed differently indeed. The multistep checkbox is unchecked here...

As I wrote, the problem is in the batch process, which looses the parent term on slices changes (when the progress bar is updated). I have never use the batch process, so I can't tell more precisely what the solution is, but if you make it progressive=FALSE, the process goes well. I think there's a problem on the value of the previous line, but I can't go further.

Maybe it's linked also to the format I took, with ",,term3,' instead of "term1,term2,term3", but I thought it was possible for a hierarchical vocab. If not, you should precise it in the documentation.

#4

Daniel_KM - August 19, 2009 - 11:36

Hi,

When you import a line without a first item, one of previous lines need to have previous items. In your example, i don't understand what is the parent of the term ¤Equipement 19 Rack¤. In one of previous lines, you need set it, by example:

¤Electronique¤|¤Accessoires¤
||¤Equipement 19 Rack¤|
||¤Câbles pour patchs¤|
.
In this case, ¤Equipement 19 Rack¤ has ¤Accessoires¤ as a first level parent and ¤Electronique¤ as a second level parent and ¤Electronique¤ is the highest level term. I'm going to add in the documentation that a first level item is always needed.

Regards,

Daniel Berthereau
Knowledge manager

#5

cfab - August 19, 2009 - 17:29

Hi,

yes my csv file is constructed like that. I've tried to attach it here, but that leads to an error (maybe this is the file I need to exorcize!!!).

I give you the entire sequence from the master level corresponding to the lines I put previously :

Guitares et basses~~~
~Guitares électriques~~
~~Sets~
~~Stratocasters~
~~Télecasters~
~~Les Paul~
~~SG~
~~Heavy guitares~
~~ES~
~~Modèles jazz~
~~7-cordes~
~~Modèles bariton~
~Guitares classiques~~
~~Guitares classique 1/8~
~~Guitares classique 1/4~
~~Guitares classique 1/2~
~~Guitares classique 3/4~
~~Guitares classique 7/8~
~~Guitares classique 4/4~
~~Guitares classique gaucher~
~~Autres guitares classiques~
~Guitare country~~
~~Guitares dreadnought~
~~Guitares Jumbo~
~~Guitares folk~
~~Guitares Roundback~
~~Guitares Dobro~
~~Guitare country 12 cordes~
~~Guitares acoustiques gaucher~
~~Guitares acoustiques Signature~
~~Autres guitares country~
~Basses électriques~~
~~Sets basses~
~~Jazz 4 cordes~
~~Jazz 5 cordes~
~~Precision 4 cordes~
~~Precision 5 cordes~
~~Autres basses 4-cordes~
~~Autres basses 5 cordes~
~~Basses 6 cordes~
~~Heavy basses 4-cordes~
~~Heavy basses 5-cordes~
~~Basses fretless~
~~Basses gaucher 4 cordes~
~~Basses gaucher 5 cordes~
~~Basses électriques short scale~
~~Divers basses~
~Basses acoustiques/semi-acoustiques~~
~~Basses acoustiques 4-cordes~
~~Basses acoustiques 5-cordes~
~~Basses acoustiques fretless~
~~Basses acoustiques gaucher~
~~Basses demi-caisses 4-cordes~
~~Basses demi-caisses fretless~
~Autres instruments à cordes~~
~~Ukuleles~
~~Banjos~
~~Mandolines~
~~Steel guitars~
~~Autres instruments à cordes~
~Amplis guitares électriques~~
~~Combos guitares électriques~
~~Tête ampli guitares électriques~
~~Preamps guitares~
~~Amplis puissance guitares~
~~Pédales pour amplis guitares~
~~Housse ampli. guit.~
~~Accessoires ampli guitare~
~~Pédale midi~
~~Corps guitares 1x12~
~~Corps guitares 2x12~
~~Corps guitares 4x12~
~~Autres Corps guitares~
~~Atténuateur~
~Amplificateurs basses~~
~~Combos basses~
~~Têtes ampli basse~
~~Preamps basses~
~~Amplis puissance basses~
~~Pédale amplificateurs basses~
~~Housses protection ampli. basses~
~~Accessoires pour ampli. basses~
~~Corps basses 2x10~
~~Corps basses 4x10~
~~Corps basses 8x10~
~~Autres Corps basses~
~Amplis guitares acoustiques~~
~~Amplificateur acoustique~
~~Preamps acoustiques~
~~Pédales pour ampli. acoustique~
~~Housses ampli. acoustique~
~~Accessoires ampli. acoustique~
~Lampes pour amplis~~
~~Lampes EL34~
~~Lampes 6L6~
~~Lampes ECC83~
~~Lampes EL84~
~~Autres Lampes~
~Cordes~~
~~Cordes guitares électriques~
~~Cordes guitare country~
~~Cordes guitares classique~
~~Cordes basses électriques~
~~Cordes basses acoustiques~
~~Cordes pour banjos~
~~Cordes pour mandolines~
~~Cordes pour Ukuleles~
~~Cordes pour guitares steel~
~~Cordes individuelles guitare~
~~Cordes individuelles basse~
~~Autres Cordes~
~Effets guitares et basses~~
~~Multi effets guit. électr.~
~~Distortions~
~~Chorus/ Flanger/ Phaser~
~~Delays/ Echos~
~~Equalizer~
~~Reverb et effets hall~
~~WahWah~
~~Autres effets guit. électr.~
~~Accessoires pour effets guitares~
~~Multi-effets basse~
~~Effets basse~
~~Accessoires effets basse~
~~Effets pour guitares acoustiques~
~~Pédales volume et expression~
~~Accordeurs~
~~Switch~
~~Pièces de réseau~
~~Equipement 19 Rack~
~~Cables pour patchs~
~~Cases pour effets guitares~
~~Housses pour effets guitares~
~~Accessoires Rockbag~

This is one main term, there's a lot, so I've had the time to observe the process of import, with the progress bar (no multistep, just the batch progressive process) and every update to this bar lead to an error where the parent term was lost...
What I did to confirm that it was the progressive operation that messed up was to set batch['progressive'] = FALSE; in includes/forms.inc, line 2499 (I've tried to force the value externally to avoid this temporary hack, in vain). This hack written, the process worked correctly and I had no error at all.

Regards,
cfab

#6

Daniel_KM - August 21, 2009 - 16:54

Hi,

I can import your file without problem and I can't replicate your bug, but i'm going to add progressive setting in the next version, as it seems to have no bad effect and it can resolve yours.
I've try your file on Taxonomy csv 4.2, as it resolves some memory error and your problem is perhaps a memory problem.
Your remark make me find a bug in text area import with one term by line import (but not with file import). Thanks for your comments.

Regards,

Daniel Berthereau
Knowledge manager

#7

cfab - August 21, 2009 - 17:24

Ok, in my case, textarea import leads to the same problem.

Maybe it's my config, the problem is still present with 4.2

As I've found a solution (not really convenient, but it works), it's not a problem anymore for me.

Thanks for this very useful module!

cfab

 
 

Drupal is a registered trademark of Dries Buytaert.