Tags:
create new tag
view all tags
---++ On a Windows PC, using the command line * Make sure your 'path' environment variable points to your Python executable (perhaps C:\Python25).<br />See [[http://www.computerhope.com/issues/ch000549.htm][this page]] for instructions on how to set the path variable in XP.<br />In Vista, find the control for setting environment variables in 'Start/Control Panel/System and Maintenance/System' and select "Advanced system settings". * Use notepad to save a copy of the script you're modifying, with a .py extension, in the directory of your choice. <br />(e.g. "C:\My Documents\Ling472\Assignment 1\elizalike.py") * Open a command prompt: From the start menu either <br />select 'All Programs/Accessories/Command Prompt', or <br />select 'run', and type "cmd" in the window that pops up. * type "cd" followed by the path to the directory containing your copy of the script.<br />(e.g. "cd C:\My Documents\Ling472\Assignment 1") * To run the script, type "python filename.py" in the command window. * Edit your script, save it, and test it again with "python filename.py". ---++ On a Windows PC, using the Graphical User Interface Note: this works best for scripts that do not take any arguments. * Save a copy of the script you're modifying, with a .py extension, in the directory of your choice. * Associate the .py extension with the Python Interpreter: <br />In your directory, select 'Folder Options' from the tools menu.<br />In the File Types tab, click 'New', and enter the extension 'py'<br />click 'Change' and select the Python Command Line Interpreter * To run the script, double click it. ---++ On Dante or one of the Treehouse machines * Log in to Dante using ssh and type S at the initial screen to get a shell. * Or login to a Treehouse workstation. * Make a directory for your scripts: mkdir pythonscripts * Go to that directory: cd pythonscripts * Make a copy of the starter script you're working on. Save it with a .py extension. * Use a text editor such as emacs or pico to edit the script. * To run a script type<br /><br />python filename.py<br /> * Edit your script and save it, and run it again to test changes. * You may find it helpful to have multiple terminal windows open, at least one for editing the script and one for running it. ---++ On a Mac running OS X * Make a directory, say, inside ~/Documents. * Save a copy of the python script you're working on in that directory, with the extension .py. * Edit the python script with emacs or textedit. (NB: With textedit, you'll need to make sure to save the file as plain text rather than rtf.) * To run the script, in your terminal window, type<br /><br />python filename.py<br /> * Edit the script with your favorite text editor, and save it. * Run it again from the terminal window to see the effect of your changes.
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2013-03-30
-
gslayden
Home
Site map
Main web
Sandbox web
TWiki web
Main Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
E
dit
A
ttach
Copyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback