Matthieu, you made my day!!!
I did read up on QDirIterator but clearly didn't see the woods for the trees.

Thanks!!

frank

On 10/03/16 10:50 pm, Matthieu Cadet wrote:
It seems that the problem come from your while block,
I get the same bug, but if you put it.next() before .fileInfo(),
it works ;)

while it.hasNext():
    it.next()
    info = it.fileInfo()

According to the Qt documentation "After construction, the iterator is located before the first directory entry. Here's how to iterate over all the entries sequentially:"

QDirIterator  it("/etc",  QDirIterator::Subdirectories);
  while  (it.hasNext()) {
      qDebug <qthelp://com.trolltech.qt.485/qdoc/qtglobal.html#qDebug>()<<  
it.next();

      // /etc/.
      // /etc/..
      // /etc/X11
      // /etc/X11/fs
      // ...
  }
Hope this will works for you too ;)

On Thu, Mar 10, 2016 at 5:15 AM, Frank Rueter | OHUfx <fr...@ohufx.com <mailto:fr...@ohufx.com>> wrote:

    Hi guys,

    I have been seeing this issue for ages now and finally decided to
    try and fix it, however, even after writing a tiny little test
    case I still cannot get to the bottom of this, so I am hoping you
    guys can help:
    pyside-rc refuses to compile an image file with a certain name and
    I don't know why.
    Here is the simple test case that reproduces the issue (all
    required files are in the attached zip file):

    I have a few icons like this:
    ../sandbox/resourceTest/icons/other.svg
    ../sandbox/resourceTest/icons/particles.svg
    ../sandbox/resourceTest/icons/presets.svg

    I need to compile these icons into a resource module, so I have
    created a resource.qrc file on the same level as the "icons"
    directory which looks like this:
    <RCC>
      <qresource>
        <file>icons/other.svg</file>
        <file>icons/particles.svg</file>
        <file>icons/presets.svg</file>
      </qresource>
    </RCC>

    I then compile the resource file with this command line:
    pyside-rcc -o resources.py resources.qrc

    To test the contents of the resource file I run the following test
    code ("qiteratorTest.py" in the zip):

    from PySide import QtCore
    import sys
    import resources

    it = QtCore.QDirIterator(':/icons',filter=QtCore.QDir.Files,
    flags=QtCore.QDirIterator.Subdirectories)
    while it.hasNext():
        info = it.fileInfo()
        print '{} exists: {}'.format(info.baseName(), info.exists())
        it.next()

    The result is this:

         exists: False
        presets exists: True
        other exists: True

    No matter what I do, I cannot get pyside to compile the file
    called "particles.svg".
    To make matters more interesting, I duplicated the same file and
    renamed it to the above file names ("other.svg", "particles.svg"
    and "presets.svg"). But I still get the same result, so it's
    clearly not related to the file itself, but it's name.

    I have been struggling with this problem for ages now. If anybody
    has any ideas, I would be very, very grateful!

    Cheers,
    frank


-- ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing
    <http://ohufx.com/index.php/vfx-compositing> | *workflow
    customisation and consulting
    <http://ohufx.com/index.php/vfx-customising>* *


    _______________________________________________
    PySide mailing list
    PySide@qt-project.org <mailto:PySide@qt-project.org>
    http://lists.qt-project.org/mailman/listinfo/pyside




--
Matthieu Cadet
Compositor Artist & TD,
nWave Digital
matthieu.ca...@gmail.com <mailto:matthieu.ca...@gmail.com>

--
ohufxLogo 50x50 <http://www.ohufx.com> *vfx compositing <http://ohufx.com/index.php/vfx-compositing> | *workflow customisation and consulting <http://ohufx.com/index.php/vfx-customising>* *

_______________________________________________
PySide mailing list
PySide@qt-project.org
http://lists.qt-project.org/mailman/listinfo/pyside

Reply via email to