1

For a file located /home/rrg29876/villy/air.out, all is well when I run the following code in Windows:

#Open a FileDialog to pull in supported data
formats = ("R Output Files (*.out);;"
           "Rc Output Files (*.out);;"
           "A Average Files (*.avg);;"
           "A Timestep Files (*.tim)")
fileName, filtr = QFileDialog.getOpenFileName(self,
    "Select A Data File to Open", self.defdir, formats)
self.defdir = path.split(fileName)[0]

print "self.defdir: ",self.defdir
print "fileName: ", fileName
print "filtr: ", filtr

But in Linux I get:

self.defdir: /home/rrg29876/vill
fileName:  home/rrg29876/villy/D
filtr:  Rc Output

and then I cannot do anything in my program because the filename and filtr are wrong..

Can anyone help explain this truncation to me and/or suggest ways to fix/get around this?

TZHX
  • 5,291
  • 15
  • 47
  • 56
Ryan Grove
  • 11
  • 2
  • What are your versions of python, pyside and Qt? – Pavel Strakhov Jun 05 '15 at 15:15
  • We are using python 2.7, pyside 1.2.2, and PyQt4. – Ryan Grove Jun 05 '15 at 16:08
  • Looks like a borked PySide installation. Did you compile it yourself on Linux? – ekhumoro Jun 05 '15 at 17:03
  • No, it was installed on our cluster by technical staff. – Ryan Grove Jun 05 '15 at 17:09
  • It works well for me with the same versions. – Pavel Strakhov Jun 05 '15 at 17:51
  • @RyanGrove. I've seen similar issues with corrupted strings which were due to the pyside libs failing to pick up the right python libs at runtime. Do you see anything different if you do: `print repr(self.defdir)`? – ekhumoro Jun 05 '15 at 18:19
  • I forgot to say: I also cannot reproduce the problem on Linux (PySide-1.2.2 and Qt-4.8.7). – ekhumoro Jun 05 '15 at 18:29
  • Yes, hahaha.. I get the following: u'/\x00t\x00c\x00s\x00/\x00w\x00a\x00o\x00/\x00h\x00o\x00m\x00e\x00/\x00r\x00r\x00g\x002\x009\x008\x007\x006\x00/\x00v\x00i\x00c\x00e\x00' – Ryan Grove Jun 05 '15 at 18:30
  • @RyanGrove. Not sure I understand your "hahaha". A unicode string would never normally contain all those null characters. And a unix filepath categorically *cannot ever* include them. So it does look very much like your pyside installation is borked, as I suggested earlier. – ekhumoro Jun 05 '15 at 19:46
  • The "hahaha" translates roughly into "Ahhhh, I see the problem now". I appreciate your help! – Ryan Grove Jun 08 '15 at 13:59

0 Answers0