Re: python time

2011-03-21 Thread Ulrich Eckhardt
ecu_jon wrote:
> import time,os,string,getpass,md5,ConfigParser
> from time import strftime,localtime


You are importing the time module first, then import some symbols from the 
time module. This seems redundant to me. Note that after the "import 
time", the name "time" refers to the module you imported...

> time = config.get("myvars", "time")

...but after this line it refers to something else, because you rebound it 
to the object returned by "config.get(...)".

> #print "date is ",date , " time is ",time
> a=1
> while a>0:

Note: PEP8 actually say you shall use spaces around operators here.

> #import time

You're on the right track...

> time.sleep(2)

...because this time here doesn't refer to the time module but to the 
output of "config.get(...)"! This object is a string object (type "str"), 
and Python complains:

> AttributeError: 'str' object has no attribute 'sleep'


I Hope that clarifies something! ;)

Uli


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


Re: os.walk/list

2011-03-21 Thread Peter Otten
ecu_jon wrote:

> yes i agree breaking stuff into smaller chunks is a good way to do it.
> even were i to do something like
> 
> def safe_copy()
> f1=file(files ,'rb')
> f2 = file(os.path.join(currentdir,fname,files))
> truth = md5.new(f1.read()).digest() ==
> md5.new(f2.read()).digest()
> if truth == 0:
> print "file copy error"
> 
> that would probably work for the single file copy functions. but would
> still breakdown during the for ...os.walk(), again because "fname" is
> a list there, and the crypto functions work 1 file at a time. even
> changing crypto functions wouldn't change that.

That's what function parameters are for:

def safe_copy(fname):
 

for x in fname:
safe_copy(x)

That way fname is a filename inside safe_copy() and a list of filenames on 
the global module level. "fname" for a list and "files" for a single file 
are still badly chosen names because they confuse the reader instead of 
clarifying what's going on.

I strongly recommend that you work through a python tutorial for non-
programmers before you continue with your efforts.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Use cookies from a script in a browser

2011-03-21 Thread Rafael Durán Castañeda
I think 
thiscould
help you

2011/3/18 gervaz 

> On 18 Mar, 22:52, Miki Tebeka  wrote:
> > You can use mechanize, which holds a cookie jar and can user the browser
> cookies as well.
>
> I use:
> opener =
> urllib.request.build_opener(urllib.request.HTTPCookieProcessor())
> urllib.request.install_opener(opener)
> I start scraping from http://page.com/home.html that need the cookies
> enabled, then, once I found what I was looking for, I've got
> http://page.com/pageX.html and http://page.com/pageY.html. Those page
> cannot be viewed if I just copy & paste the url in the browser,
> because they need the cookies.
>
> What can I do?
>
> Thanks,
> Mattia
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


os.stat bug?

2011-03-21 Thread Laszlo Nagy


  Hi All,

I have a Python program that goes up to 100% CPU. Just like this (top):

  PID USERNAME   THR PRI NICE   SIZERES STATE   C   TIME   WCPU 
COMMAND
80212 user1   2  440 70520K 16212K select  1   0:30 100.00% 
/usr/local/bin/python process_updates_ss_od.py -l 10


I have added extra logs and it turns out that there are two threads. One 
thread is calling "time.sleep()" and the other is calling "os.stat" 
call. (Actually it is calling os.path.isfile, but I hunted down the last 
link in the chain.) The most interesting thing is that the process is in 
"SELECT" state. As far as I know, CPU load should be 0% because "select" 
state should block program execution until the I/O completes.


I must also tell you that the os.stat call is taking long because this 
system has about 7 million files on a slow disk. It would be normal for 
an os.stat call to return after 10 seconds. I have no problem with that. 
But I think that the 100% CPU is not acceptable. I guess that the code 
is running in kernel mode. I think this because I can send a KILL signal 
to it and the state changes to the following:



  PID USERNAME   THR PRI NICE   SIZERES STATE   C   TIME   WCPU 
COMMAND
80212 user1   2  440 70520K 15256K STOP5   1:27 100.00% 
/usr/local/bin/python process_updates_ss_od.py -l 10


So the state of the process changes to "STOP", but the program does not 
stop until the os.stat call returns back (sometimes for 30 seconds).


Could it be a problem with the operation system? Is it possible that an 
os.stat call requires 100% CPU power from the OS? Or is it a problem 
with the Python implementation?


(Unfortunately I cannot give you an example program. Giving an example 
would require giving you a slow I/O device with millions of files on it.)


OS version: FreeBSD 8.1-STABLE amd64
Python version: 2.6.6

Thanks,

   Laszlo


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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


Re: os.stat bug?

2011-03-21 Thread Christian Heimes
Am 21.03.2011 09:32, schrieb Laszlo Nagy:
> I must also tell you that the os.stat call is taking long because this 
> system has about 7 million files on a slow disk. It would be normal for 
> an os.stat call to return after 10 seconds. I have no problem with that. 
> But I think that the 100% CPU is not acceptable. I guess that the code 
> is running in kernel mode. I think this because I can send a KILL signal 
> to it and the state changes to the following:

What's your operating system and file system? A better file system or
system setting may increase your performance a lot. XFS or ext3 / ext4
with hashed directory index increases the file lookup part from O(n) to
O(1).

> Could it be a problem with the operation system? Is it possible that an 
> os.stat call requires 100% CPU power from the OS? Or is it a problem 
> with the Python implementation?

It's mostly likely a problem with the OS, hardware and/or your
configuration. Python doesn't come with its own stat() implementation.
os.stat() just wraps the libc's stat() function. The heavy lifting is
done inside libc and the kernel.

Christian

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


Proxy authentication required

2011-03-21 Thread gervaz
Hi all,
I've got to download some web pages but I'm behind a proxy. So far
this is what I've used without any successful result receiving the
error: "urllib.error.HTTPError: HTTP Error 407: Proxy Authentication
Required ( The ISA Server requires auth
orization to fulfill the request. Access to the Web Proxy filter is
denied.  )":

hc = urllib.request.HTTPCookieProcessor()
hp = urllib.request.ProxyHandler({"http": "10.242.38.251:80",
"username": "domain\username", "password": "password"})
opener = urllib.request.build_opener(hc, hp)
urllib.request.urlopen("http://www.google.it/";)

Any suggestion?

Thanks,

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


Re: os.utime

2011-03-21 Thread Christian Heimes
Am 21.03.2011 03:32, schrieb Dan Stromberg:
> Well, it is, and it's not.  It was originally called "creation time", but
> many today find "change time" a better description of what it actually does,
> sort of retroactively changing what the "c" means.  This is because the
> ctime reflects the change time of an inode, not of the file's content - but
> most people don't really care what an inode is.  Sometimes that's the same
> as the time at which the file was created, but it doesn't necessarily remain
> so throughout the file's lifetime.

You really seemed to know what you are talking about. :)

I'm sorry if I offended you in any way. I had to clarify the meaning of
st_ctime many times in the past because people confused it for the
creation ts of the file.

For instance this confusing has lead to a confusing bug in our code base
a while ago. After I fixed the ownership of a bunch of files, the ctime
was newer than the mtime. A library couldn't handle that and we got
ourself a nice exception.

Christian

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


Re: os.stat bug?

2011-03-21 Thread Martin v. Loewis
> Could it be a problem with the operation system? Is it possible that an
> os.stat call requires 100% CPU power from the OS? Or is it a problem
> with the Python implementation?

There is a chance that the CPU usage actually comes from the thread
doing sleep(). If you have a very short sleep time, and a loop around
it, it may spin in this loop.

If it's not that, and if it's not any other unrelated application that
uses CPU that you didn't mention, then chances are high that it's indeed
the file system code of your operating system that consumes that much
CPU time.

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


Re: class error

2011-03-21 Thread Jean-Michel Pichavant

monkeys paw wrote:


OK, i overlooked that and the error was not very enlightening.
Thanks very much.


"module.__init__() takes at most 2 arguments (3 given)"

Are you sure about the clueless error message ? :)

JM



  


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


Re: os.stat bug?

2011-03-21 Thread Laszlo Nagy

On 2011-03-21 10:58, Martin v. Loewis wrote:

Could it be a problem with the operation system? Is it possible that an
os.stat call requires 100% CPU power from the OS? Or is it a problem
with the Python implementation?

There is a chance that the CPU usage actually comes from the thread
doing sleep(). If you have a very short sleep time, and a loop around
it, it may spin in this loop.

Sleep time is 1.0 sec.

If it's not that, and if it's not any other unrelated application that
uses CPU that you didn't mention, then chances are high that it's indeed
the file system code of your operating system that consumes that much
CPU time.
Yes. top shows 2 thread in this process, and full 100% CPU time is 
dedicated to the process. So it must be it.


Thank you,

   Laszlo

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


Re: Bounds checking

2011-03-21 Thread Jean-Michel Pichavant

Martin De Kauwe wrote:

Sorry, are you trying to say that it is not practical to write correct
code that isn't buggy? Well, you're honest, at least, still I can't help
but feel that you're admitting defeat before even starting.



No. What I am saying is the code is written has been well tested and
*appears* to be working well. However the code is complicated and
there is potential for bugs. I think I am just been practical here,
evidently I can't think of everything, but there are some clear and
obvious errors that would be worth checking for. I can only explain
this in the terms of the code (sorry)...but for example the model
estimates plant photosynthesis and then allocates the carbon. So one
clear example is that the model cuts back carbon production if there
is water stress for the plant. This involves "removing" carbon from
the state. Clearly if you ended up in a situation where there is
negative carbon in a leaf, i.e. the leaf doesn't exist well this is
not physically possible and would be a code issue. Whilst this is
unlikely I think it would be nice to have a catch for it. Another
example would be the amount of soil water available to the plant,
again there can be zero but not negative soil water. It wouldn't be
meaningful. I hope that makes sense?

thanks
  
Not that much. You'll spot bugs where negative numbers will be set to 
some attribute but what if 42 is put instead of 43 in one of your 
attribute ? Same consequence, it will mess up with your model but none 
of your check will spot that error.


Try to identify those complicated functions you mentioned, and write 
unitary tests for them. Use a set of input parameters with the expected 
function return value. That way you'll be able to spot errors, whether 
the attribute is negative or not.


JM


PS : writing unitary tests takes time, a lot of time.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Bounds checking

2011-03-21 Thread Martin De Kauwe
On Mar 21, 9:43 pm, Jean-Michel Pichavant 
wrote:
> Martin De Kauwe wrote:
> >> Sorry, are you trying to say that it is not practical to write correct
> >> code that isn't buggy? Well, you're honest, at least, still I can't help
> >> but feel that you're admitting defeat before even starting.
>
> > No. What I am saying is the code is written has been well tested and
> > *appears* to be working well. However the code is complicated and
> > there is potential for bugs. I think I am just been practical here,
> > evidently I can't think of everything, but there are some clear and
> > obvious errors that would be worth checking for. I can only explain
> > this in the terms of the code (sorry)...but for example the model
> > estimates plant photosynthesis and then allocates the carbon. So one
> > clear example is that the model cuts back carbon production if there
> > is water stress for the plant. This involves "removing" carbon from
> > the state. Clearly if you ended up in a situation where there is
> > negative carbon in a leaf, i.e. the leaf doesn't exist well this is
> > not physically possible and would be a code issue. Whilst this is
> > unlikely I think it would be nice to have a catch for it. Another
> > example would be the amount of soil water available to the plant,
> > again there can be zero but not negative soil water. It wouldn't be
> > meaningful. I hope that makes sense?
>
> > thanks
>
> Not that much. You'll spot bugs where negative numbers will be set to
> some attribute but what if 42 is put instead of 43 in one of your
> attribute ? Same consequence, it will mess up with your model but none
> of your check will spot that error.
>
> Try to identify those complicated functions you mentioned, and write
> unitary tests for them. Use a set of input parameters with the expected
> function return value. That way you'll be able to spot errors, whether
> the attribute is negative or not.
>
> JM
>
> PS : writing unitary tests takes time, a lot of time.

Hi,

Yes you make a good point. I think what I was trying to get across is
there are certain scenarios which can't physically happen and they are
straight forward to check for. I just thought it might be nice to add
a check for these. However you make a good case and I definitely take
your point. I guess I should look into unitary tests then (any
suggestions?)

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


Re: Bounds checking

2011-03-21 Thread Jean-Michel Pichavant

Martin De Kauwe wrote:

On Mar 21, 9:43 pm, Jean-Michel Pichavant 
wrote:
  

Martin De Kauwe wrote:


Sorry, are you trying to say that it is not practical to write correct
code that isn't buggy? Well, you're honest, at least, still I can't help
but feel that you're admitting defeat before even starting.


No. What I am saying is the code is written has been well tested and
*appears* to be working well. However the code is complicated and
there is potential for bugs. I think I am just been practical here,
evidently I can't think of everything, but there are some clear and
obvious errors that would be worth checking for. I can only explain
this in the terms of the code (sorry)...but for example the model
estimates plant photosynthesis and then allocates the carbon. So one
clear example is that the model cuts back carbon production if there
is water stress for the plant. This involves "removing" carbon from
the state. Clearly if you ended up in a situation where there is
negative carbon in a leaf, i.e. the leaf doesn't exist well this is
not physically possible and would be a code issue. Whilst this is
unlikely I think it would be nice to have a catch for it. Another
example would be the amount of soil water available to the plant,
again there can be zero but not negative soil water. It wouldn't be
meaningful. I hope that makes sense?
  
thanks
  

Not that much. You'll spot bugs where negative numbers will be set to
some attribute but what if 42 is put instead of 43 in one of your
attribute ? Same consequence, it will mess up with your model but none
of your check will spot that error.

Try to identify those complicated functions you mentioned, and write
unitary tests for them. Use a set of input parameters with the expected
function return value. That way you'll be able to spot errors, whether
the attribute is negative or not.

JM

PS : writing unitary tests takes time, a lot of time.



Hi,

Yes you make a good point. I think what I was trying to get across is
there are certain scenarios which can't physically happen and they are
straight forward to check for. I just thought it might be nice to add
a check for these. However you make a good case and I definitely take
your point. I guess I should look into unitary tests then (any
suggestions?)

ta.
  


if your python version < 2.7:
   http://pypi.python.org/pypi/unittest2

http://docs.python.org/library/unittest.html

This is the standard way of writing unitary tests in python (AKA pyunit)

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


How to build and upload eggs to pypi?

2011-03-21 Thread morphex
Hi,

I have a couple of project which are on PyPi, and now I'd like to
update some of them.  Is there a good howto somewhere, showing how to
add new versions (instead of updating one that's already there) etc?

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


[OSX] side by side python

2011-03-21 Thread Robert
Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX
without them stepping all over each other?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OSX] side by side python

2011-03-21 Thread FELD Boris
Yes, no problem. Follow the installation normally; if you want to change your 
default python version to a new one, you need to launch "Update Shell 
Profile.command" in your installation path (/Applications/Python X.X/) or 
choose the "Update Shell Profile" during the installation.

No specific problem, i use these Python versions without any problem on mac os 
x : 2.5, 2.6, 2.7, 3.0, 3.1, 3.2.

-- 
FELD Boris
Sent with Sparrow
On lundi 21 mars 2011 at 13:31, Robert wrote: 
> Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX
> without them stepping all over each other?
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OSX] side by side python

2011-03-21 Thread sigzero
Thanks!

Oh, how do you like Sparrow vs Mail.app?

On Mon, Mar 21, 2011 at 9:30 AM, FELD Boris  wrote:
> Yes, no problem. Follow the installation normally; if you want to change
> your default python version to a new one, you need to launch "Update Shell
> Profile.command" in your installation path (/Applications/Python X.X/) or
> choose the "Update Shell Profile" during the installation.
> No specific problem, i use these Python versions without any problem on mac
> os x : 2.5, 2.6, 2.7, 3.0, 3.1, 3.2.
>
> --
> FELD Boris
> Sent with Sparrow
>
> On lundi 21 mars 2011 at 13:31, Robert wrote:
>
> Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX
> without them stepping all over each other?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: side by side python

2011-03-21 Thread macm
On Mar 21, 9:31 am, Robert  wrote:
> Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX
> without them stepping all over each other?

Yes, sure! Look for "python environment"

http://pypi.python.org/pypi/virtualenv

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


Re: side by side python

2011-03-21 Thread Robert
On Mar 21, 9:45 am, macm  wrote:
> On Mar 21, 9:31 am, Robert  wrote:
>
> > Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX
> > without them stepping all over each other?
>
> Yes, sure! Look for "python environment"
>
> http://pypi.python.org/pypi/virtualenv
>
> Regards

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


Re: side by side python

2011-03-21 Thread FELD Boris
Yes, i did not mention this solution, using virtualenv is a very good practice, 
but before create a virtualenv with a specific version of python, you must have 
installed it globally, isn't it ?

Regards,
-- 
FELD Boris
Sent with Sparrow
On lundi 21 mars 2011 at 14:45, macm wrote: 
> On Mar 21, 9:31 am, Robert  wrote:
> > Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX
> > without them stepping all over each other?
> 
> Yes, sure! Look for "python environment"
> 
> http://pypi.python.org/pypi/virtualenv
> 
> Regards
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


py to exe converter

2011-03-21 Thread PATRICIA MEDINA
I know there is a converter for python 2.x to executable file, but is there one 
for python 3.x yet?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.stat bug?

2011-03-21 Thread Nobody
On Mon, 21 Mar 2011 09:32:11 +0100, Laszlo Nagy wrote:

> So the state of the process changes to "STOP", but the program does not 
> stop until the os.stat call returns back (sometimes for 30 seconds).
> 
> Could it be a problem with the operation system? Is it possible that an 
> os.stat call requires 100% CPU power from the OS? Or is it a problem 
> with the Python implementation?

It's the OS kernel. If it was Python or the C library, sending SIGKILL
would result in immediate termination.

Is the disk interface operating in PIO mode? A slow disk shouldn't cause
100% CPU consumption; the OS would just get on with something else (or
just idle) while waiting for data to become available. But if it's
having to copy data from the controller one word at a time, that could
cause it (and would also make the disk appear slow).

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


Re: py to exe converter

2011-03-21 Thread Alan Harris-Reid

On 19:59, PATRICIA MEDINA wrote:
I know there is a converter for python 2.x to executable file, but is 
there one for python 3.x yet?


I use cx_Freeze without any problems  (//cx-freeze.sourceforge.net/)

HTH
Alan


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


Re: py to exe converter

2011-03-21 Thread Santoso Wijaya
There's also py2exe: http://www.py2exe.org/

~/santa


On Mon, Mar 21, 2011 at 11:06 AM, Alan Harris-Reid
wrote:

>  On 19:59, PATRICIA MEDINA wrote:
>
>  I know there is a converter for python 2.x to executable file, but is
> there one for python 3.x yet?
>
>
> I use cx_Freeze without any problems  (//cx-freeze.sourceforge.net/)
>
> HTH
> Alan
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: In messageBarna wrote:Can???t understand the point to it. ???GUI automation???

2011-03-21 Thread Roberto Salazar
Oh don't be obtuse, dude. GUI automation is much used for webbots and data 
scraping bamong other things. Why do you think so many sites are starting to 
use that irritating "Captcha" technology? To block GUI-manipulating scripts, of 
course. Though, for blind people Captcha makes navigation on some sites quite 
difficult if not impossible. With scriptable OSes, sites and browsers you can 
grab a lot of data.

> On Monday, August 09, 2010 8:10 AM Alex Barna wrote:

> I know that this question has been asked for several times, but it
> surprises that there is no tool under very active development and the
> community activities are very low (mailing list posts).
> 
> All the tools listed in:
> 
> http://pycheesecake.org/wiki/PythonTestingToolsTaxonomy#GUITestingTools
> 
> Comparing with AutoIt (www.autoitscript.com), it has tens to hundreds
> of posts everyday. AutoIt uses a proprietary BASIC -like language, and
> to be honest, I do not like it and I prefer a Pythonic solution.
> 
> pywinauto seems to be the best choice but the community has been very
> low also. The same happens in pyguiunit, pyAA, WATSUP, all development
> seem to be ceased.
> 
> So what happens to this field (Windows GUI automation) ?


>> On Monday, August 09, 2010 11:56 PM alex23 wrote:

>> Either someone cares enough to do something about it, or everyone just
>> defaults to using AutoIT-like tools.
>> 
>> Which Python implementation are you planning on contributing to?


>>> On Tuesday, August 10, 2010 4:05 AM Lawrence D'Oliveiro wrote:

>>> In message
>>> Barna wrote:
>>> 
>>> 
>>> Can???t understand the point to it. ???GUI automation??? is a contradiction 
>>> in
>>> terms, because a GUI is designed for use by humans to do manual tasks, not
>>> ones that can be automated.
>>> 
>>> Tasks that can be automated are most easily, flexibly, and above all
>>> reliably, done via command lines and other such scripting interfaces.


 On Tuesday, August 10, 2010 4:52 AM Chien wrote:

 There were a lot of development but then all ceased, except pywinauto
 has a final release in April, but really low community activity. Does
 it mean AutoIt has much more advantages than Python tools (which I
 have not realized) ?
 
 
 I'd say pywinauto. it is more O-O than the other tools. Excerpt from
 its homepage (http://pywinauto.openqa.org/):
 
 
 Most other tools are not object oriented you end up writing stuff
 like:
 
 window =3D findwindow(title =3D "Untitled - Notepad", class =3D
 "Notepad")
 SendKeys(window, "%OF")  # Format -> Font
 fontdialog  =3D findwindow("title =3D "Font")
 buttonClick(fontdialog, "OK")
 
 I was hoping to create something more userfriendly (and pythonic):
 
 win =3D app.UntitledNotepad
 win.MenuSelect("Format->Font")
 app.Font.OK.Click()
 
 
 Alex Barna


> On Tuesday, August 10, 2010 6:25 AM Alex Barna wrote:

> to it. =93GUI automation=94 is a contradiction in
> t
> 
> Automating GUI is for testing.


>> On Tuesday, August 10, 2010 8:49 AM Steven D'Aprano wrote:

>> There have been plenty of systems for recording user actions and playing
>> them back. They're very useful at times.
>> 
>> http://en.wikipedia.org/wiki/Macro_recorder
>> http://en.wikipedia.org/wiki/Macro_(computer_science)
>> 
>> 
>> You might even have heard of one of them... Emacs. I hear that it is
>> moderately popular among Linux users.
>> 
>> http://www.linuxjournal.com/article/3769
>> 
>> 
>> 
>> 
>> That's a matter of opinion, and it clearly depends on the nature of the
>> GUI and CLI, as well as what task you are trying to automate.
>> 
>> 
>> 
>> --
>> Steven


>>> On Tuesday, August 10, 2010 3:13 PM News123 wrote:

>>> On 08/10/2010 12:25 PM, Alex Barna wrote:
>>> And sometimesfor working around SW, whch has no cli or other interface
>>> and should be automated


 On Tuesday, August 10, 2010 3:23 PM Martin P. Hellwig wrote:

 On 08/10/10 20:13, News123 wrote:
 That and when you are forced using a gui and need to 'copy and paste'
 between two programs that have no native bridge except for the one that
 is between the keyboard and chair, then it is nice to know that there 
 is
 a way of automating it.
 
 --
 mph


> On Tuesday, August 10, 2010 10:57 PM Lawrence D'Oliveiro wrote:

> In message
> Barna wrote:
> 
> 
> But the most egregious GUI problems are going to be with humans being 
> unable
> to figure out how to do something, am I right? How are you going to 
> uncover
> those problems, except by testing with real people? Automated testing 
> isn???t
> going to do it.


>> On Tuesday, August 10, 2010 10:59 PM Lawrence D'Oliveiro wrote:

Re: py to exe converter

2011-03-21 Thread Alan Harris-Reid
According to //sourceforge.net/projects/py2exe/files/, the latest 
version only goes as far as Python2.5 :-(


Alan


On 21/03/2011 19:47, Santoso Wijaya wrote:

There's also py2exe: http://www..py2exe.org/ 

~/santa


On Mon, Mar 21, 2011 at 11:06 AM, Alan Harris-Reid 
mailto:[email protected]>> wrote:


On 19:59, PATRICIA MEDINA wrote:

I know there is a converter for python 2.x to executable file,
but is there one for python 3.x yet?


I use cx_Freeze without any problems 
(//cx-freeze.sourceforge.net/ )


HTH
Alan



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






No virus found in this message.
Checked by AVG - www.avg.com 
Version: 10.0.1204 / Virus Database: 1498/3520 - Release Date: 03/21/11



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


Re: py to exe converter

2011-03-21 Thread Santoso Wijaya
Nope. All the way to 2.7. [1]

~/santa

[1] http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/

On Mon, Mar 21, 2011 at 1:29 PM, Alan Harris-Reid
wrote:

>  According to //sourceforge.net/projects/py2exe/files/, the latest version
> only goes as far as Python2.5 :-(
>
> Alan
>
> --
> On 21/03/2011 19:47, Santoso Wijaya wrote:
>
> There's also py2exe: http://www..py2exe.org/ 
>
>  ~/santa
>
>
> On Mon, Mar 21, 2011 at 11:06 AM, Alan Harris-Reid <
> [email protected]> wrote:
>
>>  On 19:59, PATRICIA MEDINA wrote:
>>
>>  I know there is a converter for python 2.x to executable file, but is
>> there one for python 3.x yet?
>>
>>
>>  I use cx_Freeze without any problems  (//cx-freeze.sourceforge.net/)
>>
>> HTH
>> Alan
>>
>>
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>>
>
> --
> --
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1204 / Virus Database: 1498/3520 - Release Date: 03/21/11
>
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Proxy authentication required

2011-03-21 Thread Chris Rebert
On Mon, Mar 21, 2011 at 2:38 AM, gervaz  wrote:
> Hi all,
> I've got to download some web pages but I'm behind a proxy. So far
> this is what I've used without any successful result receiving the
> error: "urllib.error.HTTPError: HTTP Error 407: Proxy Authentication
> Required ( The ISA Server requires auth
> orization to fulfill the request. Access to the Web Proxy filter is
> denied.  )":
>
> hc = urllib.request.HTTPCookieProcessor()
> hp = urllib.request.ProxyHandler({"http": "10.242.38.251:80",
> "username": "domain\username", "password": "password"})

Remember that backslash is used for string escapes in Python; so that
should be "domain\\username" in order to get 1 literal backslash. I
suspect this is the cause of your proxy authentication problem.

> opener = urllib.request.build_opener(hc, hp)

Are you sure that's the right order for the handlers? (I don't know myself.)

> urllib.request.urlopen("http://www.google.it/";)

Cheers,
Chris
--
Windows, Y U use backslash for stuff!?
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Twisted and txJSON-RPC

2011-03-21 Thread Floris Bruynooghe
On Sunday, April 11, 2010 5:04:49 PM UTC+1, writeson wrote:
> I get an error message: error: docs/PRELUDE.txt: No such file or
> directory

The setup.py code is trying to be too clever and the released package is 
missing files it requires.  The easiest way to fix it is to simply get the 
latests code from the VCS which contains all the required files.  That's what I 
did anyway:

brz branch lp:txjsonrpc

Then just do your usual favourite incantation of "python setup.py install 
--magic-options-to-make-setuptools-sane-for-you".

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


Decorator Syntax

2011-03-21 Thread Mike Patterson
In my Python class the other day, the professor was going over
decorators and he briefly mentioned that there had been this huge
debate about the syntax and using the @ sign to signify decorators.

I read about the alternative forms proposed here (http://
www.python.org/dev/peps/pep-0318/#syntax-alternatives).

Has anyone thought about just using dec to declare a decorator?

For example:
dec dec2
dec dec1
def func(arg1, arg2, ...):
pass
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Proxy authentication required

2011-03-21 Thread python
On Mar 21, 7:02 pm, Chris Rebert  wrote:
> On Mon, Mar 21, 2011 at 2:38 AM, gervaz  wrote:
> > Hi all,
> > I've got to download some web pages but I'm behind a proxy. So far
> > this is what I've used without any successful result receiving the
> > error: "urllib.error.HTTPError: HTTP Error 407: Proxy Authentication
> > Required ( The ISA Server requires auth
> > orization to fulfill the request. Access to the Web Proxy filter is
> > denied.  )":
>
> > hc = urllib.request.HTTPCookieProcessor()
> > hp = urllib.request.ProxyHandler({"http": "10.242.38.251:80",
> > "username": "domain\username", "password": "password"})
>
> Remember that backslash is used for string escapes in Python; so that
> should be "domain\\username" in order to get 1 literal backslash. I
> suspect this is the cause of your proxy authentication problem.
>
> > opener = urllib.request.build_opener(hc, hp)
>
> Are you sure that's the right order for the handlers? (I don't know myself.)
>
> > urllib.request.urlopen("http://www.google.it/";)
>
> Cheers,
> Chris
> --
> Windows, Y U use backslash for stuff!?http://blog.rebertia.com

did this a long time ago when behind a corporate proxy server worked
then might be a start for you
I am fuzzy on the details.

import httplib
import base64
import getpass
def getWebPage(userName='YourUserName',httpPage='http://
weather.noaa.gov/weather/current/KRIC.html',outFilePath=None):
# 1. connect to the proxy
h1 = httplib.HTTP("proxyconf",)

# 2. give the absolute URL in the request
h1.putrequest('GET', 'http://weather.noaa.gov/weather/current/
KRIC.html')

h1.putheader('Accept', 'text/html')
h1.putheader('Accept', 'text/plain')
password = getpass.getpass()
# 3. set the header with a base64 encoding of user-id:passwd
userString = "%s:%s" % (userName,password)
auth = "Basic " + base64.encodestring(userString)
h1.putheader('Proxy-Authorization', auth)
h1.endheaders()

# 4. get the page
errcode, errmsg, headers = h1.getreply()

print errcode
print errmsg
print headers

f=h1.getfile()
if(not outFilePath):
for line in f.readlines():
print line
else:
try:
outFile = open(outFilePath,'w')
# yada yaha
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decorator Syntax

2011-03-21 Thread Benjamin Kaplan
On Mon, Mar 21, 2011 at 8:59 PM, Mike Patterson
 wrote:
> In my Python class the other day, the professor was going over
> decorators and he briefly mentioned that there had been this huge
> debate about the syntax and using the @ sign to signify decorators.
>
> I read about the alternative forms proposed here (http://
> www.python.org/dev/peps/pep-0318/#syntax-alternatives).
>
> Has anyone thought about just using dec to declare a decorator?
>
> For example:
> dec dec2
> dec dec1
> def func(arg1, arg2, ...):
>    pass
> --

dec and def look too similar. It would get confusing. Also, it
wouldn't be immediately obvious that the line is associated with the
function declaration below. The whole point in the decorators is that
it makes it easier to tell that the function is being wrapped.
-- 
http://mail.python.org/mailman/listinfo/python-list


[no subject]

2011-03-21 Thread Sniper

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


Free Software University - Python Certificate

2011-03-21 Thread Giovani
Hi all, my name is Juan and I suscribed to this website called "Free
Software University", opened recently. One of the goals of this
website is making some free high quality courses, one of them about
Python.

I want to say this message is not SPAM, is a call for every one who
can and wants help us to make several good courses about Python, those
will be in english and spanish languages (and any other translation if
is aviable). We're allways open to new suggets, changes, contents,
etc...

Best regads.

Juan R. S.

PD: Link: http://www.freesoftwareuni.com/moodle/mod/forum/discuss.php?d=20
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Decorator Syntax

2011-03-21 Thread Ian Kelly
On Mon, Mar 21, 2011 at 7:31 PM, Benjamin Kaplan
 wrote:
> On Mon, Mar 21, 2011 at 8:59 PM, Mike Patterson
>  wrote:
>> In my Python class the other day, the professor was going over
>> decorators and he briefly mentioned that there had been this huge
>> debate about the syntax and using the @ sign to signify decorators.
>>
>> I read about the alternative forms proposed here (http://
>> www.python.org/dev/peps/pep-0318/#syntax-alternatives).
>>
>> Has anyone thought about just using dec to declare a decorator?
>>
>> For example:
>> dec dec2
>> dec dec1
>> def func(arg1, arg2, ...):
>>    pass
>> --
>
> dec and def look too similar. It would get confusing. Also, it
> wouldn't be immediately obvious that the line is associated with the
> function declaration below. The whole point in the decorators is that
> it makes it easier to tell that the function is being wrapped.

Also "dec" would then have to become a keyword.  Unnecessary
keywording is frowned upon because it breaks any script that happens
to use the keyword as a name, thus creating backward
incompatibilities.  And I'm willing to bet that there are plenty of
scripts out there that use "dec" as a name for Decimal objects.
-- 
http://mail.python.org/mailman/listinfo/python-list


how to install the PLY (Python Lex-Yacc) package in windows

2011-03-21 Thread Sachin Kumar Sharma
BB,

I downloaded PLY (Python Lex-Yacc) package for a 
script use it for parsing and looking to install under windows.

It has setup.py file, and the command mentioned for installation is

Python setup.py install

Doesn't work for windows.

Any advice.

Cheers

Sachin


Sachin Kumar Sharma
Senior Geomodeler

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


Re: how to install the PLY (Python Lex-Yacc) package in windows

2011-03-21 Thread Chris Rebert
On Mon, Mar 21, 2011 at 10:53 PM, Sachin Kumar Sharma  wrote:
> BB,
>
> I downloaded PLY (Python Lex-Yacc) package for a script use it for parsing
> and looking to install under windows.
>
> It has setup.py file, and the command mentioned for installation is
>
> Python setup.py install
>
> Doesn’t work for windows.

Reasonably sure it does, with slight modification. Change "python" to
the full path of your pythonw.exe executable.
If it still doesn't work, please include the error message you're getting.

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


Problem with keyboard up/down arrows in Python 2.4 interpreter

2011-03-21 Thread Julien
Hi,

I'm having problems when typing the up/down arrows in the Python 2.4
interpreter (exact version: Python 2.4.6 (#1, Mar  3 2011, 15:45:53)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin).

When I press the up arrow it outputs "^[[A" and when I press the down
arrow it outputs "^[[B".

I've google it and it looks like it might be an issue with the
readline not being installed or configured properly. Is that correct?
If so, how can I fix this issue?

Many thanks.

Kind regards,

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


Re: Problem with keyboard up/down arrows in Python 2.4 interpreter

2011-03-21 Thread Benjamin Kaplan
On Tue, Mar 22, 2011 at 2:27 AM, Julien  wrote:
> Hi,
>
> I'm having problems when typing the up/down arrows in the Python 2.4
> interpreter (exact version: Python 2.4.6 (#1, Mar  3 2011, 15:45:53)
> [GCC 4.2.1 (Apple Inc. build 5664)] on darwin).
>
> When I press the up arrow it outputs "^[[A" and when I press the down
> arrow it outputs "^[[B".
>
> I've google it and it looks like it might be an issue with the
> readline not being installed or configured properly. Is that correct?
> If so, how can I fix this issue?
>
> Many thanks.
>
> Kind regards,
>
> Julien
> --

How did you install Python? If you used Macports, it looks like
readline support is a separate port for 2.4. Try installing
py-readline.

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