Re: Python failed... Repeatedly

2017-02-27 Thread Terry Reedy
On 2/27/2017 11:16 PM, Jarod Nash wrote: I have just started into python and this was my first time setting up my own software. I ended up with pycharm and chose the python 3.6 or whatever translator. Every time I run my hello world program I get the message "invalid translator" and I get several

Python failed... Repeatedly

2017-02-27 Thread Jarod Nash
I have just started into python and this was my first time setting up my own software. I ended up with pycharm and chose the python 3.6 or whatever translator. Every time I run my hello world program I get the message "invalid translator" and I get several pop ups giving me the options of custom se

Re: python-libxdo?

2017-02-27 Thread MRAB
On 2017-02-28 04:07, Jim wrote: I found this module by accident the other day and decided to try to use it to position some windows on my desktop. # Script to open and position program windows import subprocess from xdo import Xdo xdo = Xdo() subprocess.call('firefox') win = xdo.search_window

python-libxdo?

2017-02-27 Thread Jim
I found this module by accident the other day and decided to try to use it to position some windows on my desktop. # Script to open and position program windows import subprocess from xdo import Xdo xdo = Xdo() subprocess.call('firefox') win = xdo.search_windows(winname = 'Mozilla Firefox') x

Re: Usage of ast.

2017-02-27 Thread Chris Angelico
On Tue, Feb 28, 2017 at 11:35 AM, Jon Ribbens wrote: > Sorry, I must have missed something here. What are you talking about? > "lambda: [1,2,3]" is not acceptable input to ast.literal_eval(), it > will throw an exception. [1,2,3] is, though. Go read my previous posts. ChrisA -- https://mail.pyt

Re: Usage of ast.

2017-02-27 Thread Jon Ribbens
On 2017-02-27, Chris Angelico wrote: > On Tue, Feb 28, 2017 at 3:58 AM, Jon Ribbens > wrote: >> Seeing as most of it is code along the lines of "is this an integer >> constant? if so the value is that constant": no, I think "execution" >> is a misleading word to use. > > That's true of a lot of

Re: panda, column access

2017-02-27 Thread Andrew Zyman
On Monday, February 27, 2017 at 4:27:23 PM UTC-5, Pavol Lisy wrote: > On 2/27/17, Andrew Zyman wrote: > I think you meant: > colnames = ['hostname'] arh... Exactly. Now the rest is "unfolding". > What do you want is probably: > >>> data[colnames[0]].tolist() this is great and the rest of the

Re: panda, column access

2017-02-27 Thread Pavol Lisy
On 2/27/17, Andrew Zyman wrote: > Hello, > i'm trying to understand what is the difference between the below code. > And how do i access the column's data without hardcoding the column name in > such a way that i'll be able to convert it's values into the list of > strings? > > I appreciate your

panda, column access

2017-02-27 Thread Andrew Zyman
Hello, i'd appreciate an explanation about the differences in the code versions below. I'm trying to get the list of the strings out of the column and avoid hardcoding the column name. cat Data/2domain.csv hostname hostname1 hostname2 ... ... Working version(s): Python2.7: input_file = r'Data

panda, column access

2017-02-27 Thread Andrew Zyman
Hello, i'm trying to understand what is the difference between the below code. And how do i access the column's data without hardcoding the column name in such a way that i'll be able to convert it's values into the list of strings? I appreciate your help. Short version: colnames='hostname' da

Re: Usage of ast.

2017-02-27 Thread Chris Angelico
On Tue, Feb 28, 2017 at 3:58 AM, Jon Ribbens wrote: > On 2017-02-27, Chris Angelico wrote: >> On Tue, Feb 28, 2017 at 3:17 AM, Jon Ribbens >> wrote: >>> On 2017-02-27, Chris Angelico wrote: Actually it does execute, as you can see from the source code. >>> >>> I'm not sure what you mean b

Re: Usage of ast.

2017-02-27 Thread Jon Ribbens
On 2017-02-27, Chris Angelico wrote: > On Tue, Feb 28, 2017 at 3:17 AM, Jon Ribbens > wrote: >> On 2017-02-27, Chris Angelico wrote: >>> Actually it does execute, as you can see from the source code. >> >> I'm not sure what you mean by that. I was looking at the source code >> (and its history)

Re: Usage of ast.

2017-02-27 Thread Chris Angelico
On Tue, Feb 28, 2017 at 3:17 AM, Jon Ribbens wrote: > On 2017-02-27, Chris Angelico wrote: >> Actually it does execute, as you can see from the source code. > > I'm not sure what you mean by that. I was looking at the source code > (and its history) when I wrote my post, and I would be hard pushe

Re: Usage of ast.

2017-02-27 Thread Jon Ribbens
On 2017-02-27, Chris Angelico wrote: > On Tue, Feb 28, 2017 at 1:18 AM, Jon Ribbens > wrote: >> "execution" isn't really the right way to describe literal_eval(). >> It isn't an code executor or even an expression evaluator, all it >> does is turns a Python literal in source form into the value

Re: Usage of ast.

2017-02-27 Thread Chris Angelico
On Tue, Feb 28, 2017 at 1:18 AM, Jon Ribbens wrote: > On 2017-02-27, Vincent Vande Vyvre wrote: >> Le 27/02/17 à 14:09, Chris Angelico a écrit : >>> The message is a little confusing, but the error comes from the fact >>> that literal_eval permits a very few legal operations, and calling a >>> fu

Re: Usage of ast.

2017-02-27 Thread Jon Ribbens
On 2017-02-27, Vincent Vande Vyvre wrote: > Le 27/02/17 à 14:09, Chris Angelico a écrit : >> The message is a little confusing, but the error comes from the fact >> that literal_eval permits a very few legal operations, and calling a >> function isn't one of them. So when you try to evaluate the "

Re: Usage of ast.

2017-02-27 Thread Chris Angelico
On Tue, Feb 28, 2017 at 12:44 AM, Vincent Vande Vyvre wrote: > OK, it's coherent with the secure execution. > Yep. Here's a PR to make the message a bit clearer, though: https://github.com/python/cpython/pull/340 >>> ast.literal_eval("print('hello world')") Traceback (most recent call last):

Re: Usage of ast.

2017-02-27 Thread Vincent Vande Vyvre
Le 27/02/17 à 14:09, Chris Angelico a écrit : On Mon, Feb 27, 2017 at 11:57 PM, Vincent Vande Vyvre wrote: I've this strange error: Python 3.4.3 (default, Nov 17 2016, 01:08:31) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. import ast l = "print('

Re: Usage of ast.

2017-02-27 Thread Jussi Piitulainen
Vincent Vande Vyvre writes: > I've this strange error: > > Python 3.4.3 (default, Nov 17 2016, 01:08:31) > [GCC 4.8.4] on linux > Type "help", "copyright", "credits" or "license" for more information. import ast l = "print('hello world')" ast.literal_eval(l) > Traceback (most recent

Re: Usage of ast.

2017-02-27 Thread Chris Angelico
On Mon, Feb 27, 2017 at 11:57 PM, Vincent Vande Vyvre wrote: > I've this strange error: > > Python 3.4.3 (default, Nov 17 2016, 01:08:31) > [GCC 4.8.4] on linux > Type "help", "copyright", "credits" or "license" for more information. import ast l = "print('hello world')" ast.literal

Usage of ast.

2017-02-27 Thread Vincent Vande Vyvre
I've this strange error: Python 3.4.3 (default, Nov 17 2016, 01:08:31) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import ast >>> l = "print('hello world')" >>> ast.literal_eval(l) Traceback (most recent call last): File "", line 1, in File

Re: dictionary of pickle error when get it in multiprocessing and has name error

2017-02-27 Thread Peter Otten
Ho Yeung Lee wrote: > before cloususerlogin > Unexpected error: > after map pool > > > ... > passwordlist = pickle.load( open( str(currentworkingdirectory) + > "\\decryptedsecret.p", "rb" ) ) According to https://docs.python.org/dev/library/multiprocessing.html#programming-guidelines you cann