masroore / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

TypeError when running PySide from within PyScripter #425

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run PyScripter with custom Python location, using batch file:

SET PYTHONHOME=C:\path\to\python
PyScripter --PYTHON27 --PYTHONDLLPATH "C:\path\to\python" %*

2. Use attached python script.

What is the expected output?

A Qt label is displayed.

What do you see instead?

PySide reports the following exception:

Message File Name   Line    Position    
Traceback               
    <module>    C:\Documents and Settings\admin\Desktop\module1.py  4       
TypeError: bad argument type for built-in operation             

What version of the product are you using? On what operating system?

PyScripter 2.1.0.0
Python 2.7.0 win32
PySide 0.4.1 win32
Windows XP 64-bit SP2

Please provide any additional information below.

Tried 'Remote Interpreter' and all others, without success.
The given code works if typed directly to python console (python.exe).
Moreover, it works if typed in the 'Python Interpreter' window inside 
PyScripter.
It seems to be a problem between the GUI and interpreter.

Original issue reported on code.google.com by paulo.ivson@gmail.com on 7 Oct 2010 at 5:31

Attachments:

GoogleCodeExporter commented 9 years ago
The problem is that pyscripter sets the contents of sys.argv as unicode strings.

if you modify your script to

from PySide import QtCore, QtGui
import sys

sys.argv = [str(i) for i in sys.argv]
app = QtGui.QApplication(sys.argv)
label = QtGui.QLabel("Hello")
label.show()
sys.exit(app.exec_())

then it runs fine.

Python documentation says that for filenames and the like a unicode string 
could be used in place of an str.  Why PyQt is not prepared to accept a unicode 
string in sys.argv is beyond me.

In any case I will change the behaviour in the forthcoming release.

Original comment by pyscripter on 7 Oct 2010 at 7:51

GoogleCodeExporter commented 9 years ago
Thanks for the quick response. I was unaware of this unicode behavior. By the 
way, congratulations on this great IDE!

Original comment by paulo.ivson@gmail.com on 7 Oct 2010 at 8:52

GoogleCodeExporter commented 9 years ago
Hey I may have a similar problem when I attempt to make this tuto :
http://www.youtube.com/watch?v=fqK8N48kPXs&list=PLA955A8F9A95378CE

The script is launching, but refuses to close, while it should after 5 
seconds...

the code is in the file

Tahnks a lot !

Original comment by vincentg...@gmail.com on 4 Jun 2013 at 1:19

Attachments: