Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It looks to me like Python is just passing on an error from the underlying <code>open()</code> call and the real culprit here is the Linux CIFS support - I doubt Python would be synthesizing <code>ENOMEM</code> unless system memory was truly exhausted (and probably even then I'd expect the Linux <a href="http://blog.singhanuvrat.com/tech/the-linux-oom-killer" rel="nofollow">OOM killer</a> to be invoked instead of getting <code>ENOMEM</code>).</p> <p>Unfortunately it might need something of a Linux filesystem expert to figure out what's going on there, but looking at the <a href="http://lxr.free-electrons.com/source/fs/cifs/cifsfs.c" rel="nofollow">sources for CIFS in the Linux kernel</a>, I can see a variety of places where <code>ENOMEM</code> is returned when various kernel-specific resources are exhausted as opposed to total system memory, but I'm not familiar enough with it to say how likely any of them are.</p> <p>To rule out anything Python-specific you can run the process under <code>strace</code> so you can see the exact return code that Python is getting from Linux. To do this, run your command something like this:</p> <pre><code>strace -eopen -f python myscript.py myarg1 myarg2 2&gt;strace.log </code></pre> <p>The <code>-f</code> will follow child processes (i.e. the <code>jpeginfo</code> commands that you run) and the <code>-eopen</code> will only show you <code>open()</code> calls as opposed to all system calls (which is what <code>strace</code> does by default). This could generate a reasonable amount of output, which is why I've redirected it to a file in the above example, but you can leave it displaying on your terminal if you prefer.</p> <p>I would expect you'd see something like this just before you get your exception:</p> <pre><code>open("/path/to/file name.jpg", O_RDONLY) = -1 ENOMEM (Cannot allocate memory) </code></pre> <p>If so, this error is coming straight from the filesystem <code>open()</code> call and there's very little you can do about it in your Python script. You could catch the exception and retry (perhaps after a short delay) as you're already doing if <code>jpeginfo</code> fails, but it's hard to say how successful this strategy will be without knowing what's causing the errors in the first place.</p> <p>You could, of course, copy the files locally, but it sounds like that would be a serious pain as there are so many.</p> <p><strong>EDIT:</strong> As an aside, you'll expect to see lots of <code>open()</code> calls which are nothing to do with your script because <code>strace</code> is tracing <em>every</em> call made by Python, which includes it opening its own <code>.py</code> and <code>.pyc</code> files, for example. Just ignore the ones which don't refer to the files you're interested in.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload