[Tutor] Running .py files in shell
Kevin Rapley
kevin at digikev.co.uk
Tue Jul 27 21:02:33 CEST 2010
Hello all, I am new to programming and have opted to learn Python as I
hear it is a good first language. I am currently going through the
exercises in 'How to Think Like a Computer Scientist: Learning with
Python 2nd Edition'.
I am running Mac OSX v10.6.4 Snow Leopard
I am running Python 2.6.1
I have a couple of questions:
1. How do I execute .py files in the command line shell? I have my files
in /Users/Kevin/python-exercises/ and am opening python in shell from
that directory
2. How do I install GASP which is referenced in chapter 4? The
instructions in this book are not complete. I have researched and found
a reference on Stack Overflow which is contributed to by GASP programmers
http://stackoverflow.com/questions/1024862/how-do-i-install-gasp-for-python-2-6-2-on-a-mac
I have MacPorts installed and have attempted to install PyObjC, which is
referenced as a prerequisite to PyGame and GASP. I get the following
error when attempting to install PyObjC:
sudo port install py-pyobjc
Password:
---> Computing dependencies for py-pyobjc
---> Fetching py-pyobjc
Error: Target org.macports.fetch returned: PyObjC 1.4 is for Mac OS X
10.4 and lower. On 10.5, use py-pyobjc2 instead.
Log for py-pyobjc is at:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py-pyobjc/main.log
Error: Status 1 encountered during processing.
It says to use py-objc2 instead, so I do so and get this error:
sudo port install py-pyobjc2
Error: Target org.macports.activate returned: Image error:
/opt/local/lib/python2.4/site-packages/modulegraph/__init__.py is being
used by the active py-modulegraph port. Please deactivate this port
first, or use 'port -f activate py-modulegraph-devel' to force the
activation.
Log for py-modulegraph-devel is at:
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_python_py-modulegraph-devel/main.log
Error: The following dependencies failed to build: py-py2app-devel
py-modulegraph-devel
Error: Status 1 encountered during processing.
To report a bug, see <http://guide.macports.org/#project.tickets>
I attempted to correct the issue by entering the following:
port -f activate py-modulegraph-devel
But it returned this error:
Warning: Failed to open Portfile from registry for py-modulegraph-devel
@0.7.2_0
---> Activating py-modulegraph-devel
Error: port activate failed: sqlite error: attempt to write a readonly
database (8)
This is as far as I have got with resolving this issue so far. All help
and guidance will be greatly appreciated.
Kevin Rapley
More information about the Tutor
mailing list