1

I'm trying to use PyKDE, PyKDE.kdecore.KStandardDirs to be precise. This method is called with two strings according to the documentation and according to the PyQt4 documentation, I can use standard Python strs instead of QString. This doesn't work:

>> KStandardDirs.locate()("socket", "foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: KStandardDirs.locate(): not enough arguments
>>> KStandardDirs.locate("socket", "foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: KStandardDirs.locate(): argument 1 has unexpected type 'str'

I can't use QString either because it doesn't seem to exist:

>>> from PyQt4.QtCore import QString
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name QString
>>> from PyQt4.QtCore import *
>>> QString
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'QString' is not defined

What am I doing wrong?

Jon Clements
  • 138,671
  • 33
  • 247
  • 280
Nova
  • 2,623
  • 4
  • 26
  • 45

1 Answers1

3

I suspect that PyKDE is not yet Python 3 ready, at least as far as that error message is concerned; try passing in a bytestring instead:

KStandardDirs.locate(b"socket", "foo")
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343