Re: Python - decode('hex')

2017-02-20 Thread Ganesh Pal
Got it , MRAB, Thanks for the explanation it was such a simple thing I was breaking my head over it On Tue, Feb 21, 2017 at 1:34 AM, MRAB wrote: > On 2017-02-20 19:43, Ganesh Pal wrote: > >> On Feb 21, 2017 12:17 AM, "Rhodri James" wrote: >> >> On 20/02/17 17:55, Ganesh Pal wrote: >> >> 1. T

integer nth roots for arbitrary sized integer

2017-02-20 Thread jzakiya
FYI for people who need this. I was looking here http://www.codecodex.com/wiki/Calculate_an_integer_square_root for an efficient/fast algorithm for computing integer squareroots. Based on one of the C version examples, I think this is the most efficient/fastest that always produces correct res

RE: Python application launcher (for Python code)

2017-02-20 Thread Deborah Swanson
Steve D'Aprano wrote, on February 20, 2017 5:25 PM > > On Tue, 21 Feb 2017 02:44 am, Deborah Swanson wrote: > > [...] > > Basically, I now have quite a few Python programs I use frequently, > > and as time goes on my collection and uses of it will grow. > Right now > > I just want a way to sel

RE: Python application launcher (for Python code)

2017-02-20 Thread Deborah Swanson
Simon Ward wroe, on February 20, 2017 4:36 PM > > On 20 February 2017 22:56:31 GMT+00:00, Deborah Swanson > wrote: > > Basically, I now have quite a few Python programs I use frequently, > > and as time goes on my collection and uses of it will grow. Right now > > I just want a way to select w

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Tim Chase
On 2017-02-21 00:04, Peter Otten wrote: > Tim Chase wrote: >> On 2017-02-20 10:45, Peter Otten wrote: >>> value = parser.get("section-1", "option-1", fallback="default >>> value") >> >> Huh. Do you remember when this was added? > > I don't use configparser regularly, so I had to look around myse

RE: Python application launcher (for Python code)

2017-02-20 Thread Deborah Swanson
Ben Finney wrote, on February 20, 2017 5:50 PM > > "Deborah Swanson" writes: > > > Basically, I now have quite a few Python programs I use frequently, > > and as time goes on my collection and uses of it will grow. Right now > > I just want a way to select which one I'd like to run and run it.

RE: Python application launcher (for Python code)

2017-02-20 Thread Deborah Swanson
Steve D'Aprano wrote, on February 20, 2017 4:53 PM > > On Tue, 21 Feb 2017 04:04 am, Deborah Swanson wrote: > > > That's a good idea, you can do just about anything from a shell, and I > > read that Linus Torvalds never uses anything except the shell. > [...] > > Since I will be in Windows for y

Re: Python application launcher (for Python code)

2017-02-20 Thread Ben Finney
"Deborah Swanson" writes: > Basically, I now have quite a few Python programs I use frequently, and > as time goes on my collection and uses of it will grow. Right now I just > want a way to select which one I'd like to run and run it. I'd like it > to be a standalone application and some sort of

RE: Python application launcher (for Python code)

2017-02-20 Thread Steve D'Aprano
On Tue, 21 Feb 2017 02:44 am, Deborah Swanson wrote: [...] > Basically, I now have quite a few Python programs I use frequently, and > as time goes on my collection and uses of it will grow. Right now I just > want a way to select which one I'd like to run and run it. I'd like it > to be a standal

RE: Python application launcher (for Python code)

2017-02-20 Thread Simon Ward
On 20 February 2017 22:56:31 GMT+00:00, Deborah Swanson wrote: > Basically, I now have quite a few Python programs I use frequently, > and > as time goes on my collection and uses of it will grow. Right now I > just > want a way to select which one I'd like to run and run it A Python applicati

RE: Python application launcher (for Python code)

2017-02-20 Thread Steve D'Aprano
On Tue, 21 Feb 2017 04:04 am, Deborah Swanson wrote: > That's a good idea, you can do just about anything from a shell, and I > read that Linus Torvalds never uses anything except the shell. [...] > Since I will be in Windows for yet awhile, it would be ideal to find an > application that will wor

Re: Python - decode('hex')

2017-02-20 Thread Steve D'Aprano
On Tue, 21 Feb 2017 06:43 am, Ganesh Pal wrote: > How can I make my program 2 look like program 1 I don't understand the question. If you want program 2 to look like program 1, you can edit program 2 and change it to look like program 1. But why not just use program 1? It already looks like progr

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Peter Otten
Tim Chase wrote: > On 2017-02-20 10:45, Peter Otten wrote: >> value = parser.get("section-1", "option-1", fallback="default >> value") > > Huh. Do you remember when this was added? I see it in the 3.x docs, > but not the 2.x docs. I remember writing my own wrappers multiple > times for exactly

RE: Python application launcher (for Python code)

2017-02-20 Thread Deborah Swanson
Kevin Walzer wrote, on February 20, 2017 1:15 PM > > On 2/19/17 10:01 PM, Deborah Swanson wrote: > > I could probably write this myself, but I'm wondering if > this hasn't > > already been done many times. Anyone have some git links or other > > places to download from? > > > What do you mean

Re: Python application launcher (for Python code)

2017-02-20 Thread Kevin Walzer
On 2/19/17 10:01 PM, Deborah Swanson wrote: I could probably write this myself, but I'm wondering if this hasn't already been done many times. Anyone have some git links or other places to download from? What do you mean by "application launcher"? It's not more complicated than "python my scri

Re: Python - decode('hex')

2017-02-20 Thread MRAB
On 2017-02-20 19:43, Ganesh Pal wrote: On Feb 21, 2017 12:17 AM, "Rhodri James" wrote: On 20/02/17 17:55, Ganesh Pal wrote: 1. The only difference between both the programs the difference are just the below lines. newdata = '64000101057804'.decode('hex') and newdata = "" newdata =

Re: Python - decode('hex')

2017-02-20 Thread Ganesh Pal
On Feb 21, 2017 12:17 AM, "Rhodri James" wrote: On 20/02/17 17:55, Ganesh Pal wrote: > 1. The only difference between both the programs the difference are just > the below lines. > > newdata = '64000101057804'.decode('hex') > > and > > newdata = "" > newdata = '64000101057804' > newdata

Re: Python - decode('hex')

2017-02-20 Thread MRAB
On 2017-02-20 17:55, Ganesh Pal wrote: Hello Python world, I am on Linux and Python 2.7 , I need some help to figure out what is going wrong in the below piece of code I am trying to replace seven bytes in the hexdumfile at a given offset Program 1 works fine #!/usr/bin/python from qa.uti

Re: Python - decode('hex')

2017-02-20 Thread Rhodri James
On 20/02/17 17:55, Ganesh Pal wrote: 1. The only difference between both the programs the difference are just the below lines. newdata = '64000101057804'.decode('hex') and newdata = "" newdata = '64000101057804' newdata.decode('hex') What is happening here and how do I fix this in

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Tim Chase
On 2017-02-20 10:45, Peter Otten wrote: > value = parser.get("section-1", "option-1", fallback="default > value") Huh. Do you remember when this was added? I see it in the 3.x docs, but not the 2.x docs. I remember writing my own wrappers multiple times for exactly these purposes, even to the

Python - decode('hex')

2017-02-20 Thread Ganesh Pal
Hello Python world, I am on Linux and Python 2.7 , I need some help to figure out what is going wrong in the below piece of code I am trying to replace seven bytes in the hexdumfile at a given offset Program 1 works fine #!/usr/bin/python from qa.utils.easy_popen import run import pdb def

RE: Python application launcher (for Python code)

2017-02-20 Thread Deborah Swanson
Grant Edwards wrote, on February 20, 2017 7:37 AM > > On 2017-02-20, Deborah Swanson wrote: > > > I could probably write this myself, but I'm wondering if > this hasn't > > already been done many times. > > Yes, it has. > > > Anyone have some git links or other places to download from? > >

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Ian Pilcher
On 02/20/2017 03:45 AM, Peter Otten wrote: You can provide a default value in your code with parser = configparser.ConfigParser() parser.read(configfile) value = parser.get("section-1", "option-1", fallback="default value") Perfect. Thank you! -- =

RE: Python application launcher (for Python code)

2017-02-20 Thread Deborah Swanson
I should also say that right now I'm using Windows XP, but hope very soon to have Linux again. Ideally, this launcher would work in both. I wrote, on February 20, 2017 7:44 AM > > Ben Finney wrote, on February 19, 2017 11:27 PM > > > > "Deborah Swanson" writes: > > > > > I could probably writ

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Ian Pilcher
On 02/20/2017 01:39 AM, Ben Finney wrote: I think you misinderstand the semantics of what ‘configparser’ expects https://docs.python.org/3/library/configparser.html#configparser-objects>: You are absolutely correct. Thank you! -- ===

RE: Python application launcher (for Python code)

2017-02-20 Thread Deborah Swanson
Ben Finney wrote, on February 19, 2017 11:27 PM > > "Deborah Swanson" writes: > > > I could probably write this myself, but I'm wondering if this hasn't > > already been done many times. > > Can you describe what you are looking for, in enough detail > that we can know whether it's already be

Re: Python application launcher (for Python code)

2017-02-20 Thread Grant Edwards
On 2017-02-20, Deborah Swanson wrote: > I could probably write this myself, but I'm wondering if this hasn't > already been done many times. Yes, it has. > Anyone have some git links or other places to download from? See the "website" and "repository" links on the pages below: https://en.wik

Re: Noob confused by ConfigParser defaults

2017-02-20 Thread Peter Otten
Ian Pilcher wrote: > I am trying to use ConfigParser for the first time (while also writing > my first quasi-serious Python program). Assume that I want to parse a > a configuration file of the following form: > >[section-1] >option-1 = value1 >option-2 = value2 > >[section-2] >