Re: Multiple versions of Python coexisting in the same OS

2010-07-26 Thread Gelonida


 Thus my idea of having a pystarter with a config file
 mentioning which directories (tools) should use which python executable
 
 Well, good luck ! I don;t know how this is resolved for you when some
 scripts executes 'python xxx yyy' or 'someScript.py yyy'.

both could be resolved with a python starter if one wanted.

call the python starter python.exe and put it first in the path.
set the python file associations to the python starter.


By the way:

Something similiar (not identical) has been used for linux hosts in big
companies in order to easily switch between different projects.  (which
potentilly had different versions of development tools)

instead of having multiple .cshrc / .bashrc files

the first entry of path has been set to
/_WRAPPER_/bin (or something similiar)
in this directory one found a wrapper script for each tool to be
wrapped. ( one script, many symlinks for each tool)

the wrapper script took a global setup, the project name and a private
setup to finally call the the desired script.

What is missing is to choose the executable depending on the script to
be called.

If one has a wrapper this could be added.

Just a question of style, whether the decision which script to be called
should come from the
- user
- a config file ( No script to be intrusively changed, what Edward seems
to prefer )
- some coding in the script or the tool's directory ( which MRAB seems
to prefer )






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


Re: Multiple versions of Python coexisting in the same OS

2010-07-26 Thread Gelonida
On 07/25/2010 10:39 PM, MRAB wrote:
 News123 wrote:

 Thus my idea of having a pystarter with a config file
 mentioning which directories (tools) should use which python executable

 I think that's the wrong way round. A pystarter should ask the _tool_
 which version of Python it needs.


Hm, it's dfifficult to think about a solution satisfying everyone.

Edward seems to insist on a non intrusive solution, where no script is
changed (thus my idea of a config file)


I personally would probably add information to all of my self written
scripts
and create a config file for all other tools (or add a marker file n the
path of these tools)


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


Re: Multiple versions of Python coexisting in the same OS

2010-07-26 Thread Gelonida
On 07/26/2010 06:36 AM, Edward Diener wrote:
 
 I start a Python script for version X by going to X's root directory and
 invoking 'python someScript.py' from the command line. Does that not
 sound reasonable ?

Do you have an example of two (not self written) applications requiring
to change the python file association in order to be working?

I never had problems with this, so would be curious about the tools to
avoid.



Apart from that my suggestion for you would be:


Don't write a tool.
Just create one .bat file  for each sript to be started.

The bat file should set the python search path.
This should cover 90% of existing python scripts.
(If you want, you could write a tool to create the bat files)


Now the second problem.

if a python script starts another python file without calling python.exe
but via the file associations, then above solution would not be sufficient/
you had to additionally change the file associations,
(which can easily be done from a bat file as well if you insist. The
commands you need are 'assoc' and 'ftype')

But does this really happen to you?



Please note:
Trying to develop a solution, which believes that you will never have
two concurrent applications requiring two differnt python versions
sounds a little dangerous.

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


Re: non-blocking IO EAGAIN on write

2010-07-26 Thread Thomas Guettler
John Nagle wrote:
 On 7/23/2010 1:45 AM, Thomas Guettler wrote:
 Hi,

 I use non-blocking io to check for timeouts. Sometimes I get EAGAIN
 (Resource temporarily unavailable)
 on write(). My working code looks like this. But I am unsure how many
 bytes have been written to the
 pipe if I get an EAGAIN IOError.




 Since your code isn't doing anything else while waiting for a
 write to complete on the pipe, why use non-blocking I/O at all?
 
 (I know, the Python I/O timeout logic is broken in some versions.
 You're probably working around that.)

I want to handle timeouts. The app runs on linux, but I don't want to use
signals, since it is in a wsgi context:

http://code.google.com/p/modwsgi/wiki/ApplicationIssues
 .. As a general rule therefore, no WSGI application component should
 attempt to register its own signal handlers.


The hint of Kushal was right: The timeout was reached, and I didn't check
the result of the select call.

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hasattr + __getattr__: I think this is Python bug

2010-07-26 Thread Bruno Desthuilliers

dmitrey a écrit :
(snip)


This doesn't stack with the following issue: sometimes user can write
in code myObject.size = (some integer value) and then it will be
involved in future calculations as ordinary fixed value; if user
doesn't supply it, but myObject.size is involved in calculations, then
the oofun is created to behave like similar numpy.array attribute.


IOW, you want a default value for the size if it has not been specified 
by the user, so you can safely use this attribute in computations. The 
more straightforward solution is to define this attribute (with the 
default value) in the initialiser, ie:



class MyClass(object):
def __init__(self, x, y):
self.x = x
self.y = y
self.size = Whatever()


If you don't want to create as many Whatever instances as MyClass 
instances, you can create a single Whatever instance before defining 
your class:


DEFAULT_WHATEVER = Whathever()

class MyClass(object):
def __init__(self, x, y):
self.x = x
self.y = y
self.size = DEFAULT_WHATEVER


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


ValueError: invalid literal for int():

2010-07-26 Thread lee
Hi,

I have a value,

partintid = int(Screw plugg  (91_10 - untitled))

but i get ValueError: invalid literal for int(): Screw plugg  (91_10 -
 untitled)
any help?

-
Sunny

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


Re: Multiprocessing zombie processes

2010-07-26 Thread Lawrence D'Oliveiro
In message mailman.1127.1280014712.1673.python-l...@python.org, Chris 
Rebert wrote:

 Paging Dr. Frankenstein. Dr. Frankenstein to the lab. Paging Dr.
 Frankenstein.

 Most people try to /avoid/ making zombies.

Is there some connection between Frankenstein and zombies?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiprocessing zombie processes

2010-07-26 Thread Chris Rebert
On Mon, Jul 26, 2010 at 3:30 AM, Lawrence D'Oliveiro
l...@geek-central.gen.new_zealand wrote:
 In message mailman.1127.1280014712.1673.python-l...@python.org, Chris
 Rebert wrote:

 Paging Dr. Frankenstein. Dr. Frankenstein to the lab. Paging Dr.
 Frankenstein.

 Most people try to /avoid/ making zombies.

 Is there some connection between Frankenstein and zombies?

His monster is zombie-ish; it's made of reanimated corpse parts. It's
also mentioned in Wikipedia's Zombie article as influencing future
works about the undead.

Cheers,
Chris
--
Not a perfect comedic reference, I admit.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ValueError: invalid literal for int():

2010-07-26 Thread Chris Rebert
On Mon, Jul 26, 2010 at 3:25 AM, lee san82m...@gmail.com wrote:
 Hi,

 I have a value,

 partintid = int(Screw plugg  (91_10 - untitled))

 but i get ValueError: invalid literal for int(): Screw plugg  (91_10 -
 untitled)
 any help?

That is most certainly not your actual exact code, since it has a few
SyntaxErrors and thus Python would have bailed-out long before it ever
got the chance to raise ValueError. Please copy-and-paste the *actual
exact code* and exact error message.
Also, next time say what the desired output/behavior you're seeking is.

That being said, if your code is (as I suspect) in actuality:

partintid = int(Screw plugg  (91_10 - untitled))

then I would agree with int() and say that that string is nowhere
close to representing an integer (how precisely is Screw to be
interpreted as an integer, pray tell?); so what's so surprising about
getting an error when trying to convert it to one?

I suspect you're trying to extract 91 or 10 from the string. Use
string methods[1] to parse the desired numerical section out of the
string, and then pass the resulting numerical string to int(), which
will accept it without error and properly convert it.

If you want more detailed help, please provide a specification of
typical input strings and desired output integers.

[1]: http://docs.python.org/library/stdtypes.html#string-methods

Regards,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: hasattr + __getattr__: I think this is Python bug

2010-07-26 Thread Duncan Booth
Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote:

 If you don't want to create as many Whatever instances as MyClass 
 instances, you can create a single Whatever instance before defining 
 your class:
 
 DEFAULT_WHATEVER = Whathever()
 
 class MyClass(object):
  def __init__(self, x, y):
  self.x = x
  self.y = y
  self.size = DEFAULT_WHATEVER
 
 

Or you could create the default as a class attribute and it can be 
overridden in those instances which need a different value.

class MyClass(object):
size = Whatever()

def __init__(self, x, y):
self.x = x
self.y = y

-- 
Duncan Booth http://kupuguy.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ValueError: invalid literal for int():

2010-07-26 Thread Sunny chilgod
Hi Chris,

Thanks for your help. but i need to to convert the whole string to int.

heres my full code,

ptid = 'item_01bom'
so item_01bom is a field name in form, so i get its value,
partintid = int(form[ptid]).  # the value of form[ptid] is 'Screw plugg
 (91_10 - untitled)'

Hence i get the error. hope i am clear now.

-
Sunny


On Mon, Jul 26, 2010 at 4:25 PM, Chris Rebert c...@rebertia.com wrote:

 On Mon, Jul 26, 2010 at 3:25 AM, lee san82m...@gmail.com wrote:
  Hi,
 
  I have a value,
 
  partintid = int(Screw plugg  (91_10 - untitled))
 
  but i get ValueError: invalid literal for int(): Screw plugg  (91_10 -
  untitled)
  any help?

 That is most certainly not your actual exact code, since it has a few
 SyntaxErrors and thus Python would have bailed-out long before it ever
 got the chance to raise ValueError. Please copy-and-paste the *actual
 exact code* and exact error message.
 Also, next time say what the desired output/behavior you're seeking is.

 That being said, if your code is (as I suspect) in actuality:

 partintid = int(Screw plugg  (91_10 - untitled))

 then I would agree with int() and say that that string is nowhere
 close to representing an integer (how precisely is Screw to be
 interpreted as an integer, pray tell?); so what's so surprising about
 getting an error when trying to convert it to one?

 I suspect you're trying to extract 91 or 10 from the string. Use
 string methods[1] to parse the desired numerical section out of the
 string, and then pass the resulting numerical string to int(), which
 will accept it without error and properly convert it.

 If you want more detailed help, please provide a specification of
 typical input strings and desired output integers.

 [1]: http://docs.python.org/library/stdtypes.html#string-methods

 Regards,
 Chris
 --
 http://blog.rebertia.com




-- 
All that we are is the result of what we have thought. The mind is
everything. What we think we become.

Regards,
Sunny
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ValueError: invalid literal for int():

2010-07-26 Thread Chris Rebert
 On Mon, Jul 26, 2010 at 4:25 PM, Chris Rebert c...@rebertia.com wrote:
 On Mon, Jul 26, 2010 at 3:25 AM, lee san82m...@gmail.com wrote:
  Hi,
 
  I have a value,
 
  partintid = int(Screw plugg  (91_10 - untitled))
 
  but i get ValueError: invalid literal for int(): Screw plugg  (91_10 -
  untitled)
  any help?
snip
 I suspect you're trying to extract 91 or 10 from the string. Use
 string methods[1] to parse the desired numerical section out of the
 string, and then pass the resulting numerical string to int(), which
 will accept it without error and properly convert it.

 If you want more detailed help, please provide a specification of
 typical input strings and desired output integers.

 [1]: http://docs.python.org/library/stdtypes.html#string-methods

On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod san82m...@gmail.com wrote:
 Hi Chris,
 Thanks for your help. but i need to to convert the whole string to int.
 heres my full code,
 ptid = 'item_01bom'
 so item_01bom is a field name in form, so i get its value,
 partintid = int(form[ptid]).  # the value of form[ptid] is 'Screw plugg
  (91_10 - untitled)'
 Hence i get the error. hope i am clear now.

Nope, still vague. Which is your desired value for partintid: 91? 10?
9110? 91_10? Something else?

Also, not to be unfriendly, but just note for future reference that
top-posting ( http://en.wikipedia.org/wiki/Top-posting ) is generally
avoided on this mailinglist/newsgroup.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ValueError: invalid literal for int():

2010-07-26 Thread Steven D'Aprano
On Mon, 26 Jul 2010 04:12:33 -0700, Chris Rebert wrote:

 On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod san82m...@gmail.com
 wrote:
 Hi Chris,
 Thanks for your help. but i need to to convert the whole string to int.
 heres my full code,
 ptid = 'item_01bom'
 so item_01bom is a field name in form, so i get its value, partintid =
 int(form[ptid]).  # the value of form[ptid] is 'Screw plugg
  (91_10 - untitled)'
 Hence i get the error. hope i am clear now.
 
 Nope, still vague. Which is your desired value for partintid: 91? 10?
 9110? 91_10? Something else?


Well, if you interpret 'Screw plugg (91_10 - untitled)' as a base-256 
number, the correct answer is:

147,334,663,384,405,567,160,096,068,524,905,866,724,622,858,761,848,595,862,392,584,788,047,651,881


Obviously.



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


Re: ValueError: invalid literal for int():

2010-07-26 Thread lee
On Jul 26, 4:30 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
 On Mon, 26 Jul 2010 04:12:33 -0700, Chris Rebert wrote:
  On Mon, Jul 26, 2010 at 4:03 AM, Sunny chilgod san82m...@gmail.com
  wrote:
  Hi Chris,
  Thanks for your help. but i need to to convert the whole string to int.
  heres my full code,
  ptid = 'item_01bom'
  so item_01bom is a field name in form, so i get its value, partintid =
  int(form[ptid]).  # the value of form[ptid] is 'Screw plugg
   (91_10 - untitled)'
  Hence i get the error. hope i am clear now.

  Nope, still vague. Which is your desired value for partintid: 91? 10?
  9110? 91_10? Something else?

 Well, if you interpret 'Screw plugg (91_10 - untitled)' as a base-256
 number, the correct answer is:

 147,334,663,384,405,567,160,096,068,524,905,866,724,622,858,761,848,595,862,392,584,788,047,651,881

 Obviously.

 --
 Steven

Hi,

i got the value wrong. sorry for the mistake. i get a int value like
01, so no issue converting it to integer.
thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiprocessing zombie processes

2010-07-26 Thread Michele Simionato
On Jul 25, 1:11 am, Navkirat Singh navkir...@gmail.com wrote:
 OK I wanted zombie processes and have been able to regenerate them with 
 multiprocessing. Now lets see how I can handle them.

The multiprocessing docs say:


Joining zombie processes

On Unix when a process finishes but has not been joined it becomes a
zombie. There should never be very many because each time a new
process starts (or active_children() is called) all completed
processes which have not yet been joined will be joined. Also calling
a finished process’s Process.is_alive() will join the process. Even so
it is probably good practice to explicitly join all the processes that
you start.

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


Re: hasattr + __getattr__: I think this is Python bug

2010-07-26 Thread Bruno Desthuilliers

Duncan Booth a écrit :

Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote:

If you don't want to create as many Whatever instances as MyClass 
instances, you can create a single Whatever instance before defining 
your class:


DEFAULT_WHATEVER = Whathever()

class MyClass(object):
 def __init__(self, x, y):
 self.x = x
 self.y = y
 self.size = DEFAULT_WHATEVER




Or you could create the default as a class attribute 


from the OP:

I have a class (FuncDesigner oofun) that has no attribute size, but
it is overloaded in __getattr__, so if someone invokes
myObject.size, it is generated (as another oofun) and connected to
myObject as attribute.


so this solution won't obviously work in this case !-)

Also and FWIW, I wouldn't advocate this solution if the default class 
attribute is of a mutable type.

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


Re: why is this group being spammed?

2010-07-26 Thread Bruno Desthuilliers

be.krul a écrit :


Why not moderate this group?


This is a hi-traffic group, so it would require a huge team of moderators.
--
http://mail.python.org/mailman/listinfo/python-list


I GOT $2,000 FROM ' PAYPAL'

2010-07-26 Thread paypal
I GOT $2,000 FROM ' PAYPAL'  At  http://veryhotguru.co.cc

i have hidden the PayPal Form link in an image.
in that website On Top Side Above search box , click on image
and enter your  PayPal  id And Your name.

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


Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-26 Thread Burton Samograd
Grant Edwards inva...@invalid.invalid writes:

 On 2010-07-24, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
 In message mailman.323.1278440923.1673.python-l...@python.org, Robert Kern 
 wrote:

 There are also utilities for mounting ISOs directly without burning
 them to a physical disk.

 You need special utilities to do this??

 Not if the OS and VFS are competently designed.  In Linux all you need
 to do is this:

   mount -o loop /path/to/file.iso /mount/point

 Apparently you've got to jump through all sorts of hoops using 3rd
 party software to do something analgous in MS Windows.

In Windows you use DaemonTools.

--
Burton Samograd 

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


Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-26 Thread Robin Becker

On 26/07/2010 16:47, Burton Samograd wrote:

Grant Edwardsinva...@invalid.invalid  writes:


On 2010-07-24, Lawrence D'Oliveirol...@geek-central.gen.new_zealand  wrote:

In messagemailman.323.1278440923.1673.python-l...@python.org, Robert Kern
wrote:


There are also utilities for mounting ISOs directly without burning
them to a physical disk.


You need special utilities to do this??


Not if the OS and VFS are competently designed.  In Linux all you need
to do is this:

   mount -o loop /path/to/file.iso /mount/point

Apparently you've got to jump through all sorts of hoops using 3rd
party software to do something analgous in MS Windows.


In Windows you use DaemonTools.

--
Burton Samograd

I use VCdControlTool.exe which is some kind of M$ utility, but perhaps that 
doesn't work for everyone.


--
Robin Becker

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


Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-26 Thread Ethan Furman

Gregory Ewing wrote:

Raymond Hettinger wrote:

Every class
in the MRO implementing the target method *must* call super() to give
the next class in the MRO a chance to run.


EXCEPT for the last one, which must NOT call super!

The posted example happens to work because object has
a default __init__ method that does nothing. But this
is not generally true of other methods, which means you
need a terminating class at the end of the MRO whose
methods don't call super.


Speaking of new-style classes only, don't they all end in object?  And 
if the MRO is only known at run-time, how is one to know at code-time 
whether your (new-style) class is at the end of the line?


~Ethan~

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


Re: hasattr + __getattr__: I think this is Python bug

2010-07-26 Thread Ethan Furman

Bruno Desthuilliers wrote:

Duncan Booth a écrit :

Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid wrote:

If you don't want to create as many Whatever instances as MyClass 
instances, you can create a single Whatever instance before defining 
your class:


DEFAULT_WHATEVER = Whathever()

class MyClass(object):
 def __init__(self, x, y):
 self.x = x
 self.y = y
 self.size = DEFAULT_WHATEVER




Or you could create the default as a class attribute 


from the OP:

I have a class (FuncDesigner oofun) that has no attribute size, but
it is overloaded in __getattr__, so if someone invokes
myObject.size, it is generated (as another oofun) and connected to
myObject as attribute.


so this solution won't obviously work in this case !-)

Also and FWIW, I wouldn't advocate this solution if the default class 
attribute is of a mutable type.


Well, it is Monday, so I may be missing something obvious, but what is 
the effective difference between these two solutions?


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


What does the output of return os.lstat(logFile)[ST_CTIME] mean?

2010-07-26 Thread alberttresens

Hi,
I am trying to get the creation time of a file to be able to correlate it's
content timestamps with other log files.
In order to get the creation time of the file one a Linux machine i used:

return os.lstat(logFile)[ST_CTIME]

That returns to me something like: 1279620166

I would like to know the meaning of this number. 
Is it in seconds since the epoch?
Or is some other respresentation?

Thanks,
Albert
-- 
View this message in context: 
http://old.nabble.com/What-does-the-output-of-return-os.lstat%28logFile%29-ST_CTIME--mean--tp29268605p29268605.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Re: Compare two nested dictionaries

2010-07-26 Thread John Nagle

On 7/25/2010 8:03 AM, targetsmart wrote:

Hi,
I am trying to compare two nested dictionaries, I want to know what is
the exact difference between them.



d1 = {'a' : 1, 'b' : 2, 'c': 3 }
d2 = {'a' : 1, 'b' : 3, 'd': 4 }

diff = dict(set(d1.items()) - set(d2.items()))

print (diff)

{'c': 3, 'b': 2}

That's the true difference, with all entries in d1 not
identically in d2 listed.  Is that what you wanted?

John Nagle

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


Re: What does the output of return os.lstat(logFile)[ST_CTIME] mean?

2010-07-26 Thread Steven D'Aprano
On Mon, 26 Jul 2010 09:54:23 -0700, alberttresens wrote:

 Hi,
 I am trying to get the creation time of a file to be able to correlate
 it's content timestamps with other log files. In order to get the
 creation time of the file one a Linux machine i used:

You're out of luck. Neither Unix nor Linux store the creation time of 
files, at least not on any file system I know of. It stores three 
timestamps: mtime, ctime, and atime.

atime is the simple one -- it is access time, or when the file was last 
read.

mtime is modification time -- it is when the file *contents* were last 
changed.

But ctime is NOT creation time, as many people imagine. It is change 
time, and it changes whenever EITHER the file contents are changed, OR 
when the file metadata (permissions, owner, name, etc.) change.

So any time mtime changes, so does ctime. But not visa versa.


 return os.lstat(logFile)[ST_CTIME]
 
 That returns to me something like: 1279620166
 
 I would like to know the meaning of this number. Is it in seconds since
 the epoch?

Yes.




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


Re: What does the output of return os.lstat(logFile)[ST_CTIME] mean?

2010-07-26 Thread alberttresens

Hi, thanks for the reply.

But what i am more concerned about, as I am trying to correlate logs, is
what is the timestamp:
1279620166 mean?
Is it seconds since the epoch or the ISO time in seconds?

Any idea?

Thanks a lot!!


Steven D'Aprano-7 wrote:
 
 On Mon, 26 Jul 2010 09:54:23 -0700, alberttresens wrote:
 
 Hi,
 I am trying to get the creation time of a file to be able to correlate
 it's content timestamps with other log files. In order to get the
 creation time of the file one a Linux machine i used:
 
 You're out of luck. Neither Unix nor Linux store the creation time of 
 files, at least not on any file system I know of. It stores three 
 timestamps: mtime, ctime, and atime.
 
 atime is the simple one -- it is access time, or when the file was last 
 read.
 
 mtime is modification time -- it is when the file *contents* were last 
 changed.
 
 But ctime is NOT creation time, as many people imagine. It is change 
 time, and it changes whenever EITHER the file contents are changed, OR 
 when the file metadata (permissions, owner, name, etc.) change.
 
 So any time mtime changes, so does ctime. But not visa versa.
 
 
 return os.lstat(logFile)[ST_CTIME]
 
 That returns to me something like: 1279620166
 
 I would like to know the meaning of this number. Is it in seconds since
 the epoch?
 
 Yes.
 
 
 
 
 -- 
 Steven
 -- 
 http://mail.python.org/mailman/listinfo/python-list
 
 

-- 
View this message in context: 
http://old.nabble.com/What-does-the-output-of-return-os.lstat%28logFile%29-ST_CTIME--mean--tp29268605p29268871.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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


Re: Multiple versions of Python coexisting in the same OS

2010-07-26 Thread Thomas Jollans
On 07/26/2010 06:36 AM, Edward Diener wrote:
 On 7/25/2010 10:42 PM, David Robinow wrote:
 On Sun, Jul 25, 2010 at 8:40 PM, Edward Diener
 eldie...@tropicsoft.invalid  wrote:
 On 7/25/2010 5:57 PM, Thomas Jollans wrote:
 So if a standard library module ( or distributed library ) executes a
 call
 internally to 'python xxx yyy' or executes a call internally to
 'someScript.py yyy', you're fine with multiple co-existing versions of
 Python on your system ?

 Because under Windows the first call will look for the python.exe first
 found in the PATH while the second call will find the python.exe
 associated
 with the .py extension. And it does not matter in either case what
 version
 of the multiple installed versions of Python which are on my system is
 currently executing that script.

 And please don't say that there is some sort of guarantee that no
 library or
 installation would invoke Python in such a way as opposed to the normal
 'import AScript.py' method of using functionality in Python scripts.
 Edward, I'm having a really hard time understanding your problem.
 Could you give an example of some real code that is causing you
 difficulty?
 
 I start a Python script for version X by going to X's root directory and
 invoking 'python someScript.py' from the command line. Does that not
 sound reasonable ?

yeah, well, sort of. But for a system installation, not really. When
hacking on the interpreter, this makes sense. Otherwise - not so much.

 
 In SomeScript.py there is an internal call to 'python someOtherScript.y
 someParameters'.

Is that a fact?

Where on earth did you get this SomeScript.py?

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


Re: What does the output of return os.lstat(logFile)[ST_CTIME] mean?

2010-07-26 Thread Thomas Jollans
On 07/26/2010 07:24 PM, alberttresens wrote:
 
 Hi, thanks for the reply.

Alas, you didn't actually read it:

 
 But what i am more concerned about, as I am trying to correlate logs, is
 what is the timestamp:
 1279620166 mean?
 Is it seconds since the epoch or the ISO time in seconds?
 
 Any idea?
 
 Thanks a lot!!


[...]

 I would like to know the meaning of this number. Is it in seconds since
 the epoch?

 Yes.

You quoted the answer to your question in the same e-mail. fascinating.

A little side note:

 atime is the simple one -- it is access time, or when the file was
 last read.

You should never rely on this, though: some file systems don't store
this (I think) and many users/sysadmins actually disable this
(mount -o noatime) for performance reasons. (Also, on an SSD, I imagine
enabling atime, and with it many, many additional writes, could
noticeably detriment disk lifetime)
-- 
http://mail.python.org/mailman/listinfo/python-list


distutils question - building universal modules on OS X?

2010-07-26 Thread Louis Theran
Is there a standard recipe for getting distutils to built
universal .so files for modules that have C/C++ source?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: distutils question - building universal modules on OS X?

2010-07-26 Thread Robert Kern

On 7/26/10 1:36 PM, Louis Theran wrote:

Is there a standard recipe for getting distutils to built
universal .so files for modules that have C/C++ source?


If your Python was built to be Universal, it will automatically use the same 
architecture flags to build the extension modules Universal.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


Binary compatibility across Python versions?

2010-07-26 Thread Philip Semanchuk

Hi all,
Does Python guarantee binary compatibility across major, minor and/or  
micro versions? I looked through the docs and even with Google's help  
I wasn't able to find any official statements on this subject.



Specifically, I'm concerned with binaries created by SWIG for a C++  
library that our project uses. We'd like to ship precompiled binaries  
for Linux, OS X and Windows for Python 2.5 and 2.6. I'm hoping that it  
is sufficient to create binaries for each Python for each platform (3  
* 2 == 6 total precompiled binaries).


Thanks for any advice and pointers to official documentation on the  
subject.


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


Re: Binary compatibility across Python versions?

2010-07-26 Thread MRAB

Philip Semanchuk wrote:

Hi all,
Does Python guarantee binary compatibility across major, minor and/or 
micro versions? I looked through the docs and even with Google's help I 
wasn't able to find any official statements on this subject.



Specifically, I'm concerned with binaries created by SWIG for a C++ 
library that our project uses. We'd like to ship precompiled binaries 
for Linux, OS X and Windows for Python 2.5 and 2.6. I'm hoping that it 
is sufficient to create binaries for each Python for each platform (3 * 
2 == 6 total precompiled binaries).


Thanks for any advice and pointers to official documentation on the 
subject.



There are differences between minor versions, but not, so far as I'm
aware, between micro versions (and I'd be surprised if there were).
--
http://mail.python.org/mailman/listinfo/python-list


Re: Binary compatibility across Python versions?

2010-07-26 Thread Christian Heimes
 Specifically, I'm concerned with binaries created by SWIG for a C++  
 library that our project uses. We'd like to ship precompiled binaries  
 for Linux, OS X and Windows for Python 2.5 and 2.6. I'm hoping that it  
 is sufficient to create binaries for each Python for each platform (3  
 * 2 == 6 total precompiled binaries).

For each platforms you have to provide binaries for the major CPU
architectures (X86 and X64_86), too. Users or distributions may compile
Python with UCS-2 or UCS-4 unicode width. That makes eight different
binaries for Linux (two version * two archs * UCS2/4). Although most
distributions follow the LSB standards, binaries aren't necessary ABI
compatible. C++ binaries tend to break more often than C binaries.

Have fun ;)

Christian

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


Re: Binary compatibility across Python versions?

2010-07-26 Thread Robert Kern

On 7/26/10 2:40 PM, MRAB wrote:

Philip Semanchuk wrote:

Hi all,
Does Python guarantee binary compatibility across major, minor and/or micro
versions? I looked through the docs and even with Google's help I wasn't able
to find any official statements on this subject.


Specifically, I'm concerned with binaries created by SWIG for a C++ library
that our project uses. We'd like to ship precompiled binaries for Linux, OS X
and Windows for Python 2.5 and 2.6. I'm hoping that it is sufficient to create
binaries for each Python for each platform (3 * 2 == 6 total precompiled
binaries).

Thanks for any advice and pointers to official documentation on the subject.


There are differences between minor versions, but not, so far as I'm
aware, between micro versions (and I'd be surprised if there were).


As a matter of policy, micro versions are binary-compatible. It's a bug if a 
micro revision breaks binary compatibility.


--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


Re: Accumulate function in python

2010-07-26 Thread dhruvbird
On Jul 21, 8:17 pm, John Nagle na...@animats.com wrote:
 On 7/19/2010 9:56 AM, dhruvbird wrote:

  On Jul 19, 9:12 pm, Brian Victorhomeusen...@brianhv.org  wrote:
  dhruvbird wrote:
  Having offered this, I don't recall ever seeing reduce used in real
  python code, and explicit iteration is almost always preferred.

  Yes, even I have noticed that reduce is a tad under-used function.

      Yes, I had a use case for it once, but it wasn't worth the trouble.
 map is often useful, but reduce, not so much.

      Python isn't really a functional language.  There's no bias toward
 functional solutions, lambdas aren't very general, and the performance
 isn't any better.  Nor is any concurrency provided by map or reduce.
 So there's no win in trying to develop cute one-liners.

Yes agreed.

However, there is:

1. now scope for optimization (for example returning generators
instead of lists) at every stage if using functions -- these functions
can be internally changed as long as the external guarantees they
provide remain essentially unchanged.

2. readability wins because you express your intent (operations)
rather than anything else.
For example, if I want the product of the square roots of all odd
integers in an array, I can say:
answer = reduce(product, map(math.sqrt, filter(lambda x: x%2 == 0,
some_array_with_ints)))

While I agree that python may not have been initially seen as a
functional language, it is powerful and flexible enough to be one or
at least decently support such paradigms.

Regards,
-Dhruv.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Binary compatibility across Python versions?

2010-07-26 Thread Ned Deily
In article i2kok1$kr...@dough.gmane.org,
 Christian Heimes li...@cheimes.de wrote:
 [Philip Semanchuk wrote:]
  Specifically, I'm concerned with binaries created by SWIG for a C++  
  library that our project uses. We'd like to ship precompiled binaries  
  for Linux, OS X and Windows for Python 2.5 and 2.6. I'm hoping that it  
  is sufficient to create binaries for each Python for each platform (3  
  * 2 == 6 total precompiled binaries).
 For each platforms you have to provide binaries for the major CPU
 architectures (X86 and X64_86), too. Users or distributions may compile
 Python with UCS-2 or UCS-4 unicode width. That makes eight different
 binaries for Linux (two version * two archs * UCS2/4). Although most
 distributions follow the LSB standards, binaries aren't necessary ABI
 compatible. C++ binaries tend to break more often than C binaries.

And, on OS X, there are various Python binary distributions in common 
use: the Apple-supplied Pythons (2.5 for OS X 10.5, 2.6  2.5 for 10.6), 
the python.org OS X installers for 10.5 and 10.6, plus the ActiveState 
and EPD ones.  It would likely be difficult to ship one binary extension 
that would easily work, if at all, with the most common ones.  For 
instance, the Apple-supplied Python 2.6 is built with gcc 4.2, uses the 
10.6 ABI (SDK deployment target), and x86_64 / i386 / ppc architectures 
(default 64-bit on capable machines).  The python.org 2.6 uses gcc 4.0, 
the 10.4u ABI, and is 32-bit only (i386 / ppc)

-- 
 Ned Deily,
 n...@acm.org

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


python terminology on classes

2010-07-26 Thread Peng Yu
Hi

I'm still kind of confused about the terminology on classes in python.

Could you please let me know what the equivalent terms for the
following C++ terms?

constructor
destructor
member function
member variable
virtual member function
function

I think that C++ function is equivalent to python function and C++
member function is equivalent to python method. But I couldn't
locate where the original definitions of the corresponding python
terms in the manual as these term appear many times. Could you please
point me where to look for the definition of these python
corresponding terms?

-- 
Regards,
Peng
-- 
http://mail.python.org/mailman/listinfo/python-list


Updating path.py

2010-07-26 Thread Michael Hoffman
I have been using Jason Orendorff's path.py module for a long time. It 
is very useful. The only problem is that Python 2.6 deprecates the md5 
module it imports, so I (and others using my software) now get this 
warning whenever they start, which is a little annoying.


/homes/hoffman/arch/Linux-x86_64/lib/python2.6/path-2.2-py2.6.egg/path.py:32: 
DeprecationWarning: the md5 module is deprecated; use hashlib instead


The original web page is gone, and e-mails to the author have gone 
unanswered. It has a public domain license so I could easily fork it 
and make this small change. The question is what is the best way to do 
that and ensure continuity with the previous versions. Can I (or someone 
else) take over the PyPI entry in question? Other suggestions?


Many thanks,
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list


python styles: why Use spaces around arithmetic operators?

2010-07-26 Thread Peng Yu
This webpage http://www.python.org/dev/peps/pep-0008/ recommends the
following. It looks to me that both styles are fine. Could anybody let
me know what the rationale is behind this recommendation?

- Use spaces around arithmetic operators:

  Yes:

  i = i + 1
  submitted += 1
  x = x * 2 - 1
  hypot2 = x * x + y * y
  c = (a + b) * (a - b)

  No:

  i=i+1
  submitted +=1
  x = x*2 - 1
  hypot2 = x*x + y*y
  c = (a+b) * (a-b)

-- 
Regards,
Peng
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Updating path.py

2010-07-26 Thread Robert Kern

On 7/26/10 5:16 PM, Michael Hoffman wrote:

I have been using Jason Orendorff's path.py module for a long time. It is very
useful. The only problem is that Python 2.6 deprecates the md5 module it
imports, so I (and others using my software) now get this warning whenever they
start, which is a little annoying.

/homes/hoffman/arch/Linux-x86_64/lib/python2.6/path-2.2-py2.6.egg/path.py:32:
DeprecationWarning: the md5 module is deprecated; use hashlib instead

The original web page is gone, and e-mails to the author have gone unanswered.
It has a public domain license so I could easily fork it and make this small
change. The question is what is the best way to do that and ensure continuity
with the previous versions. Can I (or someone else) take over the PyPI entry in
question? Other suggestions?


You cannot take over a project on PyPI. You can only fork the project with a 
new name. In fact, this has already been done:


  http://pypi.python.org/pypi/forked-path/0.1

--
Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

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


Re: python styles: why Use spaces around arithmetic operators?

2010-07-26 Thread Thomas Jollans
On 07/27/2010 12:20 AM, Peng Yu wrote:
 This webpage http://www.python.org/dev/peps/pep-0008/ recommends the
 following. It looks to me that both styles are fine. Could anybody let
 me know what the rationale is behind this recommendation?

Beauty is in the eye of the beholder, even when we call it coding style.

There is no rationale, except if you accept easier to read, looks
better, or that's what Guido has been doing for years.

 
 - Use spaces around arithmetic operators:
 
   Yes:
 
   i = i + 1
   submitted += 1
   x = x * 2 - 1
   hypot2 = x * x + y * y
   c = (a + b) * (a - b)
 
   No:
 
   i=i+1
   submitted +=1
   x = x*2 - 1
   hypot2 = x*x + y*y
   c = (a+b) * (a-b)
 

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


Re: python styles: why Use spaces around arithmetic operators?

2010-07-26 Thread rantingrick
On Jul 26, 5:20 pm, Peng Yu pengyu...@gmail.com wrote:
 This webpagehttp://www.python.org/dev/peps/pep-0008/recommends the
 following. It looks to me that both styles are fine. Could anybody let
 me know what the rationale is behind this recommendation?

The rational is simple. Guido is God and if you don't follow his words
then you will be tortured. His favorite means is by forcing you to
wear Dutch wooden shoes every day whist programming Ruby! ;-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python terminology on classes

2010-07-26 Thread Thomas Jollans
On 07/26/2010 11:52 PM, Peng Yu wrote:
 Hi
 
 I'm still kind of confused about the terminology on classes in python.
 
 Could you please let me know what the equivalent terms for the
 following C++ terms?
 
 constructor

constructor.

This consists of the class constructor method, __new__, and of the
instance initialization method, __init__
In practice, __init__ is really the constructor.
http://docs.python.org/py3k/reference/datamodel.html#object.__new__

 destructor

destructor.

http://docs.python.org/py3k/reference/datamodel.html#object.__del__

 member function

method.
Look for instance method below
URL:http://docs.python.org/py3k/reference/datamodel.html#the-standard-type-hierarchy

 member variable

attribute, instance attribute, instance variable.

 virtual member function

all methods are virtual.

 function

function.


 I think that C++ function is equivalent to python function and C++
 member function is equivalent to python method. But I couldn't
 locate where the original definitions of the corresponding python
 terms in the manual as these term appear many times. Could you please
 point me where to look for the definition of these python
 corresponding terms?

http://docs.python.org/py3k/reference/datamodel.html should answer all
your questions.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python styles: why Use spaces around arithmetic operators?

2010-07-26 Thread Martin P. Hellwig

On 07/27/10 00:06, rantingrick wrote:

On Jul 26, 5:20 pm, Peng Yupengyu...@gmail.com  wrote:

This webpagehttp://www.python.org/dev/peps/pep-0008/recommends the
following. It looks to me that both styles are fine. Could anybody let
me know what the rationale is behind this recommendation?


The rational is simple. Guido is God and if you don't follow his words
then you will be tortured. His favorite means is by forcing you to
wear Dutch wooden shoes every day whist programming Ruby! ;-)


Wat is er mis met klompen?

--
mph

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


Re: Why are String Formatted Queries Considered So Magical?

2010-07-26 Thread Justin Smith
Seeking industry expert candidates

I’m Justin Smith, Director of Tech Recruiting at Express Seattle.  I
am currently seeking candidates to fill Tech Positions for multiple A-
List Clients:
•   Quality Assurance Engineer,
•   Senior Data Engineer, Search Experience
•   Senior Software Development Engineer, UX / UI
•   Software Dev Engineer
•   Software Dev TEST Engineer
•   Software Development Manager,
•   Sr Applications Engineer – Strong Linux Systems Administrator
•   SR Technical PM, -
•   Web Designer/Developer – strong tech and art background
•   Business Analyst,

Many of our Clients work within a Linux environment.  For greatest
impact, on your resume highlight relevant skills and technologies used
in an environment supported by Linux, languages that show you
understand and know object oriented development, have experience with
high volume sites that are notable and are continually learning new
skills.

Hot List that gets our attention – LAMP Stack Experience, Linux, Perl
and Java/JavaScript Experts that are current in the use and show
expertise.  Microsoft environment and dot net technologies are not
added attractors to many of our clients.

If you are interested in these roles, send me your resume, cover
letter highlighting noteworthy skills and projects with expected base
salary to justin.sm...@expresspros.com and I can submit it ASAP.
Justin(dot)Smith(at)ExpressPros(dot)com   DO FEEL FREE TO REFER this
on to a friend or colleague with strong skills as well.

Qualifications:
- Computer Science degree or equivalent work experience (5+ years).
- Expert level fluency in at least one mainstream object-oriented
programming language (C++, Java, Ruby, Python).
- Proven coding skills in C++ and or Java on Unix/Linux platforms is a
must.
- Experience with MySQL or Oracle databases a plus.
- Linux or LAMP Stack experience preferred.
- Experience with HTML5, XML, XSD, WSDL, and SOAP and a history
working with web client software
- Experience with scalable distributed systems is a positive.

Added value attractors if the qualifications are available:
+ Experience with the iPhone SDK and Objective-C. – published app that
is stable, engaging
+ Experience with the BlackBerry SDK and/or J2ME. – published app that
is stable, engaging
+ Experience with the Android SDK. – published app that is stable,
engaging

If you are interested in these roles, send me your resume, cover
letter highlighting noteworthy skills and projects with expected base
salary to justin.sm...@expresspros.com and I can submit it ASAP.
Justin(dot)Smith(at)ExpressPros(dot)com DO FEEL FREE TO REFER this on
to a friend or colleague with strong skills as well.


On Jul 1, 7:18 am, Stephen Hansen me+list/pyt...@ixokai.io wrote:
 On 7/1/10 3:03 AM, Jean-Michel Pichavant wrote:

  Re is part of the python standard library, for some purpose I guess.

 No, *really*?

 So all those people who have been advocating its useless and shouldn't
 be are already too late?

 Damn.

 Well, there goes *that* whole crusade we were all out on. Since we can't
 destroy re, maybe we can go club baby seals.

 --

     ... Stephen Hansen
     ... Also: Ixokai
     ... Mail: me+list/python (AT) ixokai (DOT) io
     ... Blog:http://meh.ixokai.io/

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


Re: python styles: why Use spaces around arithmetic operators?

2010-07-26 Thread rantingrick
 Martin wrote:

 Wat is er mis met klompen?

Well specifically their made from wood and wood is a very hard
substance. Also i did not go into detail but he makes sure to pick
shoes that are three sizes too small. You know a good podiatrist can
be tough to come by in these times. It's a pretty severe punishment if
you ask me.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python terminology on classes

2010-07-26 Thread Rhodri James

On Mon, 26 Jul 2010 22:52:06 +0100, Peng Yu pengyu...@gmail.com wrote:


Hi

I'm still kind of confused about the terminology on classes in python.

Could you please let me know what the equivalent terms for the
following C++ terms?


Seriously, we can't keep doing your thinking for you.  The answers
to all your questions are section 9 of the tutorial.

--
Rhodri James *-* Wildebeeste Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: python terminology on classes

2010-07-26 Thread Tim Chase

On 07/26/10 18:15, Thomas Jollans wrote:

destructor


http://docs.python.org/py3k/reference/datamodel.html#object.__del__


One small caveat -- IIRC, in Java/C++ the destructor is 
guaranteed to be called with a certain amount of context.  I find 
Python's __del__ almost useless since things it may rely upon can 
arbitrarily be destroyed before the __del__ is called.


-tkc




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


Re: python styles: why Use spaces around arithmetic operators?

2010-07-26 Thread Steven D'Aprano
On Mon, 26 Jul 2010 17:20:09 -0500, Peng Yu wrote:

 This webpage http://www.python.org/dev/peps/pep-0008/ recommends the
 following. It looks to me that both styles are fine. Could anybody let
 me know what the rationale is behind this recommendation?
 
 - Use spaces around arithmetic operators:

Because it looks better and is easier to read. Operators are small 
(single characters) and sometimes need space around them to stand out.

   i=i+1

See? It's hideously ugly and cramped. It's much worse if you use larger 
names:

sensiblynamedvariable=sensiblynamedvariable+1

But use your common sense. I usually group powers, multiplications and 
divisions, and separate additions and subtractions:

y = 2*x + 1 - (3*x - 4/(2 + x**2))**-2

And unary + and - operators should always be grouped with their operand:

y = -2  # not - 2



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


How to capture all the environment variables from shell?

2010-07-26 Thread Peng Yu
Hi,

R_HOME is set in my shell (bash). But os.environ doesn't have it. I'm
not sure what it does when os module is imported. But it seems that
os.environ doesn't capture all the environment variable from the
shell. Could anybody let me know what is the correct way to inherent
all the environment variables form the shell?

$ echo $R_HOME
/opt/R-2.11.1
$ cat main.py
#!/usr/bin/env python

import os

print os.environ['R_HOME']
$ ./main.py
Traceback (most recent call last):
  File ./main.py, line 5, in module
print os.environ['R_HOME']
  File /opt/Python-2.6.5/lib/python2.6/UserDict.py, line 22, in __getitem__
raise KeyError(key)
KeyError: 'R_HOME'

-- 
Regards,
Peng
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to capture all the environment variables from shell?

2010-07-26 Thread Chris Rebert
On Mon, Jul 26, 2010 at 4:36 PM, Peng Yu pengyu...@gmail.com wrote:
 Hi,

 R_HOME is set in my shell (bash). But os.environ doesn't have it. I'm
 not sure what it does when os module is imported. But it seems that
 os.environ doesn't capture all the environment variable from the
 shell. Could anybody let me know what is the correct way to inherent
 all the environment variables form the shell?

 $ echo $R_HOME
 /opt/R-2.11.1
 $ cat main.py
 #!/usr/bin/env python

 import os

 print os.environ['R_HOME']
 $ ./main.py
 Traceback (most recent call last):
  File ./main.py, line 5, in module
    print os.environ['R_HOME']
  File /opt/Python-2.6.5/lib/python2.6/UserDict.py, line 22, in __getitem__
    raise KeyError(key)
 KeyError: 'R_HOME'

You need to export R_HOME in bash (probably in your .bashrc or
.bash_profile). See
http://www.ibm.com/developerworks/library/l-bash.html#N10074

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to capture all the environment variables from shell?

2010-07-26 Thread Rhodri James

On Tue, 27 Jul 2010 00:36:12 +0100, Peng Yu pengyu...@gmail.com wrote:


R_HOME is set in my shell (bash). But os.environ doesn't have it. I'm
not sure what it does when os module is imported. But it seems that
os.environ doesn't capture all the environment variable from the
shell. Could anybody let me know what is the correct way to inherent
all the environment variables form the shell?


os.environ does capture all the environment that the shell passes to it.
In this case, you haven't exported R_HOME, so the shell doesn't export
it, so os.environ has no chance to capture it.

rho...@gnudebst:~$ HELLO=world
rho...@gnudebst:~$ echo $HELLO
world
rho...@gnudebst:~$ export HELLO
rho...@gnudebst:~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.

import os
os.environ['HELLO']

'world'


--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: python terminology on classes

2010-07-26 Thread Steven D'Aprano
On Mon, 26 Jul 2010 16:52:06 -0500, Peng Yu wrote:

 Could you please let me know what the equivalent terms for the following
 C++ terms?
 
 constructor
 destructor
 member function
 member variable
 virtual member function
 function


(1) Python new-style classes have a constructor __new__ and an 
initialiser __init__. Some people describe both as constructors, but 
that's strictly incorrect because the instance has already been 
constructed by the time __init__ is called. (Old-style classes don't have 
__new__, only __init__.)

(2) Python destructors are called __del__ , but you shouldn't use them 
unless you really know what you are doing.

(3) Member functions are methods.

(4) Member variables are attributes. If you have to distinguish between 
attributes which live on the instance from one that lives on the class, 
instance attribute and class attribute.

(5) I believe that all methods in Python are virtual.

(6) Function.


 I think that C++ function is equivalent to python function and C++
 member function is equivalent to python method. But I couldn't
 locate where the original definitions of the corresponding python terms
 in the manual as these term appear many times. Could you please point me
 where to look for the definition of these python corresponding terms?

I believe you are right, but I can't find a definition of C++ member 
function that makes sense. Can you please point me where to look for the 
definition of these C++ terms?

I don't believe the Python Language Reference explicitly defines terms 
such as attribute and method, but the tutorial may help:

http://docs.python.org/tutorial/classes.html

Quote:
In C++ terminology, all class members (including the data members)
are public, and all member functions are virtual.


Note: although the docs occasionally use the term members for 
attributes, it is considered more standard to use attribute or method 
unless discussing data types defined at the C layer.


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


Re: How to capture all the environment variables from shell?

2010-07-26 Thread Cameron Simpson
On 26Jul2010 18:36, Peng Yu pengyu...@gmail.com wrote:
| R_HOME is set in my shell (bash). But os.environ doesn't have it. I'm
| not sure what it does when os module is imported. But it seems that
| os.environ doesn't capture all the environment variable from the
| shell. Could anybody let me know what is the correct way to inherent
| all the environment variables form the shell?
| 
| $ echo $R_HOME
| /opt/R-2.11.1
| $ cat main.py
| #!/usr/bin/env python
| 
| import os
| 
| print os.environ['R_HOME']
| $ ./main.py
| Traceback (most recent call last):
|   File ./main.py, line 5, in module
| print os.environ['R_HOME']
|   File /opt/Python-2.6.5/lib/python2.6/UserDict.py, line 22, in __getitem__
| raise KeyError(key)
| KeyError: 'R_HOME'

Sounds like R_HOME is not exported.

Try these in your shell:

  set | grep R_HOME
  export | grep R_HOME

Then, presuming it shows only in the first command:

  export R_HOME

and then try your python script again.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

It is an approved maxim in war, never to do what the enemy wishes you to
do, for this reason alone, that he desires it.  - Napoleon
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python terminology on classes

2010-07-26 Thread Steven D'Aprano
On Tue, 27 Jul 2010 01:15:08 +0200, Thomas Jollans wrote:

 http://docs.python.org/py3k/reference/datamodel.html should answer all
 your questions.

It should, but as far as I can tell it doesn't. If it defines attribute 
or method, I can't find it.



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


Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-26 Thread Raymond Hettinger
[Ethan Furman]
 Speaking of new-style classes only, don't they all end in object?  And
 if the MRO is only known at run-time, how is one to know at code-time
 whether your (new-style) class is at the end of the line?

That is a bit of a PITA.  One way of handling it is to design your
diamond so that only one class inherits from object and that class
doesn't use super().   Or you can wrap the super call in a try/except
AttributeError.

Cooperative multiple inheritance isn't pretty -- which is just another
good reason to use composition rather that inheritance.


Raymond

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


Re: python styles: why Use spaces around arithmetic operators?

2010-07-26 Thread geremy condra
On Mon, Jul 26, 2010 at 4:31 PM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
 On Mon, 26 Jul 2010 17:20:09 -0500, Peng Yu wrote:

 This webpage http://www.python.org/dev/peps/pep-0008/ recommends the
 following. It looks to me that both styles are fine. Could anybody let
 me know what the rationale is behind this recommendation?

     - Use spaces around arithmetic operators:

 Because it looks better and is easier to read. Operators are small
 (single characters) and sometimes need space around them to stand out.

           i=i+1

 See? It's hideously ugly and cramped. It's much worse if you use larger
 names:

 sensiblynamedvariable=sensiblynamedvariable+1

 But use your common sense. I usually group powers, multiplications and
 divisions, and separate additions and subtractions:

 y = 2*x + 1 - (3*x - 4/(2 + x**2))**-2

 And unary + and - operators should always be grouped with their operand:

 y = -2  # not - 2

This is the rule that I use, with the exception that I will generally
explicitly parenthesize the numerator in a division, since my eyes
frequently gloss over the / symbol for some reason.

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


Re: How to capture all the environment variables from shell?

2010-07-26 Thread Steven W. Orr
On 07/26/10 20:02, quoth Chris Rebert:
 On Mon, Jul 26, 2010 at 4:36 PM, Peng Yu pengyu...@gmail.com wrote:
 
 You need to export R_HOME in bash (probably in your .bashrc or
 .bash_profile). See
 http://www.ibm.com/developerworks/library/l-bash.html#N10074

Please! Never export anything from your .bashrc unless you really know what
you're doing. Almost all exports should be done in your .bash_profile

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python styles: why Use spaces around arithmetic operators?

2010-07-26 Thread Stephen Hansen
On 7/26/10 3:20 PM, Peng Yu wrote:
 This webpage http://www.python.org/dev/peps/pep-0008/ recommends the
 following. It looks to me that both styles are fine. Could anybody let
 me know what the rationale is behind this recommendation?

PEP8 is a style guide. Parts of style guides are rational judgements and
decisions based on experience and can certainly be explained or
justified, but parts are just... personal taste. Style is part rational
thought and part intuition, and in the latter -- people will disagree
quite a bit. There's no right or wrong there. There isn't always a
rationale.

Guido finds x=a+1 less readable then x = a + 1. Originally he wrote
this down with other anecdotal little tidbits up into an eassy and
posted it on the python.org website. Eventually, others decided that his
intuitive sense of style actually tended to be rather spot on for them
too (why wouldn't it, since that same sense of style brought Python into
existence and most of us quite like it), and so that guide and some
others were codified into PEP8, and tweaked from time to time.

PEP8 is only a rule for the stdlib, and only for new code in the
stdlib at that -- and its only really a rule to encourage consistency
and maintainability, not because its objectively The Right Way To Code.

Personally, while I agree with much of it, I disagree in several points
and ignore PEP8 whenever it suits me (most notably on line length rules,
and for a long time on methodNamingSchemes, but lately I've found I'm
coming_around).

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/



signature.asc
Description: OpenPGP digital signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Python 2.7 for Windows: Same version of MS VC runtime as Python 2.6?

2010-07-26 Thread python
Python 2.7 for Windows: Does Python 2.7 for Windows use the same
version of the MS VC runtime as Python 2.6?

Thank you,
Malcolm
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to capture all the environment variables from shell?

2010-07-26 Thread Tim Chase

On 07/26/10 21:26, Steven W. Orr wrote:

Please! Never export anything from your .bashrc unless you
really know what you're doing. Almost all exports should be
done in your .bash_profile


Could you elaborate on your reasoning why (or why-not)?  I've 
found that my .bash_profile doesn't get evaluated when I crank up 
another terminal window, while my bashrc does.  Thus I tend to 
put my exports in my ~/.bashrc so they actually take effect in my 
shell...


-tkc



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


Re: How to capture all the environment variables from shell?

2010-07-26 Thread Steven D'Aprano
On Mon, 26 Jul 2010 22:26:27 -0400, Steven W. Orr wrote:

 Please! Never export anything from your .bashrc unless you really know
 what you're doing. Almost all exports should be done in your
 .bash_profile

Would you like to explain why, or should we just trust you?


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


Re: Why are String Formatted Queries Considered So Magical?

2010-07-26 Thread Ben Finney
Justin Smith justin2009sm...@gmail.com writes:

 Seeking industry expert candidates

Please don't reply in an existing thread with an unrelated message. If
you want to start a new discussion, compose a new message, not a reply.

For job advertisements, please don't use this forum at all; instead use
the Python Jobs Board URL:http://www.python.org/community/jobs/.

-- 
 \  “We are stuck with technology when what we really want is just |
  `\ stuff that works.” —Douglas Adams |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


Personal archive tool, looking for suggestions on improving the code

2010-07-26 Thread mo reina
 0  down vote  favorite


i've written a tool in python where you enter a title, content, then
tags, and the entry is then saved in a pickle file. it was mainly
designed for copy-paste functionality (you spot a piece of code you
like on the net, copy it, and paste it into the program), not really
for handwritten content, though it does that with no problem.

i mainly did it because i'm always scanning through my pdf files,
books, or the net for some coding example of solution that i'd already
seen before, and it just seemed logical to have something where you
could just put the content in, give it a title and tags, and just look
it up whenever you needed to.

i realize there are sites online that handle this ex. http://snippets.dzone.com,
but i'm not always online when i code. i also admit that i didn't
really look to see if anyone had written a desktop app, the project
seemed like a fun thing to do so here i am.

it wasn't designed with millions of entries in mind, so i just use a
pickle file to serialize the data instead of one of the database APIs.
the query is also very basic, only title and tags and no ranking based
on the query.

there is an issue that i can't figure out, when you are at the list of
entries there's a try, except clause where it tries to catch a valid
index (integer). if you enter an inavlid integer, it will ask you to
enter a valid one, but it doesn't seem to be able to assign it to the
variable. if you enter a valid integer straightaway, there are no
problems and the entry will display.

anyway let me know what you guys think. this is coded for python3.

main file:

#!usr/bin/python

from archive_functions import Entry, choices, print_choice,
entry_query
import os

def main():
choice = ''
while choice != 5:
os.system('clear')
print(Mo's Archive, please select an option)
print('')
print('1. Enter an entry')
print('2. Lookup an entry')
print('3. Display all entries')
print('4. Delete an entry')
print('5. Quit')
print('')
choice = input(':')

if choice == 1:
entry = Entry()
entry.get_data()
entry.save_data()

elif choice == 2:
queryset = input('Enter title or tag query: ')
result = entry_query('entry.pickle', queryset)
if result:
print_choice(result, choices(result))
else:
os.system('clear')
print('No Match! Please try another query')
pause = input('\npress [Enter] to continue...')

elif choice == 3:
queryset = 'all'
result = entry_query('entry.pickle', queryset)
if result:
print_choice(result, choices(result))

elif choice == 4:
queryset = input('Enter title or tag query: ')
result = entry_query('entry.pickle', queryset)
if result:
entry = result[choices(result)]
entry.del_data()
else:
os.system('clear')
print('No Match! Please try another query')
pause = input('\npress [Enter] to continue...')

elif choice == 5:
break

else:
input('please enter a valid choice...')
main()

if __name__ == __main__:
main()

archive_functions.py:

#!/bin/usr/python
import sys
import pickle
import os
import re

class Entry():
def get_data(self):
self.title = input('enter a title: ')
print('enter the code, press ctrl-d to end: ')
self.code = sys.stdin.readlines()
self.tags = input('enter tags: ')

def save_data(self):
with open('entry.pickle', 'ab') as f:
pickle.dump(self, f)

def del_data(self):
with open('entry.pickle', 'rb') as f:
data_list = []
while True:
try:
entry = pickle.load(f)
if self.title == entry.title:
continue
data_list.append(entry)
except:
break
with open('entry.pickle', 'wb') as f:
pass
with open('entry.pickle', 'ab') as f:
for data in data_list:
data.save_data()

def entry_query(file, queryset):
'''returns a list of objects matching the query'''
result = []
try:
with open(file, 'rb') as f:
   entry = pickle.load(f)
   os.system('clear')
   if queryset == all:
   while True:
   try:
   result.append(entry)
   entry = pickle.load(f)
   except:
   return result
   break
   while True:
try:
if re.search(queryset, entry.title) or
re.search(queryset, entry.tags):
 

Re: why is this group being spammed?

2010-07-26 Thread Mithrandir

On 07/18/2010 03:58 PM, Edward A. Falk wrote:

In article334170d5-a336-4506-bda1-279b40908...@k1g2000prl.googlegroups.com,
be.krulbe.k...@gmail.com  wrote:

why is this group being spammed?


They're *all* being spammed.  Why?  Because they can, and because Google
doesn't care.



Not only does Google not care, but they've made Usenet more accessible 
to the general public. How is that bad? You go back in time, before 
Google bought out Deja News, and ask the average Tom, Dick, or Harry if 
they knew what Usenet was. Their response probably would have been No 
or Maybe... or Isn't that dead? Now more people know about Usenet 
and don't have to go through the hassle of finding a free server (or 
paying), getting a reliable newsreader (Thunderbird, XNews, etc.), and 
learning posting COME TO MY WEBSITE!!111!! anywhere (except misc.test) 
will get you mocked and ridiculed. ;)


Now there's nothing wrong with making a newsserver publicly available 
and free, but when you maintain it like a throw-away blog, allowing 
child porn, spam, et al., you might as well kiss customer trust goodbye.


Welcome to the Age of Google! :)

A nice little page that I found that, unfortunately, is dead, has some 
info on Google Groups: 
http://web.archive.org/web/20080124152054/http://improve-usenet.org/


--
People should read more.
https://secure.wikimedia.org/wikipedia/en/wiki/User:MithrandirAgain
All that is gold does not glitter,
not all those who wander are lost;
the old that is strong does not wither,
deep roots are not reached by the frost.
From the ashes a fire shall be woken,
a light from the shadows shall spring;
renewed shall be blade that was broken,
the crownless again shall be king.
--
http://mail.python.org/mailman/listinfo/python-list


[issue7567] Messed up terminal after calling curses.initscr() twice.

2010-07-26 Thread Matthias Klose

Matthias Klose d...@debian.org added the comment:

shouldn't `initialised_setupterm' be tested instead?

--
nosy: +doko

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7567
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9381] syntax error in Unicode C API docs

2010-07-26 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

Thanks, fixed in r83160.

--
nosy: +georg.brandl
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9381
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9259] Python 2.7 breaks assigned __exit__s

2010-07-26 Thread Dave Malcolm

Changes by Dave Malcolm dmalc...@redhat.com:


--
nosy: +dmalcolm

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9259
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2010-07-26 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +ezio.melotti, haypo, lemburg, loewis

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9377
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9382] os.popen referenced but not documented in Python 3.x

2010-07-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

(D) in python 3, os.popen has been reimplemented using subprocess.Popen.
So the other mentions of os.popen should probably be replaced with mentions of 
subprocess.Popen.

Your (C) is close...the continued existence of os.popen in Python3 is, I think, 
a bit of a kludge (I wasn't around for the discussion), but a backward 
compatibility one.  I don't know if there is a plan to deprecate it, but I 
suspect not.  On the other hand I certainly wouldn't recommend using it, since 
it does an import inside the function, which can get one into trouble if one 
uses threads.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9382
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9167] argv double encoding on OSX

2010-07-26 Thread Daniele Varrazzo

Daniele Varrazzo p...@develer.com added the comment:

Ronald,

Thank you for the interest. For me trying to deal with such a tricky issue on a 
system whose Best Before date is already passed would be a waste of time.

I was only interested in factor out the bugs in my extension module from the 
ones not under my responsibility and I had the bad luck to find a 10.4 to test 
on. I don't have a direct interest in this bug to be fixed.

Thank you very much again for your time.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9167
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4147] xml.dom.minidom toprettyxml: omit whitespace for text-only elements

2010-07-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

@Thomas: could you provide a unit test to go with your patch.

--
nosy: +BreamoreBoy
stage:  - unit test needed
versions: +Python 3.2 -Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4147
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1813] Codec lookup failing under turkish locale

2010-07-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

Does anyone know if this was discussed on python-dev?  I've tried searching the 
archives and didn't find anything, but that's not to say it isn't there.

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1813
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7637] Improve 19.5. xml.dom.minidom doc

2010-07-26 Thread A.M. Kuchling

A.M. Kuchling li...@amk.ca added the comment:

Thanks for the catch; it was intended to be ', avoiding ...'.  Fixed in 
rev83162, along with the sentence simplification you suggest.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7637
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1886] Permit to easily use distutils --formats=tar, gztar, bztar on all systems

2010-07-26 Thread A.M. Kuchling

Changes by A.M. Kuchling li...@amk.ca:


--
assignee: akuchling - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1886
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3075] make minidom.toxml() encoding argument useful

2010-07-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

This is how toprettyxml looks in 3.1/2 which seems to meet the OP's need, I'll 
close in a few days time unless someone objects.

def toprettyxml(self, indent=\t, newl=\n, encoding=None):
# indent = the indentation string to prepend, per level
# newl = the newline string to append
use_encoding = utf-8 if encoding is None else encoding
writer = codecs.getwriter(use_encoding)(io.BytesIO())
if self.nodeType == Node.DOCUMENT_NODE:
# Can pass encoding only to document, to put it into XML header
self.writexml(writer, , indent, newl, encoding)
else:
self.writexml(writer, , indent, newl)
if encoding is None:
return writer.stream.getvalue().decode(use_encoding)
else:
return writer.stream.getvalue()

--
nosy: +BreamoreBoy
status: open - pending

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3075
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1767933] Badly formed XML using etree and utf-16

2010-07-26 Thread Richard Urwin

Richard Urwin soron...@googlemail.com added the comment:

I can't produce an automated test, for want of time, but here is a demonstrator.

Grab the example XHTML from 
http://docs.python.org/library/xml.etree.elementtree.html#elementtree-objects 
or use some tiny ASCII-encoded xml file. Save it as file.xml in the same 
folder as bug-test.py attached here.

Execute bug-test.xml

file.xml is read and then written in UTF-16. The output file is then read and 
dumped to stdout as a byte-stream.

1. To be correct UTF-16, the output should start with 255 254, which should 
never occur in the rest of the file.

2. The rest of the output (including the first line) should alternate zeros 
with ASCII character codes.

3. The file output.xml should be loadable in a UTF16-capable text editor (eg 
jEdit), be recognised as UTF-16 and be identical in terms of content to file.xml

--
nosy: +Richard.Urwin
Added file: http://bugs.python.org/file18211/bug-test.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1767933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-26 Thread Ray.Allen

Ray.Allen ysj@gmail.com added the comment:

Oh, I'm sorry, I forgot about that case. 

I agree with Arfrever, we should suppress the OSError only if the target file 
exists as a directory, but not other types. That is, the exist_ok argument in 
makedirs() should mean dir existing is ok, only existing of the exact same 
thing as we specified to create is ok, not other things. I will fixed this 
later. 

Besides, I wonder what should we do if the target directory exists but with a 
different mode than we specified(if we specified the mode argument). I guess 
we should also raise the OSError because the existing thing is not the same as 
what we want.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9376] Refer to gnuwin32 diff util on development FAQ

2010-07-26 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

There is diff.py utility that is already available from standard Python 
distribution.

--
nosy: +techtonik

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9376
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1767933] Badly formed XML using etree and utf-16

2010-07-26 Thread Richard Urwin

Richard Urwin soron...@googlemail.com added the comment:

 Execute bug-test.xml

I meant bug-test.py, of course

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1767933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9299] os.makedirs(): Add a keyword argument to suppress File exists exception

2010-07-26 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com added the comment:

Alternatively you could call os.chmod.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9299
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4686] Exceptions in ConfigParser don't set .args

2010-07-26 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

Patch doesn't apply cleanly to 3.1 or earlier. As it is *arguably* a new 
feature rather than a bugfix I'm closing the issue.

I certainly wouldn't argue against someone else backporting though...

--
stage: commit review - committed/rejected
status: open - closed
versions:  -Python 2.6, Python 2.7, Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4686
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1682942] ConfigParser support for alt delimiters

2010-07-26 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

This would change the format of config files that configparser supports. Should 
there be some discussion of this on python-dev first?

The patch for the docs is against the latex docs, so definitely needs updating.

--
nosy: +michael.foord

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1682942
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4510] ValueError for list.remove() not very helpful

2010-07-26 Thread Tim Lesher

Tim Lesher tles...@gmail.com added the comment:

Ugh.  That's a reasonable objection.

What's the best thing to do in this case, generally speaking?

list.index() does print the full repr on a value error; and a quick grep shows 
a number of other similar uses, although those don't seem to be as easy to 
trigger inadvertently.

Should this feature be removed from list.index as well?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4510
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5412] extend configparser to support [] syntax

2010-07-26 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

There are no docs or tests in the patch. I like the functionality though and 
doubt it will be controversial. The current api is a bit arcane. So +1 from 
me.

--
nosy: +michael.foord

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5412
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6517] configparser: add possibility to escape formatstrings

2010-07-26 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

This should just be applied. I'll do it shortly unless there is an objection.

--
nosy: +michael.foord

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6517
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9362] Make exit/quit hint more novice friendly

2010-07-26 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

On Fri, Jul 23, 2010 at 10:24 PM, Alexander Belopolsky
rep...@bugs.python.org wrote:
 I suggest changing

 Use exit() or Ctrl-D (i.e. EOF) to exit

  to

 Type exit() or quit() and press the Enter key to exit

Type exit() or press Ctrl-D to exit.

--
nosy: +techtonik

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9362
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9362] Make exit/quit hint more novice friendly

2010-07-26 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

+1 to improving the message and improving the help message too.

--
nosy: +michael.foord

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9362
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6517] configparser: add possibility to escape formatstrings

2010-07-26 Thread Michael Foord

Michael Foord mich...@voidspace.org.uk added the comment:

It is (very) unfortunate that configparser.ConfigParser should *not* be used 
and that configparser.SafeConfigParser is the correct class instead.

I would be *in favour* of deprecating ConfigParser and eventually renaming 
SafeConfigParser back to ConfigParser (leaving SafeConfigParser as an alias).

Now that deprecation warnings are silent by default this should be less of an 
issue.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6517
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9376] Refer to gnuwin32 diff util on development FAQ

2010-07-26 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

I don't think we should have a list of three alternatives to the single way you 
really should be creating diffs. If you are working on Python you should have 
Subversion and run svn diff, or have Mercurual and run hg diff.

I guess I'm -0 on this idea. I also don't even know where the dev/faq page is 
located in SVN to make any potential change.

--
nosy: +brian.curtin

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9376
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9376] Refer to gnuwin32 diff util on development FAQ

2010-07-26 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

The better way would be
 python -m easy_install review
 python -m review

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9376
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9376] Refer to gnuwin32 diff util on development FAQ

2010-07-26 Thread Brian Curtin

Brian Curtin cur...@acm.org added the comment:

Until Rietveld has a defined place in our workflow, I don't think that's a good 
idea.

I think that will be a part of the process in the future, but we're not 
defining that here.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9376
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9362] Make exit/quit hint more novice friendly

2010-07-26 Thread Alexander Belopolsky

Alexander Belopolsky belopol...@users.sourceforge.net added the comment:

On Mon, Jul 26, 2010 at 9:48 AM, anatoly techtonik
rep...@bugs.python.org wrote:
..
 Type exit() or press Ctrl-D to exit.

Anatoly,

I think you missed the point of the story that I posted.  The young
user, who was not completely new to computers, by the way, was not
familiar with Ctrl  abbreviation and there was no key marked that
way on his keyboard.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9362
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2010-07-26 Thread Dirk Jülich

Dirk Jülich mucisl...@web.de added the comment:

Applies also to Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 
bit (Intel)] on win32.

--
nosy: +mucisland
versions: +Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6074
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9362] Make exit/quit hint more novice friendly

2010-07-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

1) I'm with Michael on this one.
2) Python is not responsible for dotting every i and crossing every t for a 
computer novice.  What would the novice make of my HP keyboard which doesn't 
have keys marked RETURN or BS, they both have symbols.  There isn't an ANY key 
on the keyboard either! :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9362
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6517] configparser: add possibility to escape formatstrings

2010-07-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

You are right, IMO, at least the current doc patch should be applied.  Please 
go ahead, if you want to, I won't have time to get to it for a couple of days.

Maybe you could come up with a new title for this issue that reflects the 
concerns being addressed here...

--
assignee: r.david.murray - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6517
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9376] Refer to gnuwin32 diff util on development FAQ

2010-07-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

I believe that the switch to mercurial is months if not years away, so I'd 
quite happily see just a reference to svn diff.  Failing that I wouldn't loose 
any sleep over closing this, ok to leave it with you Brian?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9376
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9383] PIL Bug with split

2010-07-26 Thread Arrnaud Fabre

New submission from Arrnaud Fabre arnaud...@gmail.com:

 import Image
 im = Image.open('whatever')
 im.split()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.6/dist-packages/PIL/Image.py, line 1497, in split
if self.im.bands == 1:
AttributeError: 'NoneType' object has no attribute 'bands'

Bug can be fixed by using getdata before split() :

 import Image
 im = Image.open('whatever')
 im.getdata()
ImagingCore object at 0x7fad913c0090
 im.split()
(Image.Image image mode=L size=360x480 at 0x1CAE320, Image.Image image 
mode=L size=360x480 at 0x1CAE368, Image.Image image mode=L size=360x480 at 
0x1CAE3B0)

--
messages: 111630
nosy: Arrnaud.Fabre
priority: normal
severity: normal
status: open
title: PIL Bug with split
type: crash
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9383
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1767933] Badly formed XML using etree and utf-16

2010-07-26 Thread Mark Lawrence

Mark Lawrence breamore...@yahoo.co.uk added the comment:

@Florent: is this something you could pick up, I think it's out of my league.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1767933
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9376] Refer to gnuwin32 diff util on development FAQ

2010-07-26 Thread anatoly techtonik

anatoly techtonik techto...@gmail.com added the comment:

 Brian Curtin cur...@acm.org added the comment:

 Until Rietveld has a defined place in our workflow, I don't think that's a 
 good idea.

1. AFAIK Python don't have any workflow. Do you speak about your own workflow?
2. What conditions should become True for you to think that's a good
idea? I.e. fill the blanks:
if ... and ... and ...:
  debug(Rietveld has a defined place in out workflow)
  good_idea = True

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9376
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >