|
FAQ
Frequently Asked Questions
Which Python versions are supported?PyScripter supports Python versions 2.3, 2.4, 2.5, 2.6, 3.0 and 3.1. You should consider support for version 2.3 as deprecated and likely to be dropped soon. How can I debug Django applications?Here is how you can debug Django applications with PyScripter in six simple steps:
To stop debugging, right-click on the interpreter window and select "Reinitialize Interpreter", then go to the browser and reload the document. How do I use PyScripter with Portable (Movable) Python?You can very easily setup PyScripter so that it can work with unregistered versions of Python such as for example Portable Python and Movable Python which are typically residing in a USB stick or a portable hard disk. Steps: a) Download the zip-only distribution from the PyScripter downloads page and extract it to a directory of your choice in the portable drive. b) From an existing PyScripter installation copy PyScripter.ini (this file is typically located in the %APPDATA%\PyScripter directory) to the same directory as the PyScripter.exe file.. c) In the same directory create a batch or command file that will set the PYTHONHOME environment variable and start PyScripter with appropriate command-line options e.g. SET PYTHONHOME=E:\PortablePython PyScripter --PYTHON25 --PYTHONDLLPATH "E:\PortablePython" %1 %2 %3 %4 %5 d) Start PyScripter using the created batch file. How do I use PyScripter with an unregistered version of Python?See answer above When should I use the remote interpreter/debugger?The remote interpreter/debugger is strongly recommended for all uses of PyScripter. It is more robust since it isolates the IDE from the Python engine that runs your scripts. It also allows you to start afresh by reinitializing the Python engine. When you run GUI scripts such wxPython, Tkinter etc. it is necessary to use the remote Python engine and reinitialize the engine before each run. This last step is done automatically by default. Back to Top How do I use the remote interpreter/debugger?How do I use Matplotlib with PyScripter?To work with matplotlib within PyScripter you should use the Remote Python Engines. You can also run matplotlib in interactive mode. Here is how:
>>> import matplotlib
>>> matplotlib.interactive(True)
>>> matplotlib.use("WXAgg")
>>> from matplotlib.pylab import *
>>> plot([1,2,3])
>>> xlabel('time (s)') >>> from pylab import *
>>> plot([1,2,3])
>>> xlabel('time (s)')
Sample script by heylam #Tested on: PyScripter 1.9.9.2, Matplotlib 0.91.2
#Assumed setup:
#In site-packages\matplotlib\mpl-data\matplotlibrc set backend to WXAgg.
def demoplot():
'''This represents your work'''
close('all') #closes figures
t = c_[0:1:20j]
s = cos(2*pi*t)
for ampl in c_[0.1:1:10j]:
plot(t, ampl*s, 'o-', lw=2)
xlabel('time (s)')
ylabel('voltage (mV)')
title('demo', color='b')
grid(True)
draw() #update figure if already shown
#Select a demonstration:
if 0: #Normal session
#Starts non-interactive.
#Figures have toolbar for zooming and panning.
#Disadvantage: You can't re-run your script with PyScripter Remote
# engine without first reinitializing the Remote interpreter.
#Best use Remote(Wx) engine. This also allows interactive mode using
# ion() and ioff(). For disadvantages: see the PyScripter help file.
#from numpy import *
#from scipy import * #includes numpy
from pylab import * #includes scipy
demoplot()
show() #Open the figure, let figure GUI take over.
#This should be last line of script.
#You can also type this at command line after the script exits.
if 0:
ion() #turns interactive mode on (needs Remote(Wx) engine!)
ylabel('interactive modification')
plot( rand(200), rand(200), 'go' )
ioff() #turns interactive mode off
elif 0: #Same but use WX instead
try:
type(matplotlib)
except NameError:
import matplotlib
matplotlib.use('WX')
from matplotlib.pylab import *
demoplot()
show() #Open the figure, let figure GUI take over.
#This should be last line of script.
#You can also type this at command line after the script exits.
elif 0: #Same but start as interactive session, needs Remote(Wx)engine.
try:
type(matplotlib)
except NameError:
import matplotlib
matplotlib.interactive(True)
from matplotlib.pylab import *
demoplot()
show() #Open the figure, let figure GUI take over.
#This should be last line of script.
#You can also type this at command line after the script exits.
elif 0:#pdf output, allows use of Remote engine without re-initialization.
#Disadvantage: no figure toolbar.
#WARNING: close the file in acrobat reader before the next run.
#(Maybe other pdf viewers don't block file overwrite)
try:
type(matplotlib)
except NameError:
import matplotlib
matplotlib.use('PDF')
from pylab import *
demoplot()
filename='demo_plot'
savefig(filename)
#view the file:
import win32api
win32api.ShellExecute(0, "open", filename+'.pdf', None, "", 1)
elif 1:#png output, allows use of Remote engine without re-initialization.
#Disadvantage: no figure toolbar.
#Tip: make Irfanview your standard viewer.
from pylab import *
demoplot()
filename='demo_plot'
savefig(filename)
#view the file:
import win32api
win32api.ShellExecute(0, "open", filename+'.png', None, "", 1) How do I use PyScripter with TortoiseHg installed?TortoiseHg is Windows Explorer extention for the Mercurial distributed revision control system. When installed it affects PyScripter in two ways.
Use PyScripter with a python version different than 2.5 which comes with TortoiseHg. You can force PyScripter to use a specific version of Python using the -PYTHONxx start up flags e.g. PyScripter --PYTHON26 If you really need to use Python 2.5 then create a command file with the followingregsvr32 /u "C:\Program Files\TortoiseHg\tortoisehg.dll" PyScripter --PYTHON25 --PYTHONDLLPATH=c:\windows\system32 regsvr32 "C:\Program Files\TortoiseHg\tortoisehg.dll"Then run PyScripter using this command file. Note that the PYTHONDLLPATH should point to the directory in which the originall python25.dll that came from the python installation program resides. Update The incompatibility between PyScripter and the TortoiseHg Mercurial addon has finally been fixed with the release of TortoiseHg 0.8, which replaces the Python Windows shell extensions with C++ based ones. Back to Top How do I use PyScripter in Ubuntu?This how-to is based on the XFCE 4.8 desktop running on top of Ubuntu 11.04. The easiest way to get this configuration is to install Xubuntu. Or from any Ubuntu distribution one can install the XFCE meta package from Synaptic and choose XFCE from the boot manager at login.
I installed version 1.3.15 via Synaptic.
option and proceed with the installation as normal.
Double click on the exe and Wine will intercept it and run it automagically.
and proceed with the installation as normal. Applications menu>Wine>Programs>PyScripter> "your choice" Both configurations seem to work flawlessly with the internal and remote python engines. How do I have autocompletion with PyQt4 or PyGtk?
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui QtGui.
and voila. Code completion is available. See Support Group message for explanations.
Why am I getting UnicodeEncodeError/UnicodeDecodeError?Most likely you are using scripts with file names containing non-ascii characters. Please see my blog post explaining the issue and providing advice for dealing with it. | |
for the "portable python" batch file example above, use %* instead of %1 %2 ... %5 to capture all command line parameters instead of just the first five. Also on WinXP and above, %~dp0 can be used to determine the path of the currently running batchfile (so the drive letter doesn't need to be hard coded).
Example, pyscripter25.bat at root of portable drive: