Re: Python 32 bit error

2015-10-26 Thread Chris Angelico
On Sat, Oct 24, 2015 at 8:38 AM, Joshua Star  wrote:
> I am running a 32 bit computer, (Windows XP) and when I finish with the
> installer program, I try to run either of the two executable files that are
> put on my computer and they both come up with the message "python.exe is not
> a valid Win32 application"
>
> Also, in the installer program, some of the buttons are invisible.

Is this the installer for Python 3.5? It doesn't support XP. You'll
need to get a newer and better operating system (Windows 7, Ubuntu
Linux, etc), or use Python 3.4 instead.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ignore stderr and use return code

2015-10-26 Thread Chris Angelico
On Mon, Oct 26, 2015 at 3:34 PM, Cameron Simpson  wrote:
> No. Mount should have a zero status if it succeeds and anon-zero exit status
> if it fails. There is no grey area here.

This is the general case. For specific programs, you can often check
their man pages; for the mount(8) on my system, it's bitwise:

   1  incorrect invocation or permissions
   2  system error (out of memory, cannot fork, no more loop devices)
   4  internal mount bug
   8  user interrupt
   16 problems writing or locking /etc/mtab
   32 mount failure
   64 some mount succeeded

It's also theoretically possible to get a return value of 127,
indicating that the 'mount' command was itself not found. That might
not seem likely, but if someone has a restricted $PATH, you might run
into that. Likewise 126 might indicate that "mount" exists but is
non-executable - again, unlikely in the case of mount, but possible.
In any case, you can generally depend on a non-zero exit status
indicating failure and zero being reserved for success.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Error while launching python idle.

2015-10-26 Thread Terry Reedy

On 10/24/2015 3:00 PM, Vijay kumar wrote:

Hi,

I recently installed python 2.7 on my windows 10 laptop. When i launch
python by clicking the python idle the following error appears


In attached image. You should also type the text so it appears in responses.


even before i do anything.


Just click OK and continue.  This should really be a warning, not an 
error.  You will see it once each session, but only once. The recent 
files list will not be saved for when you restart IDLE the next time.


It is up to you to determine why it cannot be written in your home 
directory and whether you can change permissions.


--
Terry Jan Reedy

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


Re: UNABLE TO GET IDLE TO RUN

2015-10-26 Thread Terry Reedy

On 10/26/2015 9:55 AM, Peter Otten wrote:


The "bug" or misfeature is that idle automatically adds the working
directory to sys.path.


I am not sure what you mean by 'working directory' here. When one runs a 
program with 'python somepath/file.py', python prepends somepath to 
sys.path.



Ideally the editor should see the unaltered path


I don't know what you mean here.  The editor does not look as sys.path.


while scripts started from within idle might be allowed to import from the
working directory.


Programs run from the editor are intended to run as much as possible the 
same as if run from a command line.  To do this, IDLE must prepend 
somepath to sys.path the same as python itself does.  As a result, if 
somepath/file.py contains


import sys
print(sys.path)

then when run, sys.path  starts with os.abspath(somepath).

--
Terry Jan Reedy

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


Re: how to get python socket to use a specific interface

2015-10-26 Thread Cameron Simpson

On 26Oct2015 12:33, Robin Becker  wrote:

.

device? --
Robin Becker


Using eth0:0 is normally a method to setup eth0 to respond to a 2nd
IPV4/IPV6 address.  Have you done the ifconfig steps to enable that?  If
its been done, you will see it's 2nd address in an ifconfig query.  Man
pages are wunnerful things.
yes I have done that and the address is responding, problem is it has 
been email blacklisted



$ ifconfig
eth0  Link encap:Ethernet  HWaddr 00:...4 GB)
 Interrupt:16

eth0:0Link encap:Ethernet  HWa...


Do you need to bind to the device itself? Using the correct IP address should 
normally be sufficient. The system you're talking to won't know anything about 
the device, only the address. Try skipping the device binding step.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: OT snake_case

2015-10-26 Thread MRAB

On 2015-10-25 23:43, Mark Lawrence wrote:

On 23/10/2015 17:53, MRAB wrote:

I just discovered today that writing names in lowercase with
underscores is sometimes called "snake case".

Seems kind of apt for Python! :-)

Apparently, it was coined in the Ruby community...


So when I get around to forking Python to produce 2.8 the name will have
to be Camel :)  Or is that already taken?


There's Caml, of which OCaml is the main implementation, so it might be
confusing.

Also, a camel (dromedary) is used on the cover of the Perl book
published by O'Reilly.

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


Re: Best way to do background calculations?

2015-10-26 Thread Chris Angelico
On Tue, Oct 27, 2015 at 4:01 AM, Israel Brewster  wrote:
> Sounds similar to MRAB's suggestion of starting the process before any 
> sockets have been opened. Certainly worth investigating, and I think it 
> should be doable. Thanks!

Yep, either would work. My suggestion would be to not fork off from
your main web server process _at all_, and have your background
process managed some other way (eg a systemd service or Upstart job),
but forking earlier will have a similar effect.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Best way to do background calculations?

2015-10-26 Thread Israel Brewster
On Oct 25, 2015, at 6:48 PM, Chris Angelico  wrote:
> 
> On Sat, Oct 24, 2015 at 3:35 AM, Israel Brewster  
> wrote:
>> 
>> Ideally, this recalculation process would happen in the background. There is
>> no need for the user to wait around while the system crunches numbers - they
>> should be able to move on with entering another log or whatever else they
>> need to do. To that end, I implemented the call to the recalc function using
>> the multiprocessing module, so it could start in the background and the main
>> process move on.
> 
> One way to get around this would be to separate the processes
> completely, and simply alert the other process (maybe via a socket) to
> ask it to do the recalculation. That way, the background process would
> never have any of the main process's sockets, and can't affect them in
> any way.

Sounds similar to MRAB's suggestion of starting the process before any sockets 
have been opened. Certainly worth investigating, and I think it should be 
doable. Thanks!

---
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---


> 
> ChrisA
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Best way to do background calculations?

2015-10-26 Thread Israel Brewster
On Oct 25, 2015, at 3:40 PM, Dennis Lee Bieber  wrote:
> 
> On Fri, 23 Oct 2015 08:35:06 -0800, Israel Brewster 
> declaimed the following:
> 
>> tl;dr: I've been using the multiprocessing module to run some calculations 
>> in the background of my CherryPy web app, but apparently this process 
>> sometimes gets stuck, causing problems with open sockets piling up and 
>> blocking the app. Is there a better way?
>> 
>> The (rather wordy) details:
>> 
>   The less wordy first impression...
> 
>> I have a moderately busy web app written in python using the CherryPy 
>> framework (CherryPy v 3.8.0 with ws4py v 0.3.4 and Python 2.7.6) . One of 
>> the primary purposes of this web app is to track user-entered flight logs, 
>> and keep a running tally of hours/cycles/landings for each aircraft. To that 
>> end, whenever a user enters or modifies a log, I "recalculate" the totals 
>> for that aircraft, and update all records with the new totals. There are 
>> probably ways to optimize this process, but so far I haven't seen a need to 
>> spend the time.
>> 
>   Off-hand -- this sounds like something that should be in a database...
> Unless your calculations are really nasty, rather than just aggregates, a
> database engine should be able to apply them in SQL queries or stored
> procedures.

Sounds like a potentially valid approach. Would require some significant 
re-tooling, but could work. I'll look into it.

---
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---


> -- 
>   Wulfraed Dennis Lee Bieber AF6VN
>wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Best way to do background calculations?

2015-10-26 Thread Israel Brewster
On Oct 25, 2015, at 4:05 PM, MRAB  wrote:
> 
> On 2015-10-23 17:35, Israel Brewster wrote:
>> tl;dr: I've been using the multiprocessing module to run some
>> calculations in the background of my CherryPy web app, but apparently
>> this process sometimes gets stuck, causing problems with open sockets
>> piling up and blocking the app. Is there a better way?
>> 
>> The (rather wordy) details:
>> 
>> I have a moderately busy web app written in python using the CherryPy
>> framework (CherryPy v 3.8.0 with ws4py v 0.3.4 and Python 2.7.6) . One
>> of the primary purposes of this web app is to track user-entered flight
>> logs, and keep a running tally of hours/cycles/landings for each
>> aircraft. To that end, whenever a user enters or modifies a log, I
>> "recalculate" the totals for that aircraft, and update all records with
>> the new totals. There are probably ways to optimize this process, but so
>> far I haven't seen a need to spend the time.
>> 
>> Ideally, this recalculation process would happen in the background.
>> There is no need for the user to wait around while the system crunches
>> numbers - they should be able to move on with entering another log or
>> whatever else they need to do. To that end, I implemented the call to
>> the recalc function using the multiprocessing module, so it could start
>> in the background and the main process move on.
>> 
>> Lately, though, I've been running into a problem where, when looking at
>> the process list on my server (Mac OS X 10.10.5), I'll see two or more
>> "copies" of my server process running - one master and one or more child
>> processes. As the above described process is the only place I am using
>> the multiprocessing module, I am making the assumption that this is what
>> these additional processes are. If they were only there for a few
>> minutes I would think this is normal, and it wouldn't be a problem.
>> 
>> However, what I am seeing is that from time to time (once or twice every
>> couple of days) these additional processes will get "stuck", and when
>> that happens sockets opened by the web app don't get properly closed and
>> start piling up. Looking at a list of open sockets on the server when I
>> have one of these "hung" processes shows a steadily increasing number of
>> sockets in a "CLOSE_WAIT" state (normally I see none in that state).
>> Killing off the hung process(es) clears out these sockets, but if I
>> don't catch it quickly enough these sockets can build up to the point
>> that I am unable to open any more, and the server starts rejecting
>> connections.
>> 
>> I'm told this happens because the process retains a reference to all
>> open files/sockets from the parent process, thus preventing the sockets
>> from closing until the process terminates. Regardless of the reason, it
>> can cause a loss of service if I don't catch it quickly enough. As such,
>> I'm wondering if there is a better way. Should I be looking at using the
>> threading library rather than the multiprocessing library? My
>> understanding is that the GIL would prevent that approach from being of
>> any real benefit for a calculation intensive type task, but maybe since
>> the rest of the application is CherryPy threads, it would still work
>> well?. Or perhaps there is a way to not give the child process any
>> references to the parent's files/sockets - although that may not help
>> with the process hanging? Maybe there is a way to "monitor" the process,
>> and automatically kill it if it stops responding? Or am I totally
>> barking up the wrong tree here?
>> 
> It sounds like the multiprocessing module is forking the new process,
> which inherits the handles.
> 
> Python 3.4 added the ability to spawn the new process, which won't inherit 
> the handles.

Well, that might be a reason to look at moving to 3 then. It's been on my to-do 
list :-)

> 
> It's unfortunate that you're using Python 2.7.6!
> 
> Could you start the background process early, before any of those
> sockets have been opened, and then communicate with it via queues?

Possibly. Simply have the process always running, and tell it to kick off 
calculations as needed via queues. It's worth investigating for sure.

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

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


ANN: orcastorm

2015-10-26 Thread Nagy László Zsolt
OrcaStorm provides a simple module that can be used from a Tornado
server to authenticate users with SaasPass (www.saaspass.com) two-factor
authentication.

This is a pre-release, it can only be used with tornado version 4.3.
That version is still beta, but that is the only version that supports
async def statements with tornado's ioloop.

The PyPi package contains the module for the API only. The repository
contains an example web server that can be used to understand how
SaasPass reverse ajax callback works for login pages.

PyPi: https://pypi.python.org/pypi/orcastorm
Documentation: http://pythonhosted.org/orcastorm/
Repository: https://bitbucket.org/nagylzs/orcastorm

Orcastorm supports authentication by:

  * reading a barcode
  * entering an OTP code
  * instant login (single sign on)

But it does not support remote logouts.

In contrast, Clef does have support for remote logouts, but it cannot
authenticate with OTP codes, you cannot be logged in with different
accounts at the same time by default, and the only method for logging in
(AFAIK) is with oauth2.


Cheers,

   Laszlo
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: clefstorm

2015-10-26 Thread Nagy László Zsolt
ClefSform provides a simple module that can be used from a Tornado
server to authenticate users with Clef (www.getclef.com) two-factor
authentication.

This is a pre-release, it can only be used with tornado version 4.3.
That version is still beta, but that is the only version that supports
async def statements with tornado's ioloop.

The PyPi package contains the module for the API only. The repository
contains an example web server that can be used to understand how Clef
single sign out works.

PyPi: https://pypi.python.org/pypi/clefstorm
Documentation: http://pythonhosted.org/clefstorm/
Repository: https://bitbucket.org/nagylzs/clefstorm

Cheers,

   Laszlo

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


Re: UNABLE TO GET IDLE TO RUN

2015-10-26 Thread Peter Otten
Terry Reedy wrote:

> On 10/23/2015 5:42 AM, Peter Otten wrote:
>> Laura Creighton wrote:
>>
>>> In a message of Fri, 23 Oct 2015 00:19:42 -0400, Terry Reedy writes:
 On 10/21/2015 11:24 AM, Terry Alexander via Python-list wrote:

> I have tried installing both Python 2.7 and 3.5, and in both cases I
> cannot get IDLE to work. I received the following message both times:

 What OS? Windows? which version?  How did you start IDLE?  Start menu
 icon?  Command line?

> IDLE’s subprocess didn’t make connection.Either IDLE can’t start a
> subprocess or personal firewall software is blocking the connection.
>
> I am running Norton, and disabled it, but still IDLE will not run. Any
> suggestions?

 Don't shout with ALL CAPS in the subject line.  It usually indicates
 spam.  I already know that this problem is very frustrating.

 Firewalls are seldom the problems anymore.  I occasionally saw this on
 Win 7 when restarting, but never on startup, and never more than once
 or twice in a session.

 What's left is misconfiguration of your network interface that prevents
 a loopback connection.  There might be answers on Stackoverflow that
 would help, depending on your OS.

 In the meanwhile, you can start IDLE with the -n option.  Either use a
 command line or create an 'IDLE -n' icon.  Again, details depend on
 exact OS.
 Terry Jan Reedy
>>>
>>> You can also get this message if you run idle in directory where you
>>> have your own python file whose name shadows something in the
>>> standard library (that idle is interested in).  I think it was
>>> a file named 'string.py' that did this to a student of mine a
>>> few years ago.
>>> Laura
> 
> I can imagine that a bad socket module might have this effect.  With
> verification that a user file could have this effect, I would augment
> the message.
> 
>> I tried it out:
>>
>> $ mkdir test
>> $ cd test
>> $ touch string.py
>> $ idle3
>> Traceback (most recent call last):
>>File "", line 1, in 
>>File "/usr/lib/python3.4/idlelib/run.py", line 12, in 
>>  from idlelib import CallTips
>>File "/usr/lib/python3.4/idlelib/CallTips.py", line 16, in 
>>  from idlelib.HyperParser import HyperParser
>>File "/usr/lib/python3.4/idlelib/HyperParser.py", line 14, in 
>>  _ASCII_ID_CHARS = frozenset(string.ascii_letters + string.digits +
>>  "_")
>> AttributeError: 'module' object has no attribute 'ascii_letters'
>>
>> Then idle shows the message and quits after you hit OK.
>>
>> Is there a bug report?
> 
> No.  Quitting because a stdlib module cannot be imported (or corrupted)
> is not a bug.  AttributeError is a typical symptom.  A user file called
> random.py is probably more common.

The "bug" or misfeature is that idle automatically adds the working 
directory to sys.path. Ideally the editor should see the unaltered path 
while scripts started from within idle might be allowed to import from the 
working directory.


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


Re: how to get python socket to use a specific interface

2015-10-26 Thread Robin Becker

.

device? --
Robin Becker


Using eth0:0 is normally a method to setup eth0 to respond to a 2nd
IPV4/IPV6 address.  Have you done the ifconfig steps to enable that?  If
its been done, you will see it's 2nd address in an ifconfig query.  Man
pages are wunnerful things.
yes I have done that and the address is responding, problem is it has been email 
blacklisted



$ ifconfig
eth0  Link encap:Ethernet  HWaddr 00:...4 GB)
  Interrupt:16

eth0:0Link encap:Ethernet  HWa...

loLink encap:Local Loopback

..


The problem is as stated in the original email; when I try to execute the 
commands to bind to that device I get an error eg




# ~rptlab/tmp/proxy/bin/python
Python 2.7.5 (default, Aug 20 2013, 15:27:38)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from socket import socket, SOL_SOCKET
BIND_DEVICE='eth0:0'
sock = socket()
sock.settimeout(10)
sock.setsockopt(SOL_SOCKET, 25, BIND_DEVICE)

Traceback (most recent call last):
  File "", line 1, in 
  File "/home/rptlab/LOCAL/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 19] No such device





so I guess I'm not using the right name for the device. I tried a leter python 
3.5 in case my python 2.7 is too old, but that also fails.


--
Robin Becker

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


Python 32 bit error

2015-10-26 Thread Joshua Star
I am running a 32 bit computer, (Windows XP) and when I finish with the 
installer program, I try to run either of the two executable files that are put 
on my computer and they both come up with the message "python.exe is not a 
valid Win32 application"

Also, in the installer program, some of the buttons are invisible.

>From Joshua.-- 
https://mail.python.org/mailman/listinfo/python-list


[no subject]

2015-10-26 Thread dore.theo36


Provenance : Courrier pour Windows 10
-- 
https://mail.python.org/mailman/listinfo/python-list