Idle subprocess error

2015-10-16 Thread briankeithroby--- via Python-list
Idle subprocess error cant use editor.








Sent from Windows Mail-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Idle subprocess error

2015-10-16 Thread Chris Angelico
On Fri, Oct 16, 2015 at 12:08 PM, briankeithroby--- via Python-list
 wrote:
> Idle subprocess error cant use editor.
>
>
> Sent from Windows Mail
>

Email error insufficient data.

Sent from a person who's unable to make something out of nothing.

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


Re: Idle subprocess error

2015-10-16 Thread Terry Reedy

On 10/15/2015 9:08 PM, briankeithroby--- via Python-list wrote:

Idle subprocess error cant use editor.


You probably need to restart IDLE with the -n argument.  See the doc.

--
Terry Jan Reedy

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


Re: How to implement an async message bus

2015-10-16 Thread Nagy László Zsolt

>
> It is very annoying that async, await, yield, Future, Condition, Lock
> and almost all other async constructs work with any event loop; but
> simple things like "sleep for 10 seconds" are totally incompatible.
> But I guess I'll have to live with that for now.
>
Some more incompatibilty:

  * ioloop.add_timeout accepts a datetime.timedelta for the timeout
  * asyncio.call_later accepts the number of seconds
  * handler = asyncio.call_later() stands in pair with handler.cancel()
  * Tornado's handler = ioloop.add_timeout() stands in pair with
ioloop.remove_timeout(handler). Even the syntax is different. 

It looks like I must write a wrapper or subclasses for different event
loop implementations.  I strongly feel that because we have a standard
abstract base class asyncio.BaseEventLoop for event loops,
tornado.IOLoop should be a descendant of it.


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


pip problem

2015-10-16 Thread Antti Lagus
hello,

installed pyton3.5 to NOT default folder.
tried to install cx_Freeze, but countered errors where pip tried to
copy/import stuff from default install location.

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


Re: How to implement an async message bus

2015-10-16 Thread Nagy László Zsolt

>>> try:
>>> return await waiter
>>> finally:
>>> # TODO: Use a context manager to add and remove the keys.
>>> for key in keys:
>>> self._waiters[key].discard(waiter)
>>> if handle:
>>> handle.cancel()
>>>
>>> def notify(self, key, message):
>>> if key in self._waiters and self._waiters[key]:
>>> waiter = next(iter(self._waiters[key]))
>>> waiter.set_result((key, message))
>> I think this is what I needed. I'm going to try this tomorrow.
> Yes, putting aside the asyncio/tornado distinction, I think a Future
> will still solve the problem for you.
No, it won't. :-( 

Finally, I got it working, by replacing asyncio.Future with
tornado.concurrent.Future.

At least it is consistent. But it is also missing key features. For
example, there is no tornado.concurrent.Condition.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip problem

2015-10-16 Thread Steven D'Aprano
On Fri, 16 Oct 2015 07:50 pm, Antti Lagus wrote:

> hello,
> 
> installed pyton3.5 to NOT default folder.
> tried to install cx_Freeze, but countered errors where pip tried to
> copy/import stuff from default install location.
> 
> please fix

Okay, I'm looking into my crystal ball, and I see you're using Windows 95 on
a Mac Plus with 1MB of RAM and two floppy disk drives. The crystal ball
tells me that the "stuff" you tried to copy was a 2GB .mkv of The Spice
Girls Movie, and the error you got was a Guru Meditation Error.

Sadly, I think my crystal ball is not working very well today.

Perhaps if you tell us what operating system you are using, where you
installed Python 3.5, what command you gave to install cx_Freeze, and what
errors you got, we might be able to help you a little better.

Otherwise, the best I can do is look in the crystal ball, which tells me you
need to try turning the computer off and on again.

Sorry I can't be of more help.


I-knew-I-should-have-paid-more-than-$2.95-for-a-magic-crystal-ball-ly y'rs,



-- 
Steven

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


Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread lucasfneves14
How did you do it?


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


Cryptographically strong random numbers

2015-10-16 Thread Steven D'Aprano
Hello folks,


Over on the Python-Dev mailing list there is an argument going on about PEP
506, the "secrets" module, for generating crypto random numbers and tokens.

If you have written crypto code that needs random numbers as described
below, I am looking for your feedback.

Python-Dev is arguing about which of the following three functions should be
included:

randbelow(end):
return a random integer in the half-open interval 0...end
(including 0, excluding end)

randint(start, end):
return a random integer in the closed interval start...end
(including both start and end)

randrange([start=0,] end [, step=1]):
return a random integer in the half-open range(start, stop, step)


It has been claimed that most applications of crypto random numbers will
only need to generate them in the half-open range 0...end (excluding end).
If you have experience with using crypto random numbers, do you agree?
Which of the three functions would you use?


Please note that nothing will change about the random module and it's API.
If you are worried that random.randint will be removed, or
random.randrange, don't be concerned, that is completely off the cards.
This discussion is purely about what will be offered in the "secrets"
module.

https://www.python.org/dev/peps/pep-0506/


-- 
Steven

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


Re: Cryptographically strong random numbers

2015-10-16 Thread Marko Rauhamaa
Steven D'Aprano :

> Python-Dev is arguing about which of the following three functions should be
> included:
>
> randbelow(end):
> return a random integer in the half-open interval 0...end
> (including 0, excluding end)
>
> randint(start, end):
> return a random integer in the closed interval start...end
> (including both start and end)
>
> randrange([start=0,] end [, step=1]):
> return a random integer in the half-open range(start, stop, step)
>
>
> It has been claimed that most applications of crypto random numbers
> will only need to generate them in the half-open range 0...end
> (excluding end). If you have experience with using crypto random
> numbers, do you agree? Which of the three functions would you use?

I wouldn't really ever *need* anything but randbelow(). It has the most
natural semantics for "end."

However, why not emulate the random module?

   secrets.randrange(stop)
   secrets.randrange(start, stop[, step])
   secrets.randint(a, b)

IOW, keep each function and name them (as well as the arguments) exactly
the same.


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


Re: Cryptographically strong random numbers

2015-10-16 Thread Brian Gladman
On 16/10/2015 17:25, Steven D'Aprano wrote:
> Hello folks,

[snip detail]

> randbelow(end):
> return a random integer in the half-open interval 0...end
> (including 0, excluding end)
> 
> randint(start, end):
> return a random integer in the closed interval start...end
> (including both start and end)
> 
> randrange([start=0,] end [, step=1]):
> return a random integer in the half-open range(start, stop, step)

I don't see the third option as being of much, if any, use. Either of
the first two would be fine.

Of these two, I personally prefer randbelow because it is consistent
with what I expect from ranges in Python (randint() always disappoints
me because it is inconsistent in this respect).

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


Re: Cryptographically strong random numbers

2015-10-16 Thread Oscar Benjamin
On Fri, 16 Oct 2015 18:16 Marko Rauhamaa  wrote:

Steven D'Aprano :

> Python-Dev is arguing about which of the following three functions should
be
> included:
>
> randbelow(end):
> return a random integer in the half-open interval 0...end
> (including 0, excluding end)
>
> randint(start, end):
> return a random integer in the closed interval start...end
> (including both start and end)
>
> randrange([start=0,] end [, step=1]):
> return a random integer in the half-open range(start, stop, step)
>
>
> It has been claimed that most applications of crypto random numbers
> will only need to generate them in the half-open range 0...end
> (excluding end). If you have experience with using crypto random
> numbers, do you agree? Which of the three functions would you use?

I wouldn't really ever *need* anything but randbelow(). It has the most
natural semantics for "end."

However, why not emulate the random module?

   secrets.randrange(stop)
   secrets.randrange(start, stop[, step])
   secrets.randint(a, b)

IOW, keep each function and name them (as well as the arguments) exactly
the same.



Given that the random module API won't change and is already known by many
people that would be simple to understand. Also it makes it trivially easy
to correct insecure RNG usage where needed.

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


Re: Cryptographically strong random numbers

2015-10-16 Thread Peter Pearson
On Sat, 17 Oct 2015 03:25:03 +1100, Steven D'Aprano  wrote:
[snip]
> randbelow(end):
> return a random integer in the half-open interval 0...end
> (including 0, excluding end)
>
> randint(start, end):
> return a random integer in the closed interval start...end
> (including both start and end)
>
> randrange([start=0,] end [, step=1]):
> return a random integer in the half-open range(start, stop, step)

Having done quite a bit of serious crypto implementation over the past
25 years, I don't recall ever wanting anything like randrange, and if
I *did* need it, I'd probably build it inline from randbelow rather than
force some hapless future code maintainer to look up the specs on randrange.

My opinion, FWIW: I like randbelow, because in modern crypto one very
frequently works with integers in the range [0,M-1] for some large
modulus M, and there is a constant risk of asking for something in [0,M]
when one meant [0,M-1].  One can eliminate this risk, as randbelow does,
by building in the -1, which normally introduces a risk of making a
mistake that gives you [0,M-2], but the name "randbelow" seems like a
neat fix to that problem.

I can see the attraction of randint for programming languages that have
limited ranges of integers, since randint lets you specify the whole range
of positive integers without having to pass an argument that is outside
that range.  Take a moment to savor the joy of Python.

-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip problem

2015-10-16 Thread Denis McMahon
On Fri, 16 Oct 2015 11:50:11 +0300, Antti Lagus wrote:

> hello,
> 
> installed pyton3.5 to NOT default folder.
> tried to install cx_Freeze, but countered errors where pip tried to
> copy/import stuff from default install location.
> 
> please fix

Hi, I waved my magic wand, and your problem should be fixed. If your 
problem is not fixed, manual intervention may be needed. We can probably 
tell you what you need to do, but more details of the problem are needed 
first.

What OS?

Where did you get python from and What command are you using to install 
it?

Do you have all the permissions needed to write to the directories you're 
asking it to put files in?

Did you run the installation process with those permissions?

-- 
Denis McMahon, [email protected]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cryptographically strong random numbers

2015-10-16 Thread Jon Ribbens
On 2015-10-16, Steven D'Aprano  wrote:
> If you have written crypto code that needs random numbers as described
> below, I am looking for your feedback.
>
> Python-Dev is arguing about which of the following three functions should be
> included:
>
> randbelow(end):
> return a random integer in the half-open interval 0...end
> (including 0, excluding end)
>
> randint(start, end):
> return a random integer in the closed interval start...end
> (including both start and end)
>
> randrange([start=0,] end [, step=1]):
> return a random integer in the half-open range(start, stop, step)
>
>
> It has been claimed that most applications of crypto random numbers will
> only need to generate them in the half-open range 0...end (excluding end).
> If you have experience with using crypto random numbers, do you agree?
> Which of the three functions would you use?

Given that the latter incorporates all of the functionality of the
former two without being noticeably more complicated, I don't see
why it isn't the obvious one to go for.

Also, isn't uuid4() an obvious shoo-in for this module too?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip problem

2015-10-16 Thread Mark Lawrence

On 16/10/2015 09:50, Antti Lagus wrote:

hello,

installed pyton3.5 to NOT default folder.
tried to install cx_Freeze, but countered errors where pip tried to
copy/import stuff from default install location.

please fix



Please fix what?  What do you think we are?  No mention of your 
platform, nothing precise about what you've tried or the precise error 
message(s).  Please try again, this isn't stackoverflow or reddit, 
you'll find professionals here who work on facts.


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread Mark Lawrence

On 16/10/2015 10:44, lucasfneves14 wrote:

How did you do it?



I conned my way in, nobody suspected it.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread Grant Edwards
On 2015-10-16, lucasfneves14  wrote:

> How did you do it?

I just climbed in and pushed the button.  Same as always.

-- 
Grant Edwards   grant.b.edwardsYow! This MUST be a good
  at   party -- My RIB CAGE is
  gmail.combeing painfully pressed up
   against someone's MARTINI!!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread Random832
lucasfneves14  writes:

> How did you do it?

That's an impressive reply gap. 

If anyone's wondering, this is apparently in reply to this from March:
http://thread.gmane.org/gmane.comp.python.general/774441

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


Re: help(string) commands not working on pyton 3.5

2015-10-16 Thread eryksun
On 10/16/15, Prasad Joshi  wrote:
>
> I am using windows 10.
>
 import math


 help (math)
> 'more' is not recognized as an internal or external command,
> operable program or batch file.

What do you get for the following?

import os
windir = os.environ['SystemRoot']
more_path = os.path.join(windir, 'System32', 'more.com')
print(os.path.exists(more_path))

If more.com doesn't exist, your Windows installation needs to be
repaired. If it does exist, then probably PATHEXT is missing .COM.
Ensure it's listed in the output of the following:

import os
print(os.environ['PATHEXT'])
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: TCP sockets python timeout public IP adresss

2015-10-16 Thread sohcahtoa82
On Friday, October 16, 2015 at 2:44:53 AM UTC-7, lucasfneves14 wrote:
> How did you do it?

I took the advice of just being myself.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Idle subprocess error

2015-10-16 Thread Gene Heskett
On Friday 16 October 2015 03:22:55 Chris Angelico wrote:

> On Fri, Oct 16, 2015 at 12:08 PM, briankeithroby--- via Python-list
>
>  wrote:
> > Idle subprocess error cant use editor.
> >
> >
> > Sent from Windows Mail
>
> Email error insufficient data.
>
> Sent from a person who's unable to make something out of nothing.
>
> ChrisA

Not even a molehill?

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page 
-- 
https://mail.python.org/mailman/listinfo/python-list


How to log the output from the multiple telnet sessions to separate log file

2015-10-16 Thread manjunatha . mahalingappa
Hello All,

I'm very much new to python. 
I'm doing the automation for networking device testing , I will be opening the 
4 telnet session, and doing some testing operations on each of those  telnet 
sessions and capture or log the respective output in 4 different log files. As 
of now all the 4 log files have the same  content  kindly help me to  log the 
output respective log file.

Code snippet is given below:

import sys
import PmTelnet2
import logging
import re
import time

class Logger():
def __init__(self,log):
self.terminal = sys.stdout
self.log = log

def write(self, message):
self.terminal.write(message)
self.log.write(message)


#This function is to open the telnet session  and open the file for each device.
def IP_port(file) :
global Testbed_info
Testbed_info = []
F = open(file, 'r')
F.seek(0)
line = F.read()
tuples = re.findall(r'(.+ \d)\s+(.+?)\s+(\d+)', line)
for (dname, ip, port) in tuples :
logfile = dname.replace(" ","") + ".log"
log = open(logfile, "a")
Telnet_handle=PmTelnet2.TelnetSession(ip,port)
sys.stdout =Logger(log)
tuple = (dname, ip, port, Telnet_handle)
Testbed_info.append(tuple)
#T.append(T1)
return(Testbed_info)


# Here I'm  passing the device name, IP, port details using the IP_port.txt file

file = '/users/manmahal/MANJU/IP_port.txt'
Testbed_info = IP_port(file)


#Here I'm using the  telnet object to execute some command, What ever I execute 
here on each telnet session to be logged into separate log file.

for (dname, ip, port, Telnet, fp ) in Testbed_info :
My_handle = Telnet
My_handle.Write("\n")
My_handle.Write("show config \n")
time.sleep(2)
print My_handle.ReadBuffer()

Content of the IP_port file is as below:
-
RSP 0   172.27.40.602001
RSP 1   172.27.40.602002
LC 0172.27.40.602010
LC 1172.27.40.592011


Please note that total number of the  telnet session may change as requirement 
of Testing. Hence It would be great if some give me generic solution to log the 
 log messages for each telnet session and output should to logged into 
respective log file. 
 
Thanks in advance...!!

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


[no subject]

2015-10-16 Thread 513-3M1L1X- TR19
Hello I was trying to install python35 on my windows laptop and I am told that 
the python35.dll files is missing 
Tried to repair many times but still the same problem.
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: help(string) commands not working on pyton 3.5

2015-10-16 Thread Prasad Joshi
Thanks for the reply.

I am using windows 10. 

>>> import math
>>>
>>>
>>> help (math)
'more' is not recognized as an internal or external command,
operable program or batch file.

>>> help
Type help() for interactive help, or help(object) for help about object.
>>> help(math)
'more' is not recognized as an internal or external command,
operable program or batch file.

>>>
>>> help(print)
'more' is not recognized as an internal or external command,
operable program or batch file.

>>>

Also help worked when I switched to plain integer as you mentioned below but 
looks like it didn't save it. 

Btw - I am pretty new to python hence asking these questions. 

Thanks again!
Prasad Joshi. 

-Original Message-
From: eryksun [mailto:[email protected]] 
Sent: Thursday, October 15, 2015 5:41 AM
To: [email protected]
Cc: Prasad Joshi 
Subject: Re: help(string) commands not working on pyton 3.5

On 10/14/15, Prasad Joshi  wrote:
> Hi,
>
> I have installed the "Windows x86-64 executable 
> installer"
> on my desktop but I cannot get help ( ) or help (string) command working.
> What could be an issue?
>

It may help to know which version of Windows you're using -- XP, Vista, 7, 8, 
or 10?

help() may work after switching to a plain pager:

import pydoc
pydoc.pager = pydoc.plainpager

in which case, check whether the following prints "test":

pydoc.tempfilepager('test', 'more <')

If not, please reply with the traceback or error message, if any.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to log the output from the multiple telnet sessions to separate log file

2015-10-16 Thread Chris Angelico
On Sat, Oct 17, 2015 at 4:47 PM,   wrote:
> class Logger():
> def __init__(self,log):
> self.terminal = sys.stdout
> self.log = log
>
> def write(self, message):
> self.terminal.write(message)
> self.log.write(message)
>
>
> for (dname, ip, port) in tuples :
> sys.stdout =Logger(log)

Every time you construct a Logger, it snapshots the previous value of
sys.stdout. By the time you've set them all up, sys.stdout is the last
Logger created, which will chain to the one created previous to it,
then the one before that, and finally to the actual console.

Do you need to use sys.stdout at all? It would be a lot easier to
ignore stdout and just write your logs directly to files.

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


Re: How to log the output from the multiple telnet sessions to separate log file

2015-10-16 Thread dieter
[email protected] writes:
> I'm very much new to python. 
> I'm doing the automation for networking device testing , I will be opening 
> the 4 telnet session, and doing some testing operations on each of those  
> telnet sessions and capture or log the respective output in 4 different log 
> files.

Personally, I find it a bit strange that each (telnet) session
should get its own logfile, but, if that is what you need, I would
approach it as follows:

  * define a class "TelnetSession"; create a logger in its "__init__" method;
use this logger for all operations inside a "TelnetSession"

  * instantiate the class "TelnetSession" for each telnet session you
want to open.
Use those objects method to operate on the sessions.

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