Jump to content
Syntax Error Installing Dist Pkg Chapter2
5 replies to this topic
Posted 31 January 2011 - 11:22 AM
Hi, I made it all the way through HF Programming using python with no issues (:
Started on HF Python today and am stuck @ chapter 2 Build Your Distribution,
I am using OS X 10.6 with Python 3.1.3
the distribution seems to build ok even though it complains about a readme that the book doesn't discuss. then when trying the install distribution to your local copy of python it errors out w/ cant read the distutils.core and syntax error on my first line of setup.py???? it seems to be looking for distutils in... /var/mail/ could that be the problem??? that doesn't seem like where i would put a file for python3 if all the other stuff for python3 is in... /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1
any ideas and assistance would be greatly appreciated.
i named my module un_nester.py just cause it seemed to make more sense to me
but i have tried using the code directly from the head first site for the nester.py and setup.py files, and no change. any one know where disutils.core should be on a Mac 10.6???
this is what I get from running:
python3 setup.py sdist
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)
warning: sdist: standard file not found: should have one of README, README.txt
writing manifest file 'MANIFEST'
making hard links in un_nester-1.0.0...
hard linking setup.py -> un_nester-1.0.0
hard linking un_nester.py -> un_nester-1.0.0
Creating tar archive
removing 'un_nester-1.0.0' (and everything under it)
this is what I get from running:
from: can't read /var/mail/distutils.core
./setup.py: line 3: syntax error near unexpected token `newline'
./setup.py: line 3: `setup( '
this is my setup.py:
from distutils.core import setup
name = 'un_nester',
version = '1.0.0',
py_modules = ['un_nester'],
author = 'myappleguy',
author_email = 'email@example.com',
url = 'http://www.myitpro.info'
description = 'A simple printer of nested lists',
this is my un_nester.py:
##Welcome to the "un_nester.py" module
##basicly this is a small recursive function
##to un-nest a list with several layers of nesting,
##[ie. a list within a list within a list up to X1000]
##then print each item to the prompt on its own line
##"the_list" option is the name of the nested list you
##would like to un-nest and print to screen.
##any questions / commments / bugs ?!?!?!
##email me >>> firstname.lastname@example.org
for each in the_list:
if isinstance(each, list):
Posted 31 January 2011 - 12:33 PM
ok did some reading on the python website and found were it talks about using "easy_install" instead of "python3 setup.py install"
i believe it worked!
this is what I got @ the prompt:
sudo easy_install .
Running setup.py -q bdist_egg --dist-dir /Users/toddpickell/Documents/Scripts/Python/un_nester/egg-dist-tmp-13pcLb
zip_safe flag not set; analyzing archive contents...
Adding un-nester 1.0.0 to easy-install.pth file
Processing dependencies for un-nester==1.0.0
Finished processing dependencies for un-nester==1.0.0
Posted 31 January 2011 - 12:44 PM
that toadally worked!
not sure still why it didn't work with the standard "setup.py install"
but as long as i can continue through the book and keep learning about python.
Posted 31 January 2011 - 01:00 PM
ok easy_install works to install packages but....
how do i upload them without...
& setup.py sdist upload ????
i get exact same errors that i got from...
Posted 31 January 2011 - 01:11 PM
it works now...
apparently I have 2 installs of python on my mac.
Python 2.6.1 & Python 3.1.3
i guess i need to make sure i am using python3 and not just python.
i was able to:
python3 ./setup.py register &
python3 ./setup.py upload
just fine (:
I'm coming over from Java and until I read HF programming using python
i didn't even know i had python on my mac.
maybe i need to un- .jar my way of thinking.... lol
very good books btw.
good job Paul.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users