Re: codeEditor installation problem
Kevin Altis <[email protected]>
| Newsgroups | gmane.comp.python.pythoncard |
|---|---|
| Message-ID | <[email protected]> |
On Aug 27, 2007, at 12:26 PM, Root, Richard wrote: > Kevin, > > Seems like we fix one problem and immediately another arises! In > the exercises in the book, I have to switch between Python Shell > and codeEditor, cutting, pasting etc. When I dbl click on > codeEditor.py, and run the script, the codeEditor code is > apparently all that the Python shell can handle, because I can no > longer use it for the exercises. In the book, the only info > provided on running codeEditor is on page 3: > > > > “Once it is installed on your system with PythonCard, on linux or > unix based systems, you can just type codeEditor in a terminal > shell window and it will start.” > > > > I have tried that, and its not so. So how can I have codeEditor > running, and a “live” Python Shell window also? Am I making any > sense here? > > Thanks, > > Rich The codeEditor has a built-in shell. There are a number of different ways that you could startup the codeEditor, but if they aren't giving you specific instructions about how they want you to run it with specific examples here are some things to try. Since you're on a Mac you can run it from the Terminal by typing: python codeEditor.py This is assuming that the default python is 2.5.x. You can double- check this by just typing: python at the Terminal prompt. You should see something like this: [machine:PythonCard/tools/codeEditor] bob% which python /Library/Frameworks/Python.framework/Versions/Current/bin/python [machine:PythonCard/tools/codeEditor] bob% python Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help", "copyright", "credits" or "license" for more information. Type Ctrl-D to quit the Python shell. So, assuming you have 2.5.x you can just use "python" instead of pythonw to run GUI PythonCard programs. Note the machine name, user name and directories will be different on your setup. You can also provide a filename directly for codeEditor to open up like this: python ~/python/PythonCard/tools/codeEditor/codeEditor.py somefile.py What I'm doing above is changing to a directory for a project I'm working on and then providing a path to the codeEditor application so Python can find it and a command-line filename argument for the file I want to open, which in the example above is called somefile.py. If you have configured your Python Launcher correctly on the Mac, which is located in your Applications->MacPython 2.5 directory then you can also just double-click a Python file to run it. See the instructions at: http://pythoncard.sourceforge.net/macosx_tiger_installation.html Basically, you want your interpreter set to /usr/local/bin/python Back in the Terminal you can see that this is a link to the 2.5.x Python ls -la /usr/local/bin/python lrwxr-xr-x 1 root wheel 68 Jul 23 13:35 /usr/local/bin/python - > ../../../Library/Frameworks/Python.framework/Versions/2.5/bin/python I know it seems confusing, but all these links are the *nix way :) Anyway, what you'll want to do is make an alias of the PythonCard/ tools/codeEditor/codeEditor.py file a keep that on your desktop. Then you can just double-click it to open it whenever you want. It keeps a history of the last files you've been editing, so it should be easy then to get back to what you were working on. Now finally, as far as the shell goes there is a Shell menu in the codeEditor that you can toggle via the F5 key to hide/show it. This is a full Python shell, so you can type in code there to try stuff out. Note that the shell can be somewhat confusing for copying and pasting on the Mac because it uses control instead of command (Ctrl- C, Ctrl-V) for copy and paste and the codeEditor menu doesn't actually deal correctly with shell selections so you need to rely on the control keys. That is a bit of a Mac-specific bug and window context, that hopefully one of these days we can workaround. Check out the following page for more on the codeEditor shell: http://pythoncard.sourceforge.net/shell.html Note that you generally wouldn't run complete programs within the shell, instead you would be editing them with the codeEditor and then typing Command-R (run) or Command-Shift-R (run with interpreter). Assuming you run the codeEditor from the Finder using Python Launcher you'll probably want to keep the Console, which is in Applications- >Utilities->Console open to see additional error messages that otherwise would show up in the Terminal. I hope that answers your questions. ka ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Pythoncard-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pythoncard-users