[Pythonmac-SIG] My first Python Program
Hello All, I'm a complete novice to Python and I just created my first program for an assignment in a Python class that I'm taking at the local community college. The instructor didn't give us a book so, I'm trying to figure out one important item. How to run my program. I know this is so basic for everyone but I just started this class and this is my first exposure ever to this type of environment. I have an iMac, running python V2.6.1 My program is located in this directory: File location: /Users/parkjv1/Birth_Month.py When I open the terminal: I'm presented with this info: cpe-66-75-97-27: ~parkjv1$ Is this my /users/parkjv1 directory? When I type my file name Birth_Month.py I get an error indicating that command not found. So, where do I call my program so that it will run? Thanks, John ___ Pythonmac-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG On 1/21/11 8:40 AM, "Bill Janssen" wrote: > Charles Hartman wrote: > >> it would seem to be short-sighted for anyone interested in Python on >> the Mac not to support py2app as fully as possible. > > You calling me short-sighted, Charles? > > That's OK -- it's true, you know; I've been wearing thick glasses since > I was a kid :-). But I don't know that it has much to do with py2app. > I think py2app is great, and I believe I even used it, once -- wanted to > make a Preference Pane with Python, and couldn't figure out how to do it > otherwise. > > But in general I've not needed it -- I just use Xcode and the system > Python, and there's no need to bundle another Python with that approach. > I should probably figure out how to use py2app with that approach, > though; it might be more bullet-proof. > > Bill > ___ > Pythonmac-SIG maillist - [email protected] > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] My first Python Program
Hi John, to run a python (.py) file, from the shell type : python /path/to/your/file.py (just drug'n'drop the file inside the terminal shell) to know the directory where your shell is running type the command : > pwd it will show you the path. to go inside the directory type : > cd /path/to/the/directory this [1] is a simple list of the bash commands in osx : [1] http://ss64.com/osx/ and this [2] the standard python tutorial : [2] http://docs.python.org/tutorial/ you can also try to buy a book about python that will help you to get started there are a large number of book dedicated to python programming. Il giorno 22/gen/2011, alle ore 15.56, John Parker ha scritto: > Hello All, > > I'm a complete novice to Python and I just created my first program for an > assignment in a Python class that I'm taking at the local community college. > > The instructor didn't give us a book so, I'm trying to figure out one > important item. > > How to run my program. I know this is so basic for everyone but I just > started this class and this is my first exposure ever to this type of > environment. > > I have an iMac, running python V2.6.1 > > My program is located in this directory: > > File location: /Users/parkjv1/Birth_Month.py > > When I open the terminal: > > I'm presented with this info: cpe-66-75-97-27: ~parkjv1$ > > Is this my /users/parkjv1 directory? > > When I type my file name Birth_Month.py I get an error indicating that > command not found. > > So, where do I call my program so that it will run? > > Thanks, > > John > > > ___ > Pythonmac-SIG maillist - [email protected] > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > > > > On 1/21/11 8:40 AM, "Bill Janssen" wrote: > >> Charles Hartman wrote: >> >>> it would seem to be short-sighted for anyone interested in Python on >>> the Mac not to support py2app as fully as possible. >> >> You calling me short-sighted, Charles? >> >> That's OK -- it's true, you know; I've been wearing thick glasses since >> I was a kid :-). But I don't know that it has much to do with py2app. >> I think py2app is great, and I believe I even used it, once -- wanted to >> make a Preference Pane with Python, and couldn't figure out how to do it >> otherwise. >> >> But in general I've not needed it -- I just use Xcode and the system >> Python, and there's no need to bundle another Python with that approach. >> I should probably figure out how to use py2app with that approach, >> though; it might be more bullet-proof. >> >> Bill >> ___ >> Pythonmac-SIG maillist - [email protected] >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > > > ___ > Pythonmac-SIG maillist - [email protected] > http://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG ___ Pythonmac-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
Re: [Pythonmac-SIG] My first Python Program
Thanks to all for your help. I was able to successfully run my first program all be it was very simple. I have ordered a Python for Dummies book from Amazon but it hasn't arrived yet. I think that will help initially until I get familiar with this environment. Thank you all for your information and empowering me to run my program. Happy Python Programming to All!! Aloha, John On 1/22/11 11:47 AM, "Massimo Di Stefano" wrote: > Hi John, > > > to run a python (.py) file, from the shell type : > > > python /path/to/your/file.py (just drug'n'drop the file inside the terminal > shell) > > to know the directory where your shell is running type the command : > >> pwd > > it will show you the path. > > to go inside the directory type : > >> cd /path/to/the/directory > > this [1] is a simple list of the bash commands in osx : > > [1] http://ss64.com/osx/ > > and this [2] the standard python tutorial : > > [2] http://docs.python.org/tutorial/ > > you can also try to buy a book about python that will help you to get started > there are a large number of book dedicated to python programming. > > > Il giorno 22/gen/2011, alle ore 15.56, John Parker ha scritto: > >> Hello All, >> >> I'm a complete novice to Python and I just created my first program for an >> assignment in a Python class that I'm taking at the local community college. >> >> The instructor didn't give us a book so, I'm trying to figure out one >> important item. >> >> How to run my program. I know this is so basic for everyone but I just >> started this class and this is my first exposure ever to this type of >> environment. >> >> I have an iMac, running python V2.6.1 >> >> My program is located in this directory: >> >> File location: /Users/parkjv1/Birth_Month.py >> >> When I open the terminal: >> >> I'm presented with this info: cpe-66-75-97-27: ~parkjv1$ >> >> Is this my /users/parkjv1 directory? >> >> When I type my file name Birth_Month.py I get an error indicating that >> command not found. >> >> So, where do I call my program so that it will run? >> >> Thanks, >> >> John >> >> >> ___ >> Pythonmac-SIG maillist - [email protected] >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG >> >> >> >> On 1/21/11 8:40 AM, "Bill Janssen" wrote: >> >>> Charles Hartman wrote: >>> it would seem to be short-sighted for anyone interested in Python on the Mac not to support py2app as fully as possible. >>> >>> You calling me short-sighted, Charles? >>> >>> That's OK -- it's true, you know; I've been wearing thick glasses since >>> I was a kid :-). But I don't know that it has much to do with py2app. >>> I think py2app is great, and I believe I even used it, once -- wanted to >>> make a Preference Pane with Python, and couldn't figure out how to do it >>> otherwise. >>> >>> But in general I've not needed it -- I just use Xcode and the system >>> Python, and there's no need to bundle another Python with that approach. >>> I should probably figure out how to use py2app with that approach, >>> though; it might be more bullet-proof. >>> >>> Bill >>> ___ >>> Pythonmac-SIG maillist - [email protected] >>> http://mail.python.org/mailman/listinfo/pythonmac-sig >>> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG >> >> >> ___ >> Pythonmac-SIG maillist - [email protected] >> http://mail.python.org/mailman/listinfo/pythonmac-sig >> unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG > ___ Pythonmac-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
[Pythonmac-SIG] py2app -- ouch!
Hello all and thanks for listening!
I have scanned the archive and the web for current practices in packaging an
Mac Python app with
py2app. I have been successful before (i.e circa python 2.4 and Mac OS X
10.4). I am now working
on under 10.6.6 and python 2.6.6.18 as shipped with the OS. I am using PyQt
4.8.2. as an i86_64
app. It runs fine from the terminal as
python Teatro.py
I used
easy_install-2.6 -U py2app which retrieved and installed py2app 0.5.2.
I used a couple of variation of what seem to be standard procedure to create the
app including
/Library/Frameworks/Python.framework/Versions/2.6/bin/py2applet
--make-setup --alias --argv-emulation Teatro.py
followed by:
python setup.py py2app
python setup.py py2app -A
as well as
/Library/Frameworks/Python.framework/Versions/2.6/bin/py2applet
Teatro.py
the setup.py file looks like this:
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['Teatro.py']
DATA_FILES = []
OPTIONS = {'alias': True, 'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
when I try to run the app (Teatro.app or dist/Teatro depending on which
procedure I used
to build it) i get this:
<>
The console reports:
1/22/11 8:44:43 PM com.apple.launchd.peruser.501[420]
([0x0-0x51051].org.pythonmac.unspecified.Teatro[899]) Exited with exit code: 255
1/22/11 9:16:30 PM [0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]
Traceback (most recent call last):
1/22/11 9:16:30 PM [0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]
File
"/Users/mef/Development/-Applications-/Teatro/Teatro.app/Contents/Resources/__boot__.py",
line 103, in
1/22/11 9:16:30 PM [0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]
_argv_emulation()
1/22/11 9:16:30 PM [0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]
File
"/Users/mef/Development/-Applications-/Teatro/Teatro.app/Contents/Resources/__boot__.py",
line 101, in _argv_emulation
1/22/11 9:16:30 PM [0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]
_get_argvemulator().mainloop()
1/22/11 9:16:30 PM [0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]
File
"/Users/mef/Development/-Applications-/Teatro/Teatro.app/Contents/Resources/__boot__.py",
line 40, in mainloop
1/22/11 9:16:30 PM [0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]
stoptime = Evt.TickCount() + timeout
1/22/11 9:16:30 PM [0x0-0x5e05e].org.pythonmac.unspecified.Teatro[982]
AttributeError: 'module' object has no attribute 'TickCount'
1/22/11 9:16:30 PM Teatro[982] Teatro Error
When I build using
python setup.py py2app Teatro.py without alias and argv_emulation in
the setup.py
/usr/bin/strip: for architecture x86_64 object:
/Users/mef/Development/-Applications-/Teatro/dist/Teatro.app/Contents/Frameworks/Python.framework/Versions/2.6/Python
malformed object (load command 3 cmdsize not a multiple of 8)
stripping saved 333408 bytes (8961700 / 9295108)
as the last line of the build and in the build directory i get
dist.macosx-10.5-intel/
but away get the same result as above when I try to run the app
I am sure it is obvious what is wrong but I have reach a dead end.
Any help would be appreciated
Michael Ferraro
Assoc. Prof.
Art Dept.
Lehman College CUNY
Bronx, NY
___
Pythonmac-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG
