Help! Can't get program to run.

2009-05-01 Thread seanm . py
I think this is maybe the most basic problem possible, but I can't get
even the most basic Python to run on OS X using Terminal or IDLE. I
used the IDLE editor to create a file with one line of code

print 'text string'

and I saved the file as module1.py. When using terminal I entered
"python" to load the interpreter or whatever and then tried

python module1.py

but I got an error message. I've tried using the file path instead of
module1.py and that didn't work either. I've tried moving the file to
different places, my desktop, hard drive, etc., and none of that
worked either. In IDLE I tried similar things and only got error
messages there too.

Needless to say this is a frustrating start to learning this langauge.
I'd really appreciate any help getting this to work, so I can move on
the actual language. Thanks so much.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Help! Can't get program to run.

2009-05-02 Thread seanm . py
On May 1, 6:10 pm, Ned Deily  wrote:
> In article <7618rjf1a3t8...@mid.uni-berlin.de>,
>  "Diez B. Roggisch"  wrote:
>
>
>
> > seanm...@gmail.com schrieb:
> > > I think this is maybe the most basic problem possible, but I can't get
> > > even the most basic Python to run on OS X using Terminal or IDLE. I
> > > used the IDLE editor to create a file with one line of code
>
> > > print 'text string'
>
> > > and I saved the file as module1.py. When using terminal I entered
> > > "python" to load the interpreter or whatever and then tried
>
> > > python module1.py
>
> > > but I got an error message. I've tried using the file path instead of
> > > module1.py and that didn't work either. I've tried moving the file to
> > > different places, my desktop, hard drive, etc., and none of that
> > > worked either. In IDLE I tried similar things and only got error
> > > messages there too.
>
> > > Needless to say this is a frustrating start to learning this langauge.
> > > I'd really appreciate any help getting this to work, so I can move on
> > > the actual language. Thanks so much.
>
> > It would have helped if you had given us the *actual* error-message.
> >  From what little information you give, it appears as if you do
> > something very basic wrong - instead of doing
> > $ python
> >  >>> python mymodule.py
> > (where $ is the shell/terminal and >>> the python-prompt)
> > you either do
> > $ python
> >  >>> print "hello"
> > or
> > $ python mymodule.py
> > to execute mymodule directly.
>
> And from within OS X IDLE itself, if you create or open the file
> mymodule.py, it will be in a separate window and, as long as that window
> is selected, you can run the file directly within IDLE by selecting "Run
> Module" from the "Run" menu.   So, no need to use the Terminal if you
> don't want to.
>
> --
>  Ned Deily,
>  n...@acm.org

Thank you for both for the help. I still cannot get the program to run
though. Below I've copied my commands and the error messages for you
(in IDLE then Terminal):

IDLE 2.6.2
>>> python module1.py
SyntaxError: invalid syntax

and

sean-marimpietris-computer:~ seanmarimpietri$ python
Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> python module1.py
  File "", line 1
python module1.py
 ^
SyntaxError: invalid syntax



Again, any help would be appreciated. Thanks.
--
http://mail.python.org/mailman/listinfo/python-list


Most Basic Question Ever - please help

2009-05-02 Thread seanm . py
I am going to try posting here again with more detail to see if I can
finally get my first program to work.

I am working on a MacBook Pro with OS X 10.4.11. I opened a new window
in IDLE to create a file. The file had only one line of code and was
saved as module1.py. I saved it to Macintosh HD. The one line of code
in the file is copied below:

print 'Hello module world!'

I closed the file and tried to run it in IDLE and Terminal, but I have
had no success. I'll paste my commands and the error messages below
(for IDLE, then Terminal). Any help would be very much appreciated. I
feel like the marathon just started and I've fallen flat on my face.
Thanks.

IDLE 2.6.2
>>> python module1.py
SyntaxError: invalid syntax


sean-m-computer:~ seanm$ python
Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> python module1.py
  File "", line 1
python module1.py
 ^
SyntaxError: invalid syntax




--
http://mail.python.org/mailman/listinfo/python-list


Re: Help! Can't get program to run.

2009-05-02 Thread seanm . py
On May 2, 4:30 pm, Arnaud Delobelle  wrote:
> seanm...@gmail.com writes:
> > sean-marimpietris-computer:~ seanmarimpietri$ python
> > Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
> > [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
>  python module1.py
> >   File "", line 1
> >     python module1.py
> >                  ^
> > SyntaxError: invalid syntax
>
> > Again, any help would be appreciated. Thanks.
>
> From Terminal.app, this should work:
>
> sean-marimpietris-computer:~ seanmarimpietri$ python module1.py
>
> Assuming that your module1.py file is in /Users/seanmarimpietri/
>
> --
> Arnaud

Awesome. Thank you, Arnaud. I moved the file to that folder, and I got
it to work in Terminal. However, I still can't get it to run using
IDLE. Any idea why that might be? Thanks again. -Sean
--
http://mail.python.org/mailman/listinfo/python-list


Re: Help! Can't get program to run.

2009-05-02 Thread seanm . py
On May 2, 5:30 pm, Ned Deily  wrote:
> In article
> <8f6634a2-c977-430a-b9f2-90ef9356d...@x6g2000vbg.googlegroups.com>,
>
>  seanm...@gmail.com wrote:
> > Thank you for both for the help. I still cannot get the program to run
> > though. Below I've copied my commands and the error messages for you
> > (in IDLE then Terminal):
>
> > IDLE 2.6.2
> > >>> python module1.py
> > SyntaxError: invalid syntax
>
> The default IDLE window is a python shell window.  That is, you are
> already "inside" the python interpreter, the same as if you typed just
> "python", with no file name, in the Terminal window.  You can use that
> to execute python statements and introspect objects, among other things.  
> Try it.
>
> But, back in IDLE, ignore that window for the moment and use the Open
> command in the File Menu to select and open your file module1.py from
> whatever directory it is in.  A new window should open with the contents
> of that file.  With that window selected (click on it, if necessary),
> there should be a "Run" option in the Menu bar and under it will be a
> "Run Script" option that will cause the script to run and the output to
> appear in the shell window.  You can then explore the other options
> available in IDLE for debugging, etc.
>
> --
>  Ned Deily,
>  n...@acm.org

Awesome. I think that clears it up (at least enough for now). Thank
you both very much.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Most Basic Question Ever - please help

2009-05-02 Thread seanm . py
On May 2, 6:25 pm, John Machin  wrote:
> On May 3, 7:46 am, Dave Angel  wrote:
>
>
>
> > seanm...@gmail.com wrote:
> > > I am going to try posting here again with more detail to see if I can
> > > finally get my first program to work.
>
> > > I am working on a MacBook Pro with OS X 10.4.11. I opened a new window
> > > in IDLE to create a file. The file had only one line of code and was
> > > saved as module1.py. I saved it to Macintosh HD. The one line of code
> > > in the file is copied below:
>
> > > print 'Hello module world!'
>
> > > I closed the file and tried to run it in IDLE and Terminal, but I have
> > > had no success. I'll paste my commands and the error messages below
> > > (for IDLE, then Terminal). Any help would be very much appreciated. I
> > > feel like the marathon just started and I've fallen flat on my face.
> > > Thanks.
>
> > > IDLE 2.6.2
>
> >  python module1.py
>
> > > SyntaxError: invalid syntax
>
> > > sean-m-computer:~ seanm$ python
> > > Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
> > > [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
> > > Type "help", "copyright", "credits" or "license" for more information.
>
> >  python module1.py
>
> > >   File "", line 1
> > >     python module1.py
> > >                  ^
> > > SyntaxError: invalid syntax
>
> > In both cases, you're already running python.  Why would you expect to
> > have to run python inside python?
>
> > Once you're at a python prompt (in either of your cases), you use the
> > command "import" to load a module.  And you do not put the ".py"
> > extension on the parameter.  Specifically, it should look like this, and
> > very similar for IDLE.
>
> > M:\Programming\Python\sources\temp>c:\ProgFiles\Python26\python.exe
> > Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
> > (Intel)] on
> > win32
> > Type "help", "copyright", "credits" or "license" for more information.
> >  >>> import module1
> > Hello module world!
> >  >>>
>
> Dave, importing modules which have side effects like printing is NOT a
> good habit to which a beginner should be introduced. He needs to know
> how to run a script.
>
> Sean, in Terminal, instead of typing
>     python
> type
>     python module1.py
>
> and I suggest that you give your script (not module) a more meaningful
> name.
>
> HTH,
> John

Great. Thank you both very much. I appreciate the help.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Most Basic Question Ever - please help

2009-05-04 Thread seanm . py
On May 3, 12:22 am, CM  wrote:
> On May 2, 4:36 pm, seanm...@gmail.com wrote:
>
>
>
> > I am going to try posting here again with more detail to see if I can
> > finally get my first program to work.
>
> > I am working on a MacBook Pro with OS X 10.4.11. I opened a new window
> > in IDLE to create a file. The file had only one line of code and was
> > saved as module1.py. I saved it to Macintosh HD. The one line of code
> > in the file is copied below:
>
> > print 'Hello module world!'
>
> > I closed the file and tried to run it in IDLE and Terminal, but I have
> > had no success. I'll paste my commands and the error messages below
> > (for IDLE, then Terminal). Any help would be very much appreciated. I
> > feel like the marathon just started and I've fallen flat on my face.
> > Thanks.
>
> > IDLE 2.6.2>>> python module1.py
>
> > SyntaxError: invalid syntax
>
> > sean-m-computer:~ seanm$ python
> > Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
> > [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.>>> 
> > python module1.py
>
> >   File "", line 1
> >     python module1.py
> >                  ^
> > SyntaxError: invalid syntax
>
> Sean, also, keep in mind you can use IDLE to run
> your scripts.  After you have saved a script/program,
> there is an option for Run in the menu, and then under
> that, Run Module.  The output of the script will be
> sent to IDLE window indicated as the Python shell.
> You can also just test code directly from within
> that shell, though for multi-line programs, it is
> easier within the composing window.
>
> I suggest you sign up for the Python tutor 
> list:http://mail.python.org/mailman/listinfo/tutor
>
> And you can search through their big archive of
> questions and answers here:http://www.nabble.com/Python---tutor-f2981.html
>
> The tutors there are great and super-helpful, and
> will field any level of question but are particularly
> good for absolute beginners.
>
> Here is a tutorial on using 
> IDLE:http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html
>
> And here is a very good general programming tutorial online
> book, focusing on Python:http://www.freenetpages.co.uk/hp/alan.gauld/
>
> Good luck!
> Che

Thanks Che! The explaination and links are much appreciated. -Sean
--
http://mail.python.org/mailman/listinfo/python-list


4 hundred quadrillonth?

2009-05-21 Thread seanm . py
The explaination in my introductory Python book is not very
satisfying, and I am hoping someone can explain the following to me:

>>> 4 / 5.0
0.80004

4 / 5.0 is 0.8. No more, no less. So what's up with that 4 at the end.
It bothers me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 4 hundred quadrillonth?

2009-05-21 Thread seanm . py
On May 21, 5:36 pm, Christian Heimes  wrote:
> seanm...@gmail.com schrieb:
>
> > The explaination in my introductory Python book is not very
> > satisfying, and I am hoping someone can explain the following to me:
>
>  4 / 5.0
> > 0.80004
>
> > 4 / 5.0 is 0.8. No more, no less. So what's up with that 4 at the end.
> > It bothers me.
>
> Welcome to IEEE 754 floating point land! :)
>
> Christian

Thanks for the link and the welcome. Now onward to Bitwise
Operations

Sean
-- 
http://mail.python.org/mailman/listinfo/python-list