help - python can't find file

2007-05-21 Thread enquiring mind
-learning python with limited knowledge of linux.
-get error msg 21 "file or directory does not exist"
-running Suse linux 10.
-haven't had a problem before
- rebooted several times.
-python opened in shell/terminal program Konsole window like this
[EMAIL PROTECTED] - shell - Konsole
Sessions View Bookmark Settings Help

-first line in window gives me a linux prompt:
user1#linux:~>

- whereupon I type python and get >>> a command line I think it is  
called or type python pyfilename.py and it runs/interprets/opens
  the file on screen 

- but now I get a error message 21 saying file or directory doesn't
exist.

- my py files are created with editor gedit
- clicking on any py file and linux asks me to open it with what
  program and I choose utilities/editdors/gedit and it works.

-all my py files contain the following lines at the beginning 
#! /usr/bin/env python
# -*- coding: utf-8 -*-

# filename: blankpy.py  (for example of a file name)


- my linux file structure is as follows shown under Konqueror window:
rootfolder
bin 
boot
dev
etc
home
 user1
 bin
 desktop
 documents
lib
media 
 dvdrecorder
 floppy 

- (for example, and continues on, of course) 


- none of my python books or linux books show that I can type 
  python /dev/sda/ blankpy.py and get python to open it like in 
  windows98 or dos python A:\blankpy.py  

embarrassed and frustrated
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help - python can't find file

2007-05-22 Thread enquiring mind
darren, 

thanks for your explanation.  I copied my paths and listed them in my 
code file
#! /bin/user1/ python

and python finds the file and interprets it so that will keep me going
until my buddy returns to the city to explain my errors.  It appears
that my problem arose from taking lesson code out of text books and
copying the pathing that is I guess slightly different than mine. 

Thanks ever so much.
tk

darren kirby wrote:




> 
> quoth the enquiring mind:
> 
> > - but now I get a error message 21 saying file or directory doesn't
> > exist.
> 
> You must be in the same directory (in konsole) as the python script for this
> to work, else enter the relative path to the file:
> 
> Assuming you are in your home directory (this is where a new konsole will
> start you), and the py scripts are in a directory 'pythondir':
> 
> $ cd pythondir
> $ python myscript.py
> 
> or:
> 
> $ python pythondir/myscript.py
> 
> You could also chmod the script to be executable and run it as a regular
> command ...however... I don't mean this to sound like RTFM but I do think
> that you could use some reading on Linux CLI usage. You say you have some
> Linux books?
> 
> I say this as my reading of your message indicates your problems lie with
> misunderstanding the shell/paths etc, not with Python itself...
> 
> -d
> --
> darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
> "...the number of UNIX installations has grown to 10, with more expected..."
> - Dennis Ritchie and Ken Thompson, June 1972
-- 
http://mail.python.org/mailman/listinfo/python-list


Pygame Q (linux) beginner

2007-03-31 Thread enquiring mind
Running 2.4.1 Python (learning)
Running SUSE Linux 10

Am learning from a new books that mostly deals with windows python and
Pygames called "Game Programming" by Randy Harris (2007)  His books
references Python 2.4.2 and Pygame 1.7.1 with these comments:  

"If you are using a Linux machine, you probably won't have the simple
installer that came with the windows version.  Follow the instructions
at http://pygame.org/install.  You may have to run a couple of scripts
to make everything work, but just follow the directions and you will be
fine."  

Could anybody suggest or make a helpful comment in view of what
information I have supplied.  At Chapter 5 is where the Pygame module is
introduced so I have a little time before I have to figure out what I
have to download and install.  

Thanks very much in advance for any direction. 

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


Re: Pygame Q (linux) beginner

2007-04-01 Thread enquiring mind
Gabriel Genellina wrote:
> 
> En Sat, 31 Mar 2007 23:37:16 -0300, enquiring mind <"enquiring
> mind"@braindead.com> escribió:
> 
> > Running 2.4.1 Python (learning)
> > Running SUSE Linux 10
> >
> > Am learning from a new books that mostly deals with windows python and
> > Pygames called "Game Programming" by Randy Harris (2007)  His books
> > references Python 2.4.2 and Pygame 1.7.1 with these comments:
> >
> > "If you are using a Linux machine, you probably won't have the simple
> > installer that came with the windows version.  Follow the instructions
> > at http://pygame.org/install.  You may have to run a couple of scripts
> > to make everything work, but just follow the directions and you will be
> > fine."
> >
> > Could anybody suggest or make a helpful comment in view of what
> > information I have supplied.  At Chapter 5 is where the Pygame module is
> > introduced so I have a little time before I have to figure out what I
> > have to download and install.
> 
> First: read that page.
> I don't use SUSE myself, but the first hit on Google for "pygame SUSE"
> goes into the Novell site, and  SUSE 10.1 appears to include pygame
> 1.7.1release14 (or at least, you should be able to download and install
> the RPM from Novell)
> 
> --
> Gabriel Genellina
Thanks, Gabriel.  I only googled pygame and not SUSE.  The next post
says it is
already included so I will ask my programmer buddy to help me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pygame Q (linux) beginner

2007-04-01 Thread enquiring mind
hlubenow wrote:
> 
> enquiring mind wrote:
> 
> > Running 2.4.1 Python (learning)
> > Running SUSE Linux 10
> >
> > At Chapter 5 is where the Pygame module is
> > introduced so I have a little time before I have to figure out what I
> > have to download and install.
> 
> Are you asking for advice how to install pygame on SuSE 10 ?
> Well, that's easy:
> 
> python-pygamerpm comes with SuSE.
> Just install it with YaST2; the additional packages it
> needs (like libSDL) are installed automatically then.
> So you don't have to download any packages from www.pygame.org.
> 
> Another hint: If sound in pygame doesn't work, try
> 
> export SDL_AUDIODRIVER=alsa
> 
> right before starting your script.
> 
> H.

Thank you very much.  A buddy installed SUSE 10 in Dec. for me so I
shall ask him to look for rpm which I understand from your post includes
pygame.  You have no idea how much I appreciate your information.
-- 
http://mail.python.org/mailman/listinfo/python-list


beginner - py unicode Q

2007-04-07 Thread enquiring mind
I read the posting by Rehceb Rotkiv and response but don't know if it
relates to my problem in any way. 

I only want to write German to the screen/console for little German
programs/exercises in python.  No file w/r will be used.

#! /usr/bin/env python
# -*- coding: utf-8 -*- 
# Filename:  7P07png.py
# SUSE Linux 10 Python 2.4.1 gedit 2.12.0

print 'Ich zähle zwölf weiß Hüte.'
print 'Wollen Sie'
verbs = ( 'kömmen' , 'essen' , 'trinken' )
print verbs[:3] 

print ' program ends '

console display is: Ich zähle zwölf weiß Hüte.
Wollen Sie
('k\xc3\xb6mmen', 'essen', 'trinken')
program ends

The first 2 print statements in German print perfectly to screen/console
but not the 3rd.  

I ran it with these lines below from Rehceb Rotkiv's code but it did not
fix problem. 
import sys 
import codecs

I also tried unicode string u'kömmen', but it did not fix problem. 
Any help/direction would be appreciated.  Thanks in advance. 
 
I found this reference section but I am not sure it applies or how to
use it to solve my problem.: 

This built in setdefaultencoding(name) sets the default codec used to
encode and decode Unicode and string objects (normally ascii)and is
meant to be called only from sitecustomize.py at program startup; the
site module them removes this attribute from sys.  You can call
reload(sys) to make this attriute available again but this is not a good
programming practice. 

I just thought of this.  I suppose because this is py source code, it
should not be German but a reference/key to u'strings' to print German
text to the screen?

The ultimate console output I seek, of course, using a while or for loop
and/or random access for second verb, for example:   
Wollen Sie kömmen?
Wollen Sie essen?
Wollen Sie trinken?
-- 
http://mail.python.org/mailman/listinfo/python-list


beginner - py unicode Q error

2007-04-07 Thread enquiring mind
Sorry, I miscopied this line of code: print verbs[0:2] and not 
as posted print verbs[:3]
-- 
http://mail.python.org/mailman/listinfo/python-list