Возвратите выбранные указанные столбцы

Вероятно, что ffmpeg и alprd пытаются взаимодействовать с одинаковыми дескрипторами файла stdin / stdout. Чтобы решить эту проблему, создайте отдельные каналы для одного или обоих подпроцессов, чтобы использовать их как stdin / stdout. Тогда они могут взаимодействовать с ними, не мешая друг другу.

import subprocess

with open('ffmpeg-output.txt', 'w') as ffmpeg_output:
    ffmpeg = subprocess.Popen(
        ['ffmpeg', '-i', 'input', 'output'],
        stdin=subprocess.PIPE,
        stdout=ffmpeg_output,
        stderr=subprocess.STDOUT)
    # We won't be sending any input into ffmpeg's stdin, so close it.
    ffmpeg.stdin.close()

    # alprd inherits stdin, stdout, and stderr from the current process.
    alprd = subprocess.Popen(['alprd', '-f'])

    # Wait for the subprocesses to finish.
    ffmpeg.wait()
    alprd.wait()
10
задан GEOCHET 22 February 2012 в 01:37
поделиться

2 ответа

If BlobDetails isn't the LINQ entity, then you can do it directly:

var qry = from b in dc.Blobs
          orderby b.RowVersion descending
          select new BlobDetails {
              Id = b.Id, Size = b.Size,
              Signature = b.Signature, RowVersion = b.RowVersion};

return qry.ToList();

However; if BlobDetails is a LINQ entity, you need to use subtrefuge:

var qry = from b in dc.Blobs
          orderby b.RowVersion descending
          select new {b.Id, b.Size, b.Signature, b.RowVersion};

var typedQry = from b in qry.AsEnumerable()
               select new BlobDetails {
                  Id = b.Id, Size = b.Size,
                  Signature = b.Signature, RowVersion = b.RowVersion};
return typedQry.ToList();

The AsEnumerable breaks the LINQ composition, making it work.

10
ответ дан 3 December 2019 в 22:01
поделиться

With "select new {" you are creating an anonymous type which cannot be implicitly cast to BlobDetails. Instead, explicitly declare the type you are newing within the select:

var allBlobs = from b in dc.Blobs
           orderby b.RowVersion descending
           select new BlobDetails {Id = b.Id, .... };
allBlobs.ToList();
6
ответ дан 3 December 2019 в 22:01
поделиться
Другие вопросы по тегам:

Похожие вопросы: