drush 4.5
php 5.2.10

This command just prints the view output to console. No file created.

drush views-data-export my_export views_data_export_2 1.txt

This starts after update to the recent dev version (Feb 7). Downgrading to beta5 fixes the problem.

Comments

klausi’s picture

Component: User interface » Code
Category: support » bug
Priority: Normal » Major
brooksbrown’s picture

I think ive found the offending code. Beta 6 added an else statement the following conditional at line 85:

  if (!$view->set_display($args[1])) {
    return drush_set_error('VIEW_DOES_NOT_EXIST', dt('The view !view does not have the !display display.', array ('!view' => $args[0], '!display' => $args[1])));
  }
  else {
    if ($view->current_display != $args[1]) {
      drush_log(dt('Using different display from specified display: @display', array('@display' => $view->current_display)), 'notice');
    }
    drush_set_option('views_data_export_display_id', $view->current_display);
  }

Upon commenting out the else statement I was able to get data into the file. Hope this helps.

steven jones’s picture

Status: Active » Closed (cannot reproduce)

That shouldn't make it print to the screen.

Please re-open if you can still reproduce with more details of any error messages you see etc.

brephraim’s picture

Status: Closed (cannot reproduce) » Active

Same problem for me. No error messages, just no file created and instead output is printed to screen.

finn lewis’s picture

Hi guys!

I have the same problem.

PHP 5.3.2
Drupal 7.15
Drush 5.2
views_data_export 7.x-3.0-beta6

Running the following drush command:
drush views-data-export profile_report views_data_export_1 test.xls

Shows a good deal of table based views output, with lots of table html - and does not appear to generate a test.xls file.

Downgrading to views_data_export 7.x-3.0-beta5 gives more expected drush output:

                                                                      [ok]
Time remaining: about 30 sec.                                     [ok]
Time remaining: about 30 sec.                                     [ok]
Time remaining: about 30 sec.                                     [ok]
Data export saved to .../sites/default/test.xls              [success]

And the test.xls file is saved.

I'm sticking with beta5 for now, but happy to test patches if anyone can offer a fix.

steven jones’s picture

Title: drush prints output, no file created » Exporting non-batched view with Drush fails

Ah, so this is because non-batched output fails to work with Drush, because instead of returning the exported values, we print them out.

steven jones’s picture

Status: Active » Needs review
StatusFileSize
new1.59 KB

Here's a patch that uses output buffering to save the non-batched output,

brephraim’s picture

Appears to work for me. Thanks!

steven jones’s picture

Status: Needs review » Fixed

Awesome, committed.

johnv’s picture

Status: Fixed » Active

Sorry, need to re-open this.

I have a non-batched view working properly with version beta6 d.d. 2012-May-10 .
After installing the -dev version, there is no export file anymore.
When I re-install the vde.drush.inc file from beta6, the export file is OK again. The only difference is this patch.

This is the drush-command, including a file-move to another location:
drush views-data-export <view-id> <display-id> <file-id> --uri=www.example.com > /home/../domains/www.example.com/files/ftp/<file-id>

The drush-log gives the following message:

Data export saved to                                                   [success]
/home/../domains/www.example.com/files/ftp/<file-id>

This seemed OK, but the 65 spaces should show the file-name from $options['output_file'], which is now empty.

[EDIT] In fact, the file exists in its original directory, but has size 0 on the target directory.

steven jones’s picture

Status: Active » Fixed

The output isn't sent to stdout, so you can redirect the output to a file using > at the moment. You would need to copy the file using cp or similar.

Status: Fixed » Closed (fixed)

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