Re: [Tutor] python books

2009-04-14 Thread wesley chun
 I am new in python , so need a good books , previously read python Bible and 
 swaroop but not satisfied .


 so tell me good books in pdf format those contents good problems also


if you like a conversational style and know at least one programming
language, i've written a pretty popular book with the Python crowd
(see below). you can find it pretty much anywhere here in the US. if
you happen to be in Southeast Asia, then you can pick it up from one
of the retailers out there. in particular, here are at least 4 places
in India:

http://www.cb-india.com/proddetail.asp?prod=11266
http://www.nbcindia.com/Descriptions.asp?title_id=123
http://www.sapnaonline.com/MoreInfoBK.aspx?lcID=EBK0067672
http://www.flipkart.com/books/TU23FI6YAB.html

it is also available in PDF format if you subscribe to O'Reilly's
Safari service.

best wishes!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Core Python Programming, Prentice Hall, (c)2007,2001
Python Fundamentals, Prentice Hall, (c)2009
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to write server which listens to specific port

2009-04-14 Thread Alan Gauld


ShivKumar Anand shiv_...@hotmail.com wrote 


My problem is I dont know how to send/receive a file using socket.

How to get the filename specifically.


Could you use ftp? There is an ftp module.

You need to work out what you want to do over this connection 
and choose the appropriate protocol. Then you can use a higher 
level module if one is available.


Raw sockets should only be needed if you are doing bespoke 
communications between processes.



--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

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


Re: [Tutor] path to executing .py file

2009-04-14 Thread Alan Gauld


tiefeng wu iceberg...@gmail.com wrote


is there some way to get path to my executing script, so I can replaced
os.getcwd() in above line?


Look at the recent thread on creating exe files with py2exe.
Investigate the __file__  variable...


shutil.rmtree(svn_repos_copy_dir)

I got error Access denied! Is that mean my script has no power to 
delete

it?


More likely the user running the script does not have the correct
access permissions or someone else is using the repository at
the time thus locking it.

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



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


Re: [Tutor] python books

2009-04-14 Thread Alan Gauld


sudhanshu gautam sudhanshu9...@gmail.com wrote

I am new in python , so need a good books , previously read python Bible 
and

swaroop but not satisfied .

so tell me good books in pdf format those contents good problems also


Does it have to be in PDF? There are many, many excellent Python web
sites with lots of information if you can use HTML.

The most obvious starting points for you would be the official
Python tutorial and Dive Into Python and also, maybe, the
Thinking in Python web book.

FWIW my tutorial is also available in PDF, but if you have read the other
resources it is likely too basic for you.


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



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


Re: [Tutor] Trouble understanding modifying parent class..

2009-04-14 Thread Alan Gauld


Eric Dorsey dors...@gmail.com wrote


class A:
   def __init__(self, name, value=1):
   self.name = name
   self.value = value

And now I want a subclass, one that overrides the value=1 and defaults to
value=2, how do I code that? I'm understanding subclasses that have
different methods that have different behavior, but I'm having trouble 
doing

this.

Do we have to call the __init__ of the parent somehow? Is it replaced 
or

overridden in an __init__ method of the subclass?


You replace the behaviour you want to change, but in the replaced
version you may choose to call the parent version.

This typically leads to very simple methods in the subclass, as in your 
case:


def B(A):
  def __init__(self, name, value=2):
   A.__init__(self,name,value)

This defines a new init method which has a new default value.
It then calls the original parent init method passing the name
and value so that the A default never gets used in B instances.

The OOP topic in my tutor describes this in more detail.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



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


[Tutor] problem with a simple logger with RotatingFileHandler

2009-04-14 Thread Daniel
hi list,

I write a simple logger, which follows the example on
http://docs.python.org/library/logging.html, as this:

def get_logger(log_filename):
my_logger = logging.getLogger(MyLogger)
my_logger.setLevel(logging.debug)
handler = logging.handlers.RotatingFileHandler(log_filename,
maxBytes=100, backupCount=5)
my_logger.addHandler(handler)
return my_logger

def test_logger():
logger = get_logger(rd:\tmp\mylog.txt)
print logger
msg = repeted message
for i in range(1):
logger.info(msg)

if __name__ == '__main__':
test_logger()

but the mylog.txt is empy after running. is there something I missed.

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


[Tutor] help

2009-04-14 Thread j mercedes

hi, its me again jay, thanks alot everyone for your input on the last program i 
created that solved for the mode,mean, and average of a set of numbers it 
actually worked great..if anyone can give me any ideas on this program i am 
doing now it would be appreciated.I keep would like to understand why on the 
last portion it returns an error.thank you.import shelveimport stringUNKNOWN = 
0HOME = 1WORK = 2FAX = 3CELL = 4class phoneentry:def __init__(self, name = 
'Unknown', number = 'Unknown',type = UNKNOWN):self.name = name
self.number = numberself.type = type#  create string representationdef 
__repr__(self):return('%s:%d' % ( self.name, self.type ))#  fuzzy compare 
or two itemsdef __cmp__(self, that):this = string.lower(str(self))that 
= string.lower(that)if string.find(this, that) = 0:return(0)   
 return(cmp(this, that))def showtype(self):if self.type == UNKNOWN: 
return('Unknown')if self.type == HOME: return('Home')if self.type == 
WORK: return('Work')if self.type == FAX: return('Fax')if self.type == 
CELL: return('Cellular')class phonedb:def __init__(self, dbname = 
'phonedata'):self.dbname = dbname;self.shelve = 
shelve.open(self.dbname);def __del__(self):self.shelve.close()
self.shelve = Nonedef add(self, name, number, type = HOME):e = 
phoneentry(name, number, type)self.shelve[str(e)] = edef lookup(self, 
string):list = []for key in self.shelve.keys():e = 
self.shelve[key]if cmp(e, string) == 0:list.append(e)
return(list)
if __name__ == '__main__':foo = phonedb()foo._add_('Sean 
Reifschneider', '970-555-', HOME)foo.add('Sean Reifschneider', 
'970-555-', CELL)foo.add('Evelyn Mitchell', '970-555-', HOME)print 
'First lookup:'for entry in foo.lookup('reifsch'):print '%-40s %s (%s)' 
% ( entry.name, entry.number, entry.showtype())print 'Second lookup:'for entry 
in foo.lookup('e'):print '%-40s %s (%s)' % ( entry.name, entry.number, 
entry.showtype() )___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to write server which listens to specific port

2009-04-14 Thread Kent Johnson
On Mon, Apr 13, 2009 at 10:59 PM, ShivKumar Anand shiv_...@hotmail.com wrote:
 Thanks Kent for this valuable information.

 My problem is I dont know how to send/receive a file using socket.
 How to get the filename specifically.

Where does the file name come from? Do you ask the user? Is it
requested by the remote client?

There is an introduction to socket programming here:
http://www.amk.ca/python/howto/sockets/

Did you look at the links I posted? The NetEpi project seems to have a
complete implementation of an MLLP listener. It uses another project
called halftwist that I can't find but it may still be helpful. The
Mirth link also looks promising.

This page seems to have a good description of the MLLP protocol:
http://www.hl7.org/v3ballot/html/infrastructure/transport/transport-mllp.htm

I don't know your experience level, but if you can't understand the
above MLLP protocol document you are probably in over your head.

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


Re: [Tutor] problem with a simple logger with RotatingFileHandler

2009-04-14 Thread Sander Sweers
2009/4/14 Daniel daniel.chaow...@gmail.com:
 def get_logger(log_filename):
     my_logger = logging.getLogger(MyLogger)
     my_logger.setLevel(logging.debug)
   ^^^
You have a small typo. This should be in capitals, logging.DEBUG.

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


[Tutor] python dictionary

2009-04-14 Thread sudhanshu gautam
I was reading about the python dictionaries  had finished some methods
related to the dictionary.

we used get and setdefault methods to get the value from the dictionary if
it lies inside it

and setdefault used to set the value is side the dictionary if it does not
lies inside the dictionary.

so why we use setdefault I think in place of setdefault first we should
convert that dictionary in the list and now we can add new value then again
convert it in dictionary
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python dictionary

2009-04-14 Thread bob gailer

sudhanshu gautam wrote:
I was reading about the python dictionaries  

That is a good thing to do.

had finished some methods related to the dictionary.

No comprehend.


we used get and setdefault methods to get the value from the 
dictionary if it lies inside it


and setdefault used to set the value is side the dictionary if it does 
not lies inside the dictionary.

Those are good things to do.



so why we use setdefault I think in place of setdefault first we 
should convert that dictionary in the list and now we can add new 
value then again convert it in dictionary



I'm sorry but I do not understand the final paragraph.
It might help a little if you were to use more punctuation.
Are you asking a question?
Could you give an example?

--
Bob Gailer
Chapel Hill NC
919-636-4239
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python dictionary

2009-04-14 Thread Alan Gauld


sudhanshu gautam sudhanshu9...@gmail.com wrote

and setdefault used to set the value is side the dictionary if it does 
not

lies inside the dictionary.

so why we use setdefault I think in place of setdefault first we should
convert that dictionary in the list and now we can add new value then 
again

convert it in dictionary


You probably could convert it to a list, append a tuple and then convert
the list back to a dictionary. But why would you want to do that when
setdefault is so much easier?

Also the conversions between list and dictionary would take a lot of
time and computer power for a big dictionary

For example I tried


L = [(n,n) for n in range(100)]
d = dict(L)
d2 = [(k,v) for k,v in d.items()]
d.setdefault(-5,-5)



- producing the dict from the list took about half a second
- producing the list from the dict took over 3 seconds and
 used over 50% of my CPU...
- using setdefault() was effectively instantaneous.

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



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


[Tutor] oops concepts

2009-04-14 Thread sudhanshu gautam
are there any Links by which I can get good knowledge in OOPS .

I want to go with good problems in OOPS so tell ,me any good book or link of
oops concepts
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python books

2009-04-14 Thread Ian Egland
I know it's not in PDF, but I thought it would be worth mentioning Python
for Software Design: How to Think Like a Computer
Scientisthttp://www.greenteapress.com/thinkpython/index.html.
I discovered this exactly a week after it was released, ordered it, and have
been extremely happy with it so far. I am a student currently learning Java
(unfortunately) and am really enjoying the original, knowledgeable examples
and good presentation this book has to offer. Definitely one of my better
book purchases, and significantly better than the Python Bible if I remember
correctly.

-Ian

On Tue, Apr 14, 2009 at 4:12 AM, Alan Gauld alan.ga...@btinternet.comwrote:


 sudhanshu gautam sudhanshu9...@gmail.com wrote

  I am new in python , so need a good books , previously read python Bible
 and
 swaroop but not satisfied .

 so tell me good books in pdf format those contents good problems also


 Does it have to be in PDF? There are many, many excellent Python web
 sites with lots of information if you can use HTML.

 The most obvious starting points for you would be the official
 Python tutorial and Dive Into Python and also, maybe, the
 Thinking in Python web book.

 FWIW my tutorial is also available in PDF, but if you have read the other
 resources it is likely too basic for you.


 --
 Alan Gauld
 Author of the Learn to Program web site
 http://www.alan-g.me.uk/

 ___
 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] oops concepts

2009-04-14 Thread Alan Gauld

sudhanshu gautam sudhanshu9...@gmail.com wrote


are there any Links by which I can get good knowledge in OOPS .


Try the cetus links web site. 
Also google and wikipedia will throw up lots of sites.


 I want to go with good problems in OOPS so tell me any good 
book or link of oops concepts


My OOP topic lists 3 books as well as a link to cetus links.

There are also things like Thinking In Java/C++ and the 
Design Patterns site.


A lot depends on whether you want to really understand the theory
behind OOP or are happy just knowing how to build classes 
and use OOP to write programs. Most people are happy with 
the latter and in that case just pick whichever site makes most 
sense to you and then write a lot of code. 

If you do want a good theoretical grounding look to books like 
OOSC by Meyer and OOAD by Booch. But you should also consider 
the pair of Schlaer-Mellor books which make no requirement that 
you use an OOP language to build a pure OOP system.  They are 
quite different in approach to most modern OOP text books but 
once you get your head wrapped around the ideas it is a very 
powerful approach.


For a more mathematically rigorous approach yet you should 
read up on concurrent sequential machines and state automata 
theory and any text book on formal simulation techniques.


HTH

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

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


[Tutor] sorting file paths made up of of strings and numbers

2009-04-14 Thread عماد نوفل
Hi tutors,
How can I sort the following list in a way that takes care of the right
order of numbers? The sorted function compares strings here as far as I can
see, but I want to have filepath2 follow filepath1. Your help is
appreciated.
 myList
['filepath54', 'filepath25', 'filepath49', 'filepath0', 'filepath89',
'filepath52', 'filepath37', 'filepath32', 'filepath2', 'filepath15',
'filepath88', 'filepath70', 'filepath33', 'filepath58', 'filepath28',
'filepath61', 'filepath23', 'filepath64', 'filepath72', 'filepath11',
'filepath63', 'filepath76', 'filepath87', 'filepath45', 'filepath41',
'filepath68', 'filepath81', 'filepath75', 'filepath62', 'filepath46',
'filepath36', 'filepath39', 'filepath5', 'filepath34', 'filepath8',
'filepath67', 'filepath14', 'filepath82', 'filepath29', 'filepath47',
'filepath79', 'filepath13', 'filepath16', 'filepath71', 'filepath27',
'filepath100', 'filepath20', 'filepath92', 'filepath57', 'filepath73',
'filepath40', 'filepath44', 'filepath83', 'filepath50', 'filepath66',
'filepath94', 'filepath86', 'filepath22', 'filepath17', 'filepath84',
'filepath38', 'filepath12', 'filepath53', 'filepath6', 'filepath48',
'filepath60', 'filepath51', 'filepath90', 'filepath4', 'filepath78',
'filepath69', 'filepath35', 'filepath97', 'filepath93', 'filepath24',
'filepath26', 'filepath1', 'filepath3', 'filepath96', 'filepath77',
'filepath98', 'filepath18', 'filepath43', 'filepath19', 'filepath56',
'filepath65', 'filepath95', 'filepath55', 'filepath7', 'filepath99',
'filepath91', 'filepath85', 'filepath9', 'filepath59', 'filepath10',
'filepath30', 'filepath31', 'filepath80', 'filepath42', 'filepath74',
'filepath21']
 sorted(myList)
['filepath0', 'filepath1', 'filepath10', 'filepath100', 'filepath11',
'filepath12', 'filepath13', 'filepath14', 'filepath15', 'filepath16',
'filepath17', 'filepath18', 'filepath19', 'filepath2', 'filepath20',
'filepath21', 'filepath22', 'filepath23', 'filepath24', 'filepath25',
'filepath26', 'filepath27', 'filepath28', 'filepath29', 'filepath3',
'filepath30', 'filepath31', 'filepath32', 'filepath33', 'filepath34',
'filepath35', 'filepath36', 'filepath37', 'filepath38', 'filepath39',
'filepath4', 'filepath40', 'filepath41', 'filepath42', 'filepath43',
'filepath44', 'filepath45', 'filepath46', 'filepath47', 'filepath48',
'filepath49', 'filepath5', 'filepath50', 'filepath51', 'filepath52',
'filepath53', 'filepath54', 'filepath55', 'filepath56', 'filepath57',
'filepath58', 'filepath59', 'filepath6', 'filepath60', 'filepath61',
'filepath62', 'filepath63', 'filepath64', 'filepath65', 'filepath66',
'filepath67', 'filepath68', 'filepath69', 'filepath7', 'filepath70',
'filepath71', 'filepath72', 'filepath73', 'filepath74', 'filepath75',
'filepath76', 'filepath77', 'filepath78', 'filepath79', 'filepath8',
'filepath80', 'filepath81', 'filepath82', 'filepath83', 'filepath84',
'filepath85', 'filepath86', 'filepath87', 'filepath88', 'filepath89',
'filepath9', 'filepath90', 'filepath91', 'filepath92', 'filepath93',
'filepath94', 'filepath95', 'filepath96', 'filepath97', 'filepath98',
'filepath99']
 ```

-- 
لا أعرف مظلوما تواطأ الناس علي هضمه ولا زهدوا في إنصافه كالحقيقة.محمد
الغزالي
No victim has ever been more repressed and alienated than the truth

Emad Soliman Nawfal
Indiana University, Bloomington

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


Re: [Tutor] sorting file paths made up of of strings and numbers

2009-04-14 Thread wesley chun
 How can I sort the following list in a way that takes care of the right
 order of numbers? The sorted function compares strings here as far as I can
 see, but I want to have filepath2 follow filepath1. Your help is
 appreciated.
 myList
 ['filepath54', 'filepath25', 'filepath49', 'filepath0', 'filepath89',
 'filepath52', 'filepath37', 'filepath32', 'filepath2', 'filepath15',
:
 'filepath91', 'filepath85', 'filepath9', 'filepath59', 'filepath10',
 'filepath30', 'filepath31', 'filepath80', 'filepath42', 'filepath74',
 'filepath21']


unfortunately, we're restricted from solving your homework problems
for you, however, we can tell you that you can still use sorted().
just combine that with operator.itemgetter(), and you should be well
on your way to solving your problem!

hope this helps!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Core Python Programming, Prentice Hall, (c)2007,2001
Python Fundamentals, Prentice Hall, (c)2009
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] sorting file paths made up of of strings and numbers

2009-04-14 Thread عماد نوفل
On Tue, Apr 14, 2009 at 8:10 PM, wesley chun wes...@gmail.com wrote:

  How can I sort the following list in a way that takes care of the right
  order of numbers? The sorted function compares strings here as far as I
 can
  see, but I want to have filepath2 follow filepath1. Your help is
  appreciated.
  myList
  ['filepath54', 'filepath25', 'filepath49', 'filepath0', 'filepath89',
  'filepath52', 'filepath37', 'filepath32', 'filepath2', 'filepath15',
 :
  'filepath91', 'filepath85', 'filepath9', 'filepath59', 'filepath10',
  'filepath30', 'filepath31', 'filepath80', 'filepath42', 'filepath74',
  'filepath21']


 unfortunately, we're restricted from solving your homework problems
 for you, however, we can tell you that you can still use sorted().
 just combine that with operator.itemgetter(), and you should be well
 on your way to solving your problem!

 hope this helps!
 -- wesley
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Core Python Programming, Prentice Hall, (c)2007,2001
 Python Fundamentals, Prentice Hall, (c)2009
http://corepython.com

 wesley.j.chun :: wescpy-at-gmail.com
 python training and technical consulting
 cyberweb.consulting : silicon valley, ca
 http://cyberwebconsulting.com


Thank you so much Wesley for the tip. I'll look into itemgetter()
This is not a homework problem though,  but I'm working on a paper in which
this is useful. So, it is related to school, but is by no means a homework.

-- 
لا أعرف مظلوما تواطأ الناس علي هضمه ولا زهدوا في إنصافه كالحقيقة.محمد
الغزالي
No victim has ever been more repressed and alienated than the truth

Emad Soliman Nawfal
Indiana University, Bloomington

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


Re: [Tutor] sorting file paths made up of of strings and numbers

2009-04-14 Thread Kent Johnson
2009/4/14 Emad Nawfal (عماد نوفل) emadnaw...@gmail.com:
 Hi tutors,
 How can I sort the following list in a way that takes care of the right
 order of numbers? The sorted function compares strings here as far as I can
 see, but I want to have filepath2 follow filepath1. Your help is
 appreciated.
 myList
 ['filepath54', 'filepath25', 'filepath49', 'filepath0', 'filepath89',
 'filepath52', 'filepath37', 'filepath32', 'filepath2', 'filepath15',
snip

The sort() and sorted() functions have an optional key= parameter. The
parameter should be a function whose argument is a list element and
whose result is the desired key. So for your list, you need a function
that creates an integer from the list item:

In [1]: myList = ['filepath54', 'filepath25', 'filepath49',
'filepath0', 'filepath89', 'filepath52', 'filepath37', 'filepath32', '
filepath2', 'filepath15']

In [2]: def index(fp): return int(fp[8:])

Now sort the list using the key:

In [3]: myList.sort(key=index)

In [4]: myList
Out[4]:
['filepath0',
 'filepath2',
 'filepath15',
 'filepath25',
 'filepath32',
 'filepath37',
 'filepath49',
 'filepath52',
 'filepath54',
 'filepath89']

Note that the key parameter takes the function object itself, there
are no parentheses. i.e. key=index, not key=index().

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


Re: [Tutor] sorting file paths made up of of strings and numbers

2009-04-14 Thread Bill Campbell
On Tue, Apr 14, 2009, Emad Nawfal ( ) wrote:

   Hi tutors,
   How can I sort the following list in a way that takes care of the
   right order of numbers? The sorted function compares strings here as
   far as I can see, but I want to have filepath2 follow filepath1. Your
   help is appreciated.

There is at least one example of a method of dealing with this in
the O'Reilly ``Python cookbook''.

myList
   ['filepath54', 'filepath25', 'filepath49', 'filepath0', 'filepath89',
   'filepath52', 'filepath37', 'filepath32', 'filepath2', 'filepath15',
   'filepath88', 'filepath70', 'filepath33', 'filepath58', 'filepath28',
   'filepath61', 'filepath23', 'filepath64', 'filepath72', 'filepath11',
   'filepath63', 'filepath76', 'filepath87', 'filepath45', 'filepath41',
   'filepath68', 'filepath81', 'filepath75', 'filepath62', 'filepath46',
   'filepath36', 'filepath39', 'filepath5', 'filepath34', 'filepath8',
   'filepath67', 'filepath14', 'filepath82', 'filepath29', 'filepath47',
   'filepath79', 'filepath13', 'filepath16', 'filepath71', 'filepath27',
   'filepath100', 'filepath20', 'filepath92', 'filepath57', 'filepath73',
   'filepath40', 'filepath44', 'filepath83', 'filepath50', 'filepath66',
   'filepath94', 'filepath86', 'filepath22', 'filepath17', 'filepath84',
   'filepath38', 'filepath12', 'filepath53', 'filepath6', 'filepath48',
   'filepath60', 'filepath51', 'filepath90', 'filepath4', 'filepath78',
   'filepath69', 'filepath35', 'filepath97', 'filepath93', 'filepath24',
   'filepath26', 'filepath1', 'filepath3', 'filepath96', 'filepath77',
   'filepath98', 'filepath18', 'filepath43', 'filepath19', 'filepath56',
   'filepath65', 'filepath95', 'filepath55', 'filepath7', 'filepath99',
   'filepath91', 'filepath85', 'filepath9', 'filepath59', 'filepath10',
   'filepath30', 'filepath31', 'filepath80', 'filepath42', 'filepath74',
   'filepath21']
sorted(myList)
   ['filepath0', 'filepath1', 'filepath10', 'filepath100', 'filepath11',
   'filepath12', 'filepath13', 'filepath14', 'filepath15', 'filepath16',
   'filepath17', 'filepath18', 'filepath19', 'filepath2', 'filepath20',
   'filepath21', 'filepath22', 'filepath23', 'filepath24', 'filepath25',
   'filepath26', 'filepath27', 'filepath28', 'filepath29', 'filepath3',
   'filepath30', 'filepath31', 'filepath32', 'filepath33', 'filepath34',
   'filepath35', 'filepath36', 'filepath37', 'filepath38', 'filepath39',
   'filepath4', 'filepath40', 'filepath41', 'filepath42', 'filepath43',
   'filepath44', 'filepath45', 'filepath46', 'filepath47', 'filepath48',
   'filepath49', 'filepath5', 'filepath50', 'filepath51', 'filepath52',
   'filepath53', 'filepath54', 'filepath55', 'filepath56', 'filepath57',
   'filepath58', 'filepath59', 'filepath6', 'filepath60', 'filepath61',
   'filepath62', 'filepath63', 'filepath64', 'filepath65', 'filepath66',
   'filepath67', 'filepath68', 'filepath69', 'filepath7', 'filepath70',
   'filepath71', 'filepath72', 'filepath73', 'filepath74', 'filepath75',
   'filepath76', 'filepath77', 'filepath78', 'filepath79', 'filepath8',
   'filepath80', 'filepath81', 'filepath82', 'filepath83', 'filepath84',
   'filepath85', 'filepath86', 'filepath87', 'filepath88', 'filepath89',
   'filepath9', 'filepath90', 'filepath91', 'filepath92', 'filepath93',
   'filepath94', 'filepath95', 'filepath96', 'filepath97', 'filepath98',
   'filepath99']
```
   --
   áÇ ÃÚÑÝ ãÙáæãÇ ÊæÇØà ÇáäÇÓ Úáí åÖãå æáÇ ÒåÏæÇ Ýí ÅäÕÇÝå
   ßÇáÍÞíÞÉ.ãÍãÏ ÇáÛÒÇáí
   No victim has ever been more repressed and alienated than the truth
   Emad Soliman Nawfal
   Indiana University, Bloomington
   

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


-- 
Bill
-- 
INTERNET:   b...@celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:  (206) 236-1676  Mercer Island, WA 98040-0820
Fax:(206) 232-9186  Skype: jwccsllc (206) 855-5792

An almost hysterical antagonism toward the gold standard is one issue which
unites statists of all persuasions.  They seem to sense that gold and
economic freedom are inseparable.  -- Alan Greenspan
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] path to executing .py file

2009-04-14 Thread tiefeng wu

 is there some way to get path to my executing script, so I can replaced
 os.getcwd() in above line?


 Look at the recent thread on creating exe files with py2exe.
 Investigate the __file__  variable...


thanks, Alan Gauld. thanks for your patience for such a trivial question:)


 shutil.rmtree(svn_repos_copy_dir)

 I got error Access denied! Is that mean my script has no power to delete
 it?


 More likely the user running the script does not have the correct
 access permissions or someone else is using the repository at
 the time thus locking it.


as I mentioned, that's a COPY of svn repository, I'm sure there's no one
locking it
I tried manually delete it by 'del' and 'rm' under command line, and I got
same error,
but deleting in windows explorer (with same user login as script was called)
with no
problem.

if this question has nothing concerned with this mailing list, I'm sorry an
please ignore it.

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