I am attempting to use Drush to manage my vocabularies and I'm running into an error.

The command I'm using looks like this:
drush taxocsv-import /Volumes/Bullfrog/om/sites/all/taxonomies/age_group.csv tree --vocabulary_id=age_group --result_term

I want to import the file age_group csv and have it overwrite the taxonomy with the machine name "age_group", which already exists in my database.

But upon inputting this command, I get the following error after "Checking options...":
Unknown options: structure-tables, skip-tables, config-file, context-path, php.

Then I see "Reset language for all terms" appear twice.

In my database, a new vocabulary is created called "age_group 2" with a machine name of "age_group_212_43960".

There are no terms in the category.

I am attaching the file I used to make the import, which I created by making an export using the web interface.

I am running drush 5.0-rc4, but I also tried drush 4.5 and drush 4.4-- both of which also gave me the same error.

Any help you can offer would be much appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Daniel_KM’s picture

Category: support » bug

Hi,

Thanks for your full infos on the bug. This is probably related to your Drush version.

For my part, I use Drush 4.5 and I've imported your file without problem, except for result_term (it should be result_terms).

You can import your vocabulary with Drush 5.0 if you comment lines 173 to 182 of taxonomy_csv.drush.inc.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

Daniel_KM’s picture

Status: Active » Fixed

Hi,

Others remarks on your message:

  • --vocabulary_id can't be used alone: you need to add the option --vocabulary_target=existing.
  • The "Reset language" message is displayed by i18n or locale module when a new vocabulary is created.
  • I don't know why your file has not been uploaded. I have no problem with it and when a file is not uploaded, a warning is displayed.

I've committed a patch to avoid to check options "structure-tables, skip-tables, config-file, context-path, php" in order to be compatible with Drush 5.0, currently unstable. The patch allows too to use --vocabulary_id alone. This vocabulary will automatically be used even if --vocabulary_target=existing is not set.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

ptmkenny’s picture

Status: Fixed » Active

Thank you! I downloaded and installed the latest dev version and ran the following command, which I modified as per your instructions:

drush taxocsv-import /Volumes/Bullfrog/om/sites/all/taxonomies/age_group.csv tree --vocabulary_id=age_group --vocabulary_target=existing --result_terms

However, I am now getting the following error with drush 5.0-rc4:
- Unknown options: php-options. [error]

I then tried drush 4.5, which worked fine (no error). (Before, I reported that I also had the error with drush 4.4 and 4.5. This was because I forgot to clear the drush cache using 'drush cache-clear drush' after checking out a new drush version with git.)

Daniel_KM’s picture

Version: 7.x-5.10 » 7.x-5.x-dev
Status: Active » Fixed

Hi,

Thanks for your comment. I fixed taxonomy_csv.drush.inc to avoid this new error with Drush 5. I hope that Drush 5 will be stable soon!

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

maxrossello’s picture

Version: 7.x-5.x-dev » 7.x-5.10
Status: Closed (fixed) » Active

Hi,
reopening this since I am experiencing a similar problem with drush 5.7 (tried also 5.5 before).

drush @max vocimp /var/chroot/home/content/21/9347221/site/taxonomy/regions.csv tree --enclosure='"' --check_hierarchy --vocabulary_id=region --vocabulary_target=existing

The output is:

Checking options...
- Unknown options: uri, root, #name, #group, #hidden, #file, php.

Any additional terms in the csv file are not imported.

It is anyway necessary to specify
--vocabulary_target=existing
otherwise I obtain the very same first behavior reported here (new empty vocabulary, and still the 'Unknown outputs' print)

csv file is a simple hierarchical one

"America"
"America","North America"
"America","North America","Mexico"
"America","South America"
"Europe"

thanks

Daniel_KM’s picture

Version: 7.x-5.10 » 7.x-5.x-dev

Hi,

On my distribution, Drush is released with a few months delay, so I can use only Drush 5.4. With it and the last dev release of Taxonomy CSV, there is no problem to import your csv file.

As soon as Drush 5.7 will be available on my OS, I check it. Meanwhile, you can try the last dev release, that will be released soon.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

truyenle’s picture

My case is a little bit different
I try both drush5.8 and 4.6 and both I do have this error
The drush command 'taxocsv_import /Users/tle/Downloads/Temp/newaa.csv tree' could not be found

I am using the latest dev version (2012-Jun-15)

thanks

ptmkenny’s picture

@truyenle If you have a different error, you should open a new issue. One issue = one problem

groovehunter’s picture

Still get that with drush 5.9 and current master.

Outcommented lines around 180, patch attached

for me works now:

1. deleted all vocs from unsuccessful tests

drush php-eval '$taxes=taxonomy_vocabulary_get_names(); foreach($taxes as $tax) { taxonomy_vocabulary_delete($tax->vid); }'

2. create vocabulary manually, ie. "Abteilung"

3. import

drush vocimp /path/to/abteilungen.csv flat --vocabulary_target=existing --vocabulary_id=abteilung

with flat voc like:

"Abteilung 1"
"Zentrale"
"EDV"
...
groovehunter’s picture

hm seems I was not taking care enough for the branch - in this issues 5.x-dev branch it is fixed