Re: New to Python - Career question

2017-06-14 Thread Larry Martell
On Sat, Jun 10, 2017 at 3:51 AM, Paul Rubin wrote: > Larry Martell writes: >> I can tell they think I am old and they dismiss me right away. > > http://oldgeekjobs.com ? Cool! Thanks! Sharing with all my old nerdy friends. -- https://mail.python.org/mailman/listinfo/python-list

python nmap for loop

2017-06-14 Thread SS
I'm trying to make the following code work: import os, sys app=['host1', 'host2', 'host3'] for i in app: os.system('nmap -p 22 -P0 %s | grep open 2>&1 > /dev/null && echo "%s up" I've tried many different iterations of the os.system call, how to make this work? TIA -- https://mail.pytho

dont exetute my exe after decompile and change code

2017-06-14 Thread Xristos Xristoou
i have an .exe file where file compiled by py2exe in my .exe folder i have some .dll files one .exe file and library.zip file and inside this zip i have to many .pyccombile files. i have decompile this files from library.zip using this program and that program create me new file where i can s

Re: python nmap for loop

2017-06-14 Thread Skip Montanaro
> I'm trying to make the following code work: > ... It seems fairly clear that you've posted code which couldn't possibly run (missing a closing quote and right paren). Let me suggest: 1. You copy and paste directly from a Python (or IPython/Jupyter/IDLE) session, including prompts and output. 2

Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Malcolm Greene
Wondering if there's a standard lib version of something like enumerate() that takes a max count value? Use case: When you want to enumerate through an iterable, but want to limit the number of iterations without introducing if-condition-break blocks in code. Something like: for counter, key in en

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Peter Otten
Malcolm Greene wrote: > Wondering if there's a standard lib version of something like > enumerate() that takes a max count value? > Use case: When you want to enumerate through an iterable, but want to > limit the number of iterations without introducing if-condition-break > blocks in code. > Some

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Jussi Piitulainen
Malcolm Greene writes: > Wondering if there's a standard lib version of something like > enumerate() that takes a max count value? > Use case: When you want to enumerate through an iterable, but want to > limit the number of iterations without introducing if-condition-break > blocks in code. > Som

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Malcolm Greene
Thank you Peter and Jussi - both your solutions were very helpful! Malcolm -- https://mail.python.org/mailman/listinfo/python-list

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Andre Müller
I'm a fan of infinite sequences. Try out itertools.islice. You should not underestimate this very important module. Please read also the documentation: https://docs.python.org/3.6/library/itertools.html from itertools import islice iterable = range(100) # since Python 3 range is a lazy e

Ciphers in SSL library python.

2017-06-14 Thread djnight538
Hey, I want to use RC4-SHA in python, but when I try to use it, it doesn't get used (If I do cipher() it says none(and handshake fails too)), I've tried to modify the SSL library, but it didn't help at all(Maybe I did something wrong, any help will be appreciated). Is there a way to use the RC4-

Re: Ciphers in SSL library python.

2017-06-14 Thread Ray Cote
1: Are you 100% sure the server to which you are trying to connect supports RC4-SHA? 2: If you have access to the server, turn on SSH debug mode to watch your client try and connect. I find that to be helpful in debugging many connection issues. On Wed, Jun 14, 2017 at 4:16 PM, wrote: > Hey, I

Error while Importing Teradata in Python

2017-06-14 Thread mradul dhakad
Hi All , I am new to python .I have installed 3.6.1 python on my computer. when i am trying to import teradata i am getting below error message: Traceback (most recent call last) File "C:\Users\mradul_dhakad\AppData\Local\Programs\Python\ Python36\Hello.py", line 1, in import teradata ModuleNot F

API Help

2017-06-14 Thread Bradley Cooper
I am working with an API and I get a return response in this format. [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","quantityAvailable":0.0},{"warehouseCode":"TX-1-US","quantityAvailable":14.000

Re: API Help

2017-06-14 Thread Chris Angelico
On Thu, Jun 15, 2017 at 6:33 AM, Bradley Cooper wrote: > I am working with an API and I get a return response in this format. > > > [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","quantityAvailable":0.0},

Re: Ciphers in SSL library python.

2017-06-14 Thread djnight538
To Ray Cote: Hey, I'm "the server(I've written using ssl/socket)" and my client is using RC4-SHA, but I can't make the server to use it. I make " ciphers='RC4-SHA' " in the ssl.wrap_socket. Do I need to modify SSL file or something to make it work? -- https://mail.python.org/mailman/listinfo/

Re: API Help

2017-06-14 Thread Erik
On 14/06/17 21:38, Chris Angelico wrote: On Thu, Jun 15, 2017 at 6:33 AM, Bradley Cooper wrote: I am working with an API and I get a return response in this format. [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US"

Re: API Help

2017-06-14 Thread Bradley Cooper
Yes it is not json, I did try that with no luck. -- https://mail.python.org/mailman/listinfo/python-list

Re: API Help

2017-06-14 Thread Erik
On 14/06/17 21:47, Erik wrote: What makes it look like JSON to you? (I'm not arguing, I'm asking what I've missed). If I cut-and-paste the OP's structure into the REPL, it replies with a valid Python structure that's equivalent (albeit with single-quotes instead of double-quotes). So I gues

Re: API Help

2017-06-14 Thread Grant Edwards
On 2017-06-14, Erik wrote: > On 14/06/17 21:38, Chris Angelico wrote: >> On Thu, Jun 15, 2017 at 6:33 AM, Bradley Cooper >> wrote: >>> I am working with an API and I get a return response in this format. >>> >>> >>> {"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailabl

Re: API Help

2017-06-14 Thread Matt Wheeler
On Wed, 14 Jun 2017 at 21:47 Erik wrote: > On 14/06/17 21:38, Chris Angelico wrote: > > On Thu, Jun 15, 2017 at 6:33 AM, Bradley Cooper > > wrote: > >> I am working with an API and I get a return response in this format. > >> > >> > >> > [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT

Re: API Help

2017-06-14 Thread Chris Angelico
On Thu, Jun 15, 2017 at 6:47 AM, Erik wrote: > On 14/06/17 21:38, Chris Angelico wrote: >> >> On Thu, Jun 15, 2017 at 6:33 AM, Bradley Cooper >> wrote: >>> >>> I am working with an API and I get a return response in this format. >>> >>> >>> >>> [{"itemNumber":"75-5044","inventory":[{"warehouseCod

Re: API Help

2017-06-14 Thread Erik
On 14/06/17 22:18, Grant Edwards wrote: What makes it look like JSON to you? The fact that it _is_ valid JSON (at least according to the parsers I've tried on it, both locally and using things like jsonlint.com). And I tried it on the Python REPL. It's Python too. If someone wrote the follow

Re: API Help

2017-06-14 Thread Erik
On 14/06/17 22:16, Matt Wheeler wrote: ? JSON keys are quoted Thanks Matt, I was confusing myself between JS source and JSON. Good to have this reminder (I always use libraries for reading and writing JSON in whatever language, so while I view it often I very rarely have to type it in direc

Re: API Help

2017-06-14 Thread Peter Otten
Bradley Cooper wrote: > Yes it is not json, I did try that with no luck. What exactly did you try and how did it fail? -- https://mail.python.org/mailman/listinfo/python-list

Re: Ciphers in SSL library python.

2017-06-14 Thread Ray Cote
On Wed, Jun 14, 2017 at 4:40 PM, wrote: > Hey, I'm "the server(I've written using ssl/socket)" and my client is > using RC4-SHA, but I can't make the server to use it. I make " > ciphers='RC4-SHA' " in the ssl.wrap_socket. Do I need to modify SSL file or > something to make it work? Had not rea

Re: API Help

2017-06-14 Thread Ray Cote
On Wed, Jun 14, 2017 at 4:33 PM, Bradley Cooper wrote: > I am working with an API and I get a return response in this format. > > > [{"itemNumber":"75-5044","inventory":[{"warehouseCode":" > UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US"," > quantityAvailable":0.

Re: API Help

2017-06-14 Thread Andre Müller
Am 14.06.2017 um 22:33 schrieb Bradley Cooper: > I am working with an API and I get a return response in this format. > > > [{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","quantityAvailable":0.0},{"wareh

Re: API Help

2017-06-14 Thread Erik
On 14/06/17 22:54, Ray Cote wrote: Definitely JSON: json.loads(“""[{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","quantityAvailable":0.0},{"warehouseCode":"TX-1-US","quantityAvailable":14.

Re: API Help

2017-06-14 Thread Erik
On 14/06/17 22:30, Chris Angelico wrote: It wouldn't be the repr() of a Python structure, as that wouldn't have all those trailing zeroes. That depends on what class represents those float values. It doesn't have to be the built-in float. Same with the double-quotes instead of single-quotes o

Re: API Help

2017-06-14 Thread Grant Edwards
On 2017-06-14, Erik wrote: > On 14/06/17 22:54, Ray Cote wrote: >> Definitely JSON: > >> json.loads(“""[{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","quantityAvailable":0.0},{"warehouseCode":"TX-1-US

Re: API Help

2017-06-14 Thread justin walters
On Wed, Jun 14, 2017 at 3:49 PM, Grant Edwards wrote: > On 2017-06-14, Erik wrote: > > On 14/06/17 22:54, Ray Cote wrote: > >> Definitely JSON: > > > >> json.loads(“""[{"itemNumber":"75-5044","inventory":[{" > warehouseCode":"UT-1-US","quantityAvailable":0.0},{" > warehouseCode":

Re: API Help

2017-06-14 Thread Rob Gaddi
On 06/14/2017 03:49 PM, Grant Edwards wrote: On 2017-06-14, Erik wrote: On 14/06/17 22:54, Ray Cote wrote: Definitely JSON: json.loads(“""[{"itemNumber":"75-5044","inventory":[{"warehouseCode":"UT-1-US","quantityAvailable":0.0},{"warehouseCode":"KY-1-US","quantityAvailable":0.00

Re: API Help

2017-06-14 Thread justin walters
On Wed, Jun 14, 2017 at 4:06 PM, justin walters wrote: > > > On Wed, Jun 14, 2017 at 3:49 PM, Grant Edwards > wrote: > >> On 2017-06-14, Erik wrote: >> > On 14/06/17 22:54, Ray Cote wrote: >> >> Definitely JSON: >> > >> >> json.loads(“""[{"itemNumber":"75-5044","inventory":[{"wareho >> useC

Re: API Help

2017-06-14 Thread Erik
On 15/06/17 00:08, justin walters wrote: I should also specify that the data you have received is malformed. JSON should always have an object as the top level structure, not an array as in your data. So it's not JSON then? :D E. -- https://mail.python.org/mailman/listinfo/python-list

Re: API Help

2017-06-14 Thread Grant Edwards
On 2017-06-14, justin walters wrote: > I should also specify that the data you have received is malformed. > > JSON should always have an object as the top level structure, not an > array as in your data. Where is that requirement stated? RFC7159 explicitly states that a "conforming JSON text

Re: API Help

2017-06-14 Thread Chris Angelico
On Thu, Jun 15, 2017 at 8:34 AM, Erik wrote: > On 14/06/17 22:30, Chris Angelico wrote: >> >> It wouldn't be the repr() of a Python structure, as that wouldn't have >> all those trailing zeroes. > > > That depends on what class represents those float values. It doesn't have to > be the built-in fl

How do you use Python 3.5 and Python 3.6 in production

2017-06-14 Thread Amirouche Boubekki
Héllo, I'd like to use Python 3.5 or Python 3.6 in production but avoid the use of pip and virtualenv. Is there a solution based on a popular GNU/Linux distribution that allows to keep up with the release of Python 3.x and various other highly prolific project but still young like aiohttp? What

Re: API Help

2017-06-14 Thread Erik
On 15/06/17 00:45, Chris Angelico wrote: Add all that kind of thing together, and you get my original conclusion that this is JSON. It's also perfectly parseable as various other things, but it's still most likely to be JSON. It "is JSON" but is also "parsable as various other things" yet is "m

Re: Converting epoch to string in format yyyy-mm-dd, or maybe it is not necessary

2017-06-14 Thread Andre Müller
I'm not familar with pandas. If you look on stackoverfolow you'll find this solution: df.epoch = pd.to_datetime(df.epoch) https://stackoverflow.com/questions/17134716/convert-dataframe-column-type-from-string-to-datetime But in this case, it's not a plain string, then it's a datetime object. Gr

Re: How do you use Python 3.5 and Python 3.6 in production

2017-06-14 Thread Andre Müller
Hi, I'm using Arch Linux. There is currently Python 3.6 the standard interpreter. But I think it's not good to use this in production. Hm, maybe pyenv can be an distribution independent solution: https://github.com/pyenv/pyenv If you're using pyenv, then you'll have some build dependencies. One t

Re: API Help

2017-06-14 Thread Ray Cote
On Wed, Jun 14, 2017 at 6:14 PM, Erik wrote: > On 14/06/17 22:54, Ray Cote wrote: > >> Definitely JSON: >> >>> > json.loads(“""[{"itemNumber":"75-5044","inventory":[{"wareho >> useCode":"UT-1-US","quantityAvailable":0.0},{"wa >> rehouseCode":"KY-1-US","quantityAvailable":0.000

Re: API Help

2017-06-14 Thread Ned Batchelder
On Wednesday, June 14, 2017 at 7:06:39 PM UTC-4, justin walters wrote: > JSON and Python dictionaries have nearly the exact same syntax. That's why > working with > JSON in Python is such a joy! :) > > You can paste any valid JSON into a Python REPL and it will be interpreted > as a Python diction

Re: How do you use Python 3.5 and Python 3.6 in production

2017-06-14 Thread Chris Angelico
On Thu, Jun 15, 2017 at 9:46 AM, Amirouche Boubekki wrote: > I'd like to use Python 3.5 or Python 3.6 in production but avoid the use of > pip and virtualenv. > > Is there a solution based on a popular GNU/Linux distribution that allows > to keep up with the release of Python 3.x and various other

[OT] is JSON all that great? - was Re: API Help

2017-06-14 Thread Michael Torrie
On 06/14/2017 05:06 PM, justin walters wrote: > JSON in Python is such a joy! :) I understand that in this case the data is coming from a server in a form intended for easy use with Javascript. But other than this type of communication, I don't see any good reason to choose JSON as a data interch

data structure

2017-06-14 Thread Andrew Zyman
Hello, i wonder what would be a proper data structure for something with the following characteristics: id - number, obj[a..c] - objects of various classes the idea is to be able to update certain fields of these objects initially getting access to the record by ID something like this ( not wor

Re: API Help

2017-06-14 Thread justin walters
On Wed, Jun 14, 2017 at 4:40 PM, Grant Edwards wrote: > On 2017-06-14, justin walters wrote: > > > I should also specify that the data you have received is malformed. > > > > JSON should always have an object as the top level structure, not an > > array as in your data. > > Where is that require

Re: [OT] is JSON all that great? - was Re: API Help

2017-06-14 Thread Skip Montanaro
On Wed, Jun 14, 2017 at 9:33 PM, Michael Torrie wrote: > To me JSON seems to hold no real benefits over other serialization > techniques, including the XML beast. I guess we'll have to agree to disagree. XML is the Devil's spawn, hiding its real intent inside layer after layer of tags. In contras

Re: API Help

2017-06-14 Thread justin walters
On Wed, Jun 14, 2017 at 6:00 PM, Ned Batchelder wrote: > On Wednesday, June 14, 2017 at 7:06:39 PM UTC-4, justin walters wrote: > > JSON and Python dictionaries have nearly the exact same syntax. That's > why > > working with > > JSON in Python is such a joy! :) > > > > You can paste any valid JS

Re: [OT] is JSON all that great? - was Re: API Help

2017-06-14 Thread Grant Edwards
On 2017-06-15, Michael Torrie wrote: > On 06/14/2017 05:06 PM, justin walters wrote: >> JSON in Python is such a joy! :) 100% agreement here. > I understand that in this case the data is coming from a server in a > form intended for easy use with Javascript. But other than this > type of commun

Re: [OT] is JSON all that great? - was Re: API Help

2017-06-14 Thread justin walters
On Wed, Jun 14, 2017 at 7:33 PM, Michael Torrie wrote: > On 06/14/2017 05:06 PM, justin walters wrote: > > JSON in Python is such a joy! :) > > I understand that in this case the data is coming from a server in a > form intended for easy use with Javascript. But other than this type of > communi

Re: Converting epoch to string in format yyyy-mm-dd, or maybe it is not necessary

2017-06-14 Thread Pavol Lisy
(I am not very familiar with panda too!) In case of his data he needs to set unit to 's' df['dt'] = pd.to_datetime(df.epoch,unit='s') It return utc time from epoch, so maybe this is what he could use -> df['dt'] = df.epoch.apply(time.ctime) or something like (if he needs strings) -> df['dt']

Re: [OT] is JSON all that great? - was Re: API Help

2017-06-14 Thread Chris Angelico
On Thu, Jun 15, 2017 at 12:33 PM, Michael Torrie wrote: > To me JSON seems to hold no real benefits over other serialization > techniques, including the XML beast. XML may be verbose, but at least > XML data can be formally validated and formally transformed and queried, > which is certainly not t

Re: ensurepip

2017-06-14 Thread Steven D'Aprano
On Wed, 14 Jun 2017 07:00:13 +0200, Pavol Lisy wrote: > $ python3 -m ensurepip /usr/bin/python3: No module named ensurepip > > But maybe this help to understand: > > $ python -m ensurepip > ensurepip is disabled in Debian/Ubuntu for the system python. Ah, thanks! I don't get that error messa

Re: Standard lib version of something like enumerate() that takes a max count iteration parameter?

2017-06-14 Thread Jussi Piitulainen
Andre Müller writes: > I'm a fan of infinite sequences. Try out itertools.islice. > You should not underestimate this very important module. > > Please read also the documentation: > https://docs.python.org/3.6/library/itertools.html > > from itertools import islice > > iterable = range(10

Re: [OT] is JSON all that great? - was Re: API Help

2017-06-14 Thread Marko Rauhamaa
Chris Angelico : > XML is thus poorly suited to *most* forms of data, Correct. > > > aa > qq > qw > qe > as > > > What does this represent? A generic XML parser has to cope with it. I > gave this to a few XML-to-JSON converters, and they all interpreted it > as some variant of {"asd

Re: data structure

2017-06-14 Thread Frank Millman
"Andrew Zyman" wrote in message news:caprckxktozonlak8asizonkypd9y_p25fr2rkfkozxoa4bc...@mail.gmail.com... Hello, i wonder what would be a proper data structure for something with the following characteristics: id - number, obj[a..c] - objects of various classes the idea is to be able to upd

Re: [OT] is JSON all that great? - was Re: API Help

2017-06-14 Thread Gregory Ewing
Michael Torrie wrote: I don't find JSON any more human readable than XML to be honest, perhaps less so because there's no way to define a formal schema to follow, at least that I'm aware of. You mean like this? http://json-schema.org/ One thing I like better about JSON than XML as a serialisa