[Tutor] unable to import Image module from my application

2008-09-30 Thread ShivKumar Anand

I am using Python Image library on windows and it is running well.
 
I am using RHEL E4 on another machine and when I installed 
python-imaging-1.1.6-2.el4.rf.i386.rpm, still i am not able to call the Image 
and ImagOps modules from my application on this Linux machine.
 
After that --I manually added Imaging1.1.4 folder in 
/usr/lib/Python2.4/site-packages and added entry in easy_install.pth.
After that, I am able to import the modules from python prompt, but still I am 
not able to import from my application.
 
I am not able to figure out the exact reason for this.
 
 
Kindly guiide me.
Thanks in anticipation.
 
 
Shiv
_
Search for videos of Bollywood, Hollywood, Mollywood and every other wood, only 
on Live.com 
http://www.live.com/?scope=videoform=MICOAL___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Replacing cmd.exe with custom .py application

2008-09-30 Thread A. Joseph
 Instead of going to the command line all the time, I want to create a small
customized cmd.exe of my own, how can I get the return value from
os.system() because I was thinking I can do soothing with os.system(), In
case my question is not clear,  just like an IDE that plugged in another
.exe application.



Sorry for any mistake in my question. Just help me if you can
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Tutor Archives and PC Crash

2008-09-30 Thread Wayne Watson

My Win/PC crashed yesterday and I'm not able to follow my recent posts.
I'm on another computer now. Is there an archive for the tutor list?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Archives and PC Crash

2008-09-30 Thread Danny Yoo
Yup.  See:

http://mail.python.org/pipermail/tutor/

for the archive.  There's also a searchable interface from GMANE:

http://dir.gmane.org/gmane.comp.python.tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] python: can't open file 'test.py' : [Errno 2] No such file or directory

2008-09-30 Thread Pierre Dagenais

The file test.py is in I:\Python25\MyCode,
if I enter:

  C:\Python25\MyCode\python25 test.py at the DOS prompt, everything 
works as I would expect.


However when I enter the same command from any other directory I get 
this error:


  C:\python test.py
   python: can't open file 'test.py' : [Errno 2] No such file or directory

I've set the environment variable pythonpath as
  C:\set pythonpath = C:\\Python25\\MyCode
what am I doing wrong,
Thank u for your help,
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python: can't open file 'test.py' : [Errno 2] No such file or directory

2008-09-30 Thread W W
On Tue, Sep 30, 2008 at 2:58 PM, Pierre Dagenais [EMAIL PROTECTED]wrote:

 The file test.py is in I:\Python25\MyCode,
 if I enter:

  C:\Python25\MyCode\python25 test.py at the DOS prompt, everything works
 as I would expect.

 However when I enter the same command from any other directory I get this
 error:

  C:\python test.py
   python: can't open file 'test.py' : [Errno 2] No such file or directory

 I've set the environment variable pythonpath as
  C:\set pythonpath = C:\\Python25\\MyCode


I'm not entirely sure about Windows, but my guess is that your problem is
that the pythonpath isn't what you need to set. I would venture to guess
that it's searching for test.py in your current path. If I'm correct in my
thinking, all it does when you set the python path is tells python to
execute in that directory, so if your script contains something like f =
open(myfile.txt, w) it will put it in that directory.

You may want to try this:

The path is now managed by Windows 2000 / Windows XP and not the
autoexec.bat or autoexec.nt files. To change the system environment
variables, follow the below steps.

   1. From the desktop http://www.computerhope.com/jargon/d/desktop.htm,
   right-click My Computer and click properties.
   2. In the System Properties
windowhttp://www.computerhope.com/jargon/w/window.htm,
   click on the Advanced tab http://www.computerhope.com/jargon/t/tab.htm.
   3. In the Advanced section, click the Environment Variables
buttonhttp://www.computerhope.com/jargon/p/pushbutt.htm
   .
   4. Finally, in the Environment Variables window, highlight the path
   variable in the Systems Variable section and click edit. Add or modify the
   path lines with the paths you wish the computer to access. Each different
   directory is separated with a semicolon as shown below.

   C:\Program Files;C:\Winnt;C:\Winnt\System32

from:
http://www.computerhope.com/issues/ch000549.htm

Try adding the path to your code in that way, and see if it works. HTH,
Wayne

-- 
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn't. - Primo Levi
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python: can't open file 'test.py' : [Errno 2] No such file or directory

2008-09-30 Thread Timothy Grant
On Tue, Sep 30, 2008 at 12:58 PM, Pierre Dagenais
[EMAIL PROTECTED] wrote:
 The file test.py is in I:\Python25\MyCode,
 if I enter:

  C:\Python25\MyCode\python25 test.py at the DOS prompt, everything works as
 I would expect.

 However when I enter the same command from any other directory I get this
 error:

  C:\python test.py
   python: can't open file 'test.py' : [Errno 2] No such file or directory

 I've set the environment variable pythonpath as
  C:\set pythonpath = C:\\Python25\\MyCode
 what am I doing wrong,
 Thank u for your help,
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor


You need to give the full path to your test.py file.

PYTHONPATH sets the python library search path.


-- 
Stand Fast,
tjg.  [Timothy Grant]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Text Scatter Plots?

2008-09-30 Thread Alan Gauld


Wayne Watson [EMAIL PROTECTED] wrote

Before GUIs, crude scatter plots and histograms on TTYs 
and IBM electronic typewriters were used with only the 
symbols on the keyboard. Some were pretty decent and 
effective. 


Basioc charts can be done that way but usually they are 
just produceed by print statements with no special charting 
or plotting software. The earliest plotting software that I'm 
aware of all used bitmap imaging to the dot matrix printers 
of the time



I don't really want to dabble with graphics at this point


The point of the graphics libraries like gnuplot is that they 
make it easier to produce real graphics than it is to try fancy 
printing techniques.


I don't want to get into all the finery of using GUIs. 


The plotting libraries can usually throw up a window for you.
It won't be a full GUI application just a floating window in 
screen with a graph drawn in it. Check out the screenshots.
Alternatively they can save the image to a file which you 
can display in any graopghics program or web browser 
of your choice.


However, it seems as though there ought to be some 
really simple set up to just produce a scatter plot. 
Maybe I'm overestimating the difficulty. 


One way to find out would be to try writing one yourself.
You could then make it available to the community.
Sounds like a useful project...

--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Replacing cmd.exe with custom .py application

2008-09-30 Thread Alan Gauld


A. Joseph [EMAIL PROTECTED] wrote

Instead of going to the command line all the time, I want to create 
a small

customized cmd.exe of my own,


I'm not sure that I understand what you are trying to do.
But trying to replace cmd.exe is a very very bad idea.
Lots of bits of your operatinfg system rely on cmd.exe
and bad things are likely to start happening!


how can I get the return value from
os.system()


Same as any other function:

retval = os.system('notepad.exe')


because I was thinking I can do soothing with os.system(), In
case my question is not clear,  just like an IDE that plugged in 
another

.exe application.


Sorry, that didn't clarify anything for me! :-)

Are you trying to write your own operating system shell
environment (to use instead of cmd.exe)? Are you trying to
write a Python based command shell? Or are you trying
to create your own IDE?

I'm confused.

--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Archives and PC Crash

2008-09-30 Thread Alan Gauld


Danny Yoo [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

Yup.  See:

   http://mail.python.org/pipermail/tutor/

for the archive.  There's also a searchable interface from GMANE:

   http://dir.gmane.org/gmane.comp.python.tutor



And another at ActiveState.com

http://lists.activestate.com/tutor@python.org

Alan G 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] (no subject)

2008-09-30 Thread kayla bishop

I can't figure out how to write a program where you flip a coin 100 times and 
it keeps track of how many heads and tails you flipped but it has to be random. 
Can you please help
_
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python: can't open file 'test.py' : [Errno 2] No such file or directory

2008-09-30 Thread Pierre Dagenais

W W wrote:

On Tue, Sep 30, 2008 at 2:58 PM, Pierre Dagenais [EMAIL PROTECTED]wrote:

  

The file test.py is in I:\Python25\MyCode,
if I enter:

 C:\Python25\MyCode\python25 test.py at the DOS prompt, everything works
as I would expect.

However when I enter the same command from any other directory I get this
error:

 C:\python test.py
  python: can't open file 'test.py' : [Errno 2] No such file or directory

I've set the environment variable pythonpath as
 C:\set pythonpath = C:\\Python25\\MyCode




I'm not entirely sure about Windows, but my guess is that your problem is
that the pythonpath isn't what you need to set. I would venture to guess
that it's searching for test.py in your current path. If I'm correct in my
thinking, all it does when you set the python path is tells python to
execute in that directory, so if your script contains something like f =
open(myfile.txt, w) it will put it in that directory.

You may want to try this:

The path is now managed by Windows 2000 / Windows XP and not the
autoexec.bat or autoexec.nt files. To change the system environment
variables, follow the below steps.

   1. From the desktop http://www.computerhope.com/jargon/d/desktop.htm,
   right-click My Computer and click properties.
   2. In the System Properties
windowhttp://www.computerhope.com/jargon/w/window.htm,
   click on the Advanced tab http://www.computerhope.com/jargon/t/tab.htm.
   3. In the Advanced section, click the Environment Variables
buttonhttp://www.computerhope.com/jargon/p/pushbutt.htm
   .
   4. Finally, in the Environment Variables window, highlight the path
   variable in the Systems Variable section and click edit. Add or modify the
   path lines with the paths you wish the computer to access. Each different
   directory is separated with a semicolon as shown below.

   C:\Program Files;C:\Winnt;C:\Winnt\System32

from:
http://www.computerhope.com/issues/ch000549.htm

Try adding the path to your code in that way, and see if it works. HTH,
Wayne

  

Thank you Wayne,
My path does include C:\python25;C\python25\mycode among other things. 
Is that is what you meant?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python: can't open file 'test.py' : [Errno 2] No such file or directory

2008-09-30 Thread Pierre Dagenais

Timothy Grant wrote:

On Tue, Sep 30, 2008 at 12:58 PM, Pierre Dagenais
[EMAIL PROTECTED] wrote:
  

The file test.py is in I:\Python25\MyCode,
if I enter:

 C:\Python25\MyCode\python25 test.py at the DOS prompt, everything works as
I would expect.

However when I enter the same command from any other directory I get this
error:

 C:\python test.py
  python: can't open file 'test.py' : [Errno 2] No such file or directory

I've set the environment variable pythonpath as
 C:\set pythonpath = C:\\Python25\\MyCode
what am I doing wrong,
Thank u for your help,
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor




You need to give the full path to your test.py file.

PYTHONPATH sets the python library search path.


  
Thank you Tim,

Definitively C:\python \python25\mycode\test.py does work. If you're right 
about having to give the full path, and I suspect you are, Then this means that 
python knows to search the currennt working directory for  the file to execute, 
but nowhere else. It seems a strange behavior. Maybe this is on Mr. Guido van 
Rossum todo list.
  

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2008-09-30 Thread Pierre Dagenais

kayla bishop wrote:

I can't figure out how to write a program where you flip a coin 100 times and 
it keeps track of how many heads and tails you flipped but it has to be random. 
Can you please help
_
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
  


Which part are you having a problem with? Flipping the coin or keeping track of 
the results, or both? Try to be little more explicit please.




___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Question on DOMImplementation Objects

2008-09-30 Thread Chris Babcock
Does the DOMImplementation interface support schemas? 

I'm tweaking an example from a book to process a flat file registration
database:

from xml.dom import implementation

class RegistrationParser:
  def parseFile(self, fileAsString):

# Create DocType Declaration
doctype = implementation.createDocumentType('registrations', '',
'archive.xsd')

# Create empty DOM Document and get root element
doc = implementation.createDocument('', 'registrations', doctype)
elemDoc = doc.documentElement

. . . 


If I leave archive.xsd out of createDocumentType will it just generate
an XML document without validation?

Chris

-- 


Make a difference in the world and support more Diplomacy projects and
services then you can shake a dagger at, please read:

http://members.bluegoosenews.com/diplomacy/blog/2008/09/24/a_special_note_for_diplomacy_players
 - or - 
http://tinyurl.com/3wx6lb 

Blue Goose is willing to give me $250 to support various services and
projects in the Diplomacy hobby. The blog post above will tell you why
they are doing this, what I will do with the money, and what you can do
to help me get it.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2008-09-30 Thread Pierre Dagenais

kayla bishop wrote:

I can't figure out how to write a program where you flip a coin 100 times and 
it keeps track of how many heads and tails you flipped but it has to be random. 
Can you please help
_
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
  



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
  




No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.173 / Virus Database: 270.7.5/1698 - Release Date: 29/09/2008 7:25 PM


  

Here is how one newbie would do it:


import random

# Initialize variables
head = 0
tail = 0

# Flip the coin a hundred times
for x in range(100):
   choice = random.randint(1,2)
  
# Is it 'head'?

   if choice == 1 :
   head = head + 1
  
# If not 'head' then it must be tail

   else :
   tail = tail + 1
  
print head = ,head

print tail = ,tail


  
___

Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] list to csv

2008-09-30 Thread Arun Tomar
hi!

I've a list

new_array = ['n1', 'm1', 'p1', 'n2', 'm2', 'p2', 'n3', 'm3', 'p3']

I am trying to convert this to a csv in 3 columns so that the final
output would look something like this

n1,m1,p1
n2,m2,p2
n3,m3,p3

regds,
arun.



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] list to csv

2008-09-30 Thread Steve Willoughby

Arun Tomar wrote:

hi!

I've a list

new_array = ['n1', 'm1', 'p1', 'n2', 'm2', 'p2', 'n3', 'm3', 'p3']

I am trying to convert this to a csv in 3 columns so that the final
output would look something like this

n1,m1,p1
n2,m2,p2
n3,m3,p3


This can easily be done with the csv module in the Python standard 
library.  Just create a csv.writer object, and call the writerow() 
method in it for every three elements in new_array and you're done.



regds,
arun.



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python: can't open file 'test.py' : [Errno 2] No such file or directory

2008-09-30 Thread Timothy Grant
On Tue, Sep 30, 2008 at 9:01 PM, Pierre Dagenais [EMAIL PROTECTED] wrote:
 Timothy Grant wrote:

 On Tue, Sep 30, 2008 at 12:58 PM, Pierre Dagenais
 [EMAIL PROTECTED] wrote:


 The file test.py is in I:\Python25\MyCode,
 if I enter:

  C:\Python25\MyCode\python25 test.py at the DOS prompt, everything works
 as
 I would expect.

 However when I enter the same command from any other directory I get this
 error:

  C:\python test.py
  python: can't open file 'test.py' : [Errno 2] No such file or directory

 I've set the environment variable pythonpath as
  C:\set pythonpath = C:\\Python25\\MyCode
 what am I doing wrong,
 Thank u for your help,
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor



 You need to give the full path to your test.py file.

 PYTHONPATH sets the python library search path.


  Thank you Tim,
 Definitively C:\python \python25\mycode\test.py does work. If you're right
 about having to give the full path, and I suspect you are, Then this means
 that python knows to search the currennt working directory for  the file to
 execute, but nowhere else. It seems a strange behavior. Maybe this is on Mr.
 Guido van Rossum todo list.



Why is that strange? Would you expect any other program not on the
path to execute without a fully qualified path? Make your python code
executable, and put it somewhere on the path and I'm quite sure it
would run as expected (though it has been over 10 years since I last
had to work on a Windows box so I'm not quite sure how to do that).

-- 
Stand Fast,
tjg.  [Timothy Grant]
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor