Jump to content


Photo

Chapter 2


  • Please log in to reply
12 replies to this topic

#1 MissKB

MissKB

    New Member

  • Members
  • Pip
  • 1 posts

Posted 27 February 2011 - 08:11 AM

Hope someone can help me, im on chapter 2 trying to build the distribution file.

Im using Windows and in the Python (command line) i type what the book says, and as im using windows i type the line for that OS that they say to use, but its not working at all.

The book says to open a terminal within the nester folder, im not sure what that means "within the nester folder".

I type (like the book says for Windows users):

c:\Python31\python.exe setup.py sdist

and it comes up with this:

c:\Python31\python.exe setup.py sdist
File "<stdin>", line 1
c:\Python31\python.exe setup.py sdist
^
SyntaxError: invalid syntax

no matter what i try nothing is working. The book has a $ sign as well but im assuming thats for Mac users as it didnt like it on windows so i took it out and it just moves onto the next thing it doesnt like :S ive even tried getting rid of 'c:\' but then it still doesnt work :S

Hope someone can help me please with this as i really want to continue learning Python!

Thanks in advance smile.gif

#2 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 28 February 2011 - 08:40 AM

I don't use Windows on a regular basis... but will try to have a go at this over the next few days (I have Windows 7 lying around somewhere). Have any of the book's other readers using Windows had a similar problem or got this to work? Let's hear from you...

--Paul.

#3 dilbertBear

dilbertBear

    Active Member

  • Members
  • PipPip
  • 13 posts

Posted 28 February 2011 - 09:21 PM

QUOTE (MissKB @ Feb 27 2011, 08:11 AM) <{POST_SNAPBACK}>
Hope someone can help me, im on chapter 2 trying to build the distribution file.

Im using Windows and in the Python (command line) i type what the book says, and as im using windows i type the line for that OS that they say to use, but its not working at all.

The book says to open a terminal within the nester folder, im not sure what that means "within the nester folder".


Let's start with this part first. By "terminal window", Paul means a command line window, also called a DOS window.

To start a command line window:
In Win7, in the Start Menu, at the bottom is a box with the text "Search programs and files". Type in "cmd" without the quotes, then press Enter.
In WinXP, in the Start Menu, select "Run...". In the box labeled Open:, type in "cmd" without the quotes. Then press Enter.

After that, you should be able to cd to your nester directory.

I was able to build my distribution using Python3.2 64bit on Win7.

#4 djpython

djpython

    Active Member

  • Members
  • PipPip
  • 14 posts

Posted 16 March 2011 - 09:30 AM

I am having similar problems.
But also my posts dont seem to show.
If you reply to me or post showing you can see me, I will delve further.

I M conundrumized

#5 djpython

djpython

    Active Member

  • Members
  • PipPip
  • 14 posts

Posted 16 March 2011 - 10:31 AM

OK. Im calling off the dogs.
Must be a day or so delay in posting ability empowerment, but I can obviously post now.
Thankyou for your attention. I

My original problem is that I cant follow Chapter 2 instructions on registering in the command window. I keep getting an sytax error.

But the reply from the interpreter was identical, just with a different function name.

I am thinking we are in the wrong environment: Either we havent installed something we need to the correct environment; or we are at the wrong prompt.

My issue was with the command c:\Python32\python.exe setup.py register

I did a search of Python32 for setup and got nothing except from inside my own module. I searched register and got a .pyc in pycache and I got a register.py from \distutils\command which sounds right.

Where do I go now, buds.

Thanks, dj

#6 dilbertBear

dilbertBear

    Active Member

  • Members
  • PipPip
  • 13 posts

Posted 16 March 2011 - 09:38 PM

dj,

What operating system are you using?
If you are seeing the same messages as MissKB, you are using the wrong command line. Follow my instructions to get to the right command line interface.

#7 grazie

grazie

    New Member

  • Members
  • Pip
  • 1 posts

Posted 18 March 2011 - 11:33 AM

nevermind...didn't work properly

Edited by grazie, 18 March 2011 - 11:36 AM.


#8 djpython

djpython

    Active Member

  • Members
  • PipPip
  • 14 posts

Posted 23 March 2011 - 09:47 AM

Capture0005sent to Dilbert bear.PNG Capture0005sent to Dilbert bear.PNG

dj,

What operating system are you using?
If you are seeing the same messages as MissKB, you are using the wrong command line. Follow my instructions to get to the right command line interface.


THANKS 4 ur reply,

i m using win 7 home 64.
in start menu dialog box i typed cmd which resulted in a control labelled cmd.exe which when clicked produced
c:\Windows\system32\cmd.exe wdw on a dark background

with the prompt c:\users\tm2 admin>

whereupon I typed c:\Python32\python.exe setup.py register
and got the reply--
cant open setup.py no such file or directory
I also tried this in the root directory and in the c:\Python32 directory with the same results

a search for setup reveals one copy inside the module I am trying to register and upload- the nester folder from the book.

I have been stuck on this point for at least a week. Please help as a week is a long time to lose at the beginning of Chapter 2.

Thanks!
Anyone?

#9 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 23 March 2011 - 10:45 AM

You need to make sure you are entering the command from the book inside the same directory/folder that contains the setup.py file. If you don't, Python cannot find it (which I think is the error you are getting). So, open up an CMD.EXE prompt in Windows, then CD to the location that you have your module. For instance, if your code is in C:\users\tm2\nester you need to:

cd \users\tm2\nester

then run the setup-py command-line:

c:\Python32\python.exe setup.py register

Hope this helps (and works).

--Paul.

#10 djpython

djpython

    Active Member

  • Members
  • PipPip
  • 14 posts

Posted 23 March 2011 - 08:07 PM

You need to make sure you are entering the command from the book inside the same directory/folder that contains the setup.py file. If you don't, Python cannot find it (which I think is the error you are getting). So, open up an CMD.EXE prompt in Windows, then CD to the location that you have your module. For instance, if your code is in C:\users\tm2\nester you need to:

cd \users\tm2\nester

then run the setup-py command-line:

c:\Python32\python.exe setup.py register

Hope this helps (and works).

--Paul.



Paul,
So glad to get your advice, and sooo happy it worked!

But I'm so mad I can't tell PyPI who I am!

I'm so mad I could just quit! ...but if you'll read the
screenshot, you'll see that PyPI wouldn't even let me quit!!
What kind of learning environment is this, anyway? !)

OK. PyPI run register an' she run check an' she ask me who I be n to please choose one of the following: 1-[default] thru 4. I eventually chose all 4 and some additional tries
w/ experimental formatting and PyPI just kept on prompting.

Please, can I get some help on this? I thought this looked very straight forward, but no-oh...again.

Anybody?? ---Thanks, dj

Attached Thumbnails

  • Capture0007 0006OK now obvious choices dont work to tell PyPI who I am.PNG


#11 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 24 March 2011 - 01:20 AM

I can't think what the problem might be... however, it may well have to do with your Windows internet and firewall settings. The register tool tries to communicate with the PyPI servers and if it can't it will fail (or behave strangely). If Windows is setup to block all internet traffic outside of your browser, then the register program might fail. Check that first and see if that's the issue.

--Paul.

#12 djpython

djpython

    Active Member

  • Members
  • PipPip
  • 14 posts

Posted 25 March 2011 - 06:29 PM

Thanks, Paul
I turned off all firewall sheilds, but I got the same behavior from the register tool.
I think since it "running register" and "running check" in response to my register command that PyPI was communicating with me, at least at first.
I also tried again today and no luck.
Much of the IE and firewall settings are a little advanced for me, and I am reading through how to get on freenode to find somebody who knows.
But as wonderful a nugget of code as Nester is, it is a little discouraging to go through so much at this point and advance so little in the language itself.
Does anyone have any suggestions for me? New or other threads? particular reference pages? A book?
I will see if Kenny will loan me his computer (we are on the road) and I will duplicate conditions to T/S.
Congratulations to those of you who have made it through newbieitiation!
Hope to hear from you soon.
--dj

Edited by djpython, 25 March 2011 - 06:30 PM.


#13 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 26 March 2011 - 02:07 AM

Hi DJ.

As you are having continued problems with the mechanics of Chapter 2, my advice would be to set interacting with PyPI aside for now and move onto the rest of the chapter, starting with the "No Dumb Questions" material on Page 49. You can continue working through the rest of the material in the chapter and skip over pages 60 and 65 (which deal with updating PyPI).

You can return to working with PyPI when you have grown in confidence.

Hope this helps.

--Paul.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users