Python 2.7.12 is the last major version in the 2.x series. This release contains many of the features that were first released in Python 3.1. Use the more generic [python] tag if your question is not version-specific.

learn more… | top users | synonyms

0
votes
1answer
16 views

Python list to string

Element3 of each list is a list (in brackets). I want element3 to be a string 'store1.txt' not ['store1.txt']. store_list = [["Freds", "store1"], ["Sams", "store2"], ["Johns", "store3"], ["Toms", "...
-1
votes
0answers
28 views

Checking if a web site is open within a browser [duplicate]

I'm trying to make a program that runs in the background and constantly checks if you opened, for example, facebook. And if it is indeed opened it puts in my email and password. I have the part where ...
0
votes
0answers
23 views

remove u letters from the csv in python 2.7

I already searched the solutions online, but it did not work on the following python script. I am getting u letter in csv file. import sys reload(sys) sys.setdefaultencoding('utf-8') import codecs ...
0
votes
1answer
11 views

Python encoding - error: 'latin-1' codec can't encode character

In my snippet below, I'm process a string of text thats: Déclaration.png I return the description as unicode: return self.render_json(request, {..."description": u''.join((instance.description)),.....
0
votes
3answers
50 views

Error when passing two parameters

I made a method to click on the calendar field and then choose the date, but when I move the parameters, is returning error. My method def select_current_date(self, *locator1, *locator2): self....
3
votes
2answers
26 views

Unpacking a list in print for Python 2

I'm having problem with understanding why unpacking does not work with list and print statement in Python 2.7: >>> l=['a', 'b', 'c'] >>> print (*l, sep='') Python 3.x works fine ...
0
votes
0answers
31 views

How to split a string into characters [duplicate]

say you have a string, where P = "hello" how do I split this into individual characters, so I can use indexing. what I aim to do is replace a letter in P, (e.g h) with a letter in the alpphabet. I ...
1
vote
2answers
18 views

Moving Files by creation/modification date then moving with Python

I am new to programming, even more so with Python. So please excuse any ignorance on my part. I am trying to write a script for myself that will move files that have been modified in the last 24 hours....
-2
votes
0answers
24 views

Simultaneously Unpack 3 lists values [duplicate]

I have 3 list which i have to unpack at the same time The list is pretty big containing 43 or more elements And also i dont exactly know the values of the list This wat i want a=['a','b','c','a'] b=...
0
votes
1answer
32 views

Automatic inheritance of all base class attributes

I want to create a class that has two characteristics: Inherits a base class (all attributes and methods) automatically Takes an object of that base class as an argument. I want these two ...
0
votes
0answers
26 views

Unable to read file, outputting what looks like a different encoding

I'm writing a program that takes a bunch of user input and saves it all to a file, right now I'm testing the files to make sure everything works well. However, while reading the file I get the ...
0
votes
0answers
6 views

ValueError: Could not reserve memory block

I setup Superset on AWS and was trying to load the data examples when I encountered this error: Traceback (most recent call last): File "/usr/local/bin/superset", line 10, in <module> ...
-5
votes
0answers
18 views

I want to get the recent media and like all of it, then I want to get all incoming user follow requests and accept them if I follow them already

from client import InstagramAPI access_token = "YOUR_ACCESS_TOKEN" client_secret = "YOUR_CLIENT_SECRET" api = InstagramAPI(access_token=access_token, client_secret=client_secret) r = True while r == ...
1
vote
1answer
27 views

How to wait for presence of an element with non empty content?

How can I wait for a presence of an element which the content (text) is not empty? I tried select by xpath using //*[@id="test" and text() != ""], but the return of WebDriverWait#until does not ...
0
votes
0answers
50 views

Trying to read a header in csv file and adding random data into it

I am trying to read a header in a csv file and if it is equal to the header add random data into the column up to a specified row. I have a writer where I am writing data using a json file but need ...
0
votes
1answer
23 views

scheduler for running python scripts

I have a python script which installs a build from server to a node. Now I want to schedule the task to a specific time, so that it triggers automatically. One way is the windows scheduler to trigger ...
-2
votes
1answer
60 views

What is <> in python? [duplicate]

What does <> mean in python? Note: I tried googling this: "python <>", but all you get is this (same as a search for "python"), because Google doesn't recognize special characters.
0
votes
0answers
25 views

select item from a table while joining 3 tables together

query = db_session.execute( "SELECT distinct p.id FROM products p JOIN shopify_shop s on s.id = p.shop_id JOIN product_images p_i on p.id = p_i.product_id WHERE s.uninstalled =...
0
votes
0answers
6 views

win32com error when use pyinstaller inside virtual_env

Error occurs when i compile in virtual_env . If compile without virtual_env ,it works. Packages are installed in the same and virtual_env in the general environment.If compile programm "hello world", ...
0
votes
0answers
7 views

python cx_Freeze no module name

I have a .pyw script (which works) and I use cx_freeze to compile it into an .exe . After running cx_freeze , I have the build\exe.win32-2.7 directory, but when I try to run the executable I have the ...
0
votes
1answer
18 views

using xml2json with hebrew data

I'm trying to parse hebrew content from json to xml and from xml to json. When I do that: >>> from xml2json import json2xml >>> json = {"test": "בדיקה"} >>> json2xml(json) ...
0
votes
1answer
9 views

Node editor, adding child QWidget another QWidget at run time

I'm trying to make a node editor using pyqt and having trouble adding nodes in real time. If I add a node on the initialization of the NodeEditor QWidget it works fine, but if I add a node using a ...
1
vote
2answers
26 views

Why does stderr in subprocess.check_call receive both stderr and stdout streams?

I have a python script (call it my_python_script.py) that prints a few messages using print message_string It also outputs percentage progress using sys.stdout.write(progress_string) When it is ...
0
votes
1answer
17 views

how to perform POST method in scrapy?

Please some one provide post method for below url. https://www.mygofer.com/furniture/b-34790/rowCount_120?keyword=south%20shore%20furniture 1) Above URL loads, it gives POST URL and below formdata ...
0
votes
3answers
32 views

Template does not exist at / error exception at- loader.py line 43

I am trying to create a home page for my django project. I keep getting this error: TemplateDoesNotExist at / home.html Request Method: GET Request URL: http://xtradev.local/ Django Version: 1.9 ...
0
votes
1answer
11 views

Python - Shapely large shapefiles

I am reading in a GeoJSON file that contains two simple polygon descriptions that I made and six complicated vectors from http://ryanmullins.org/blog/2015/8/18/land-area-vectors-for-geographic-...
1
vote
1answer
13 views

Capturing PySpark logging

I am trying to setup a decent logging configuration in PySpark. I have a YAML configuration file which setups different loghandlers. Those handlers consist of the console, a file, and a SQLite DB ...
0
votes
0answers
9 views

In Python, SelectPercentile.fit() returns unusual matrix and error,but Why?

I am a newbie in machine learning and I am building a text classification system. My texts are symptoms of diseases and Labels are name of diseases. I have preprocessed all the texts and calculated ...
0
votes
1answer
35 views

Is this code in the dropbox documentation right?

from dropbox import Dropbox from dropbox import DropboxOAuth2FlowNoRedirect auth_flow = DropboxOAuth2FlowNoRedirect(APP_KEY, APP_SECRET) authorize_url = auth_flow.start() print "1. Go to: " + ...
0
votes
2answers
17 views

Pandas Groupby: Count and mean combined

Working with PANDAS to try and summarise a dataframe as a count of certain categories, as well as the means sentiment score for these categories. There is table full of strings which have different ...
0
votes
1answer
19 views

How to parse all the text content from the HTML using Beautiful Soup

I wanted to extract an email message content. It is in html content, used the BeautifulSoup to fetch the From, To and subject. On fetching the body content, it fetches the first line alone. It leaves ...
-1
votes
0answers
24 views

Searching in array [duplicate]

I am working on the Advent of code at day 2 and I have figured that I need to have a list of all the points of which I have passed through in order to figure when I am touching the same point twice. I ...
0
votes
1answer
11 views

Compare two lists (one of them with another list) and return the index of the matches

a = ['french', 'english'] b = ['(portuguese; french)', '(english)'] I want to compare two lists and in return I want the index of the matches I tried: matches = list([i for i, item in enumerate(a) ...
2
votes
1answer
22 views

cython memory view of c array of structure

I'm trying to use cython to extract data from some binary files but I'm coming up against a problem and my knowledge of cython/c is not able to solve it. The problem: Attempting to make a memoryview ...
0
votes
0answers
27 views

Python 2.7 multiprocessing Process hangs

I have a 2 classes which inherits from multiprocessing.Process. One of these classes is responsible for spawning instances of the other. When I call start() on an instance of this class, python hangs,...
-1
votes
2answers
24 views

How to pass multiple arguments in os.system() in python 2.7 (Python Script).

I am creating a python script where i needed to pass 2-3 arguments in os.system(). Suppose those commands/arguments are a,b. here A should execute first then B. Is there any solution for this ?
-2
votes
2answers
35 views

Any handy way to create a list of strings in python without using quotes

Is there any handy way to create a list of strings, without using quotes. Actually every time when I have to type for creating a long list, it always bothers me to add quotes and sometime I miss it. ...
1
vote
0answers
41 views

Python program documentation [on hold]

When creating a new Python program, I never know how to deal with user guide and developer manual. Let say the program is organized as follow : my_soft ├── bin │   └── my_exe ├── doc └── soft ├──...
0
votes
0answers
6 views

geom_smooth option missing ggplot from python

I am trying to make plot using ggplot in python. When I try to run, I get an error" ggplot(data,aes(x='Average Credit Card Transaction',y='response'))+\ geom_smooth(se=False,span=0.2)+xlab("Average ...
5
votes
4answers
192 views

Why cycle behaves differently in just one iteration?

I have this code: gs = open("graph.txt", "r") gp = gs.readline() gp_splitIndex = gp.find(" ") gp_nodeCount = int(gp[0:gp_splitIndex]) gp_edgeCount = int(gp[gp_splitIndex+1:-1]) matrix = [] # ...
0
votes
0answers
21 views

How to resize a shared memory in Python

I want to use an array for shared memory. The problem is the program is structured in such a way that the child processes are spawned before I know the size of the shared array. If I send a message to ...
1
vote
1answer
17 views

adding constraint under pyomo environment

I am working under pyomo.environ package. I tried to adding a constraint something like this http://imgur.com/a/pWJ79. i and j are the index of nodes. The node_set contains N0 to N5, six nodes in ...
0
votes
0answers
7 views

windows error[126] when importing pulsectl python 2.7

When trying to import pulsectl I get the following error. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python27\lib\site-packages\pulsectl\__init__....
0
votes
0answers
12 views

Numpy vectorization of multiple nested for loops for a numpy array of numpy arrays

I have a numpy array of numpy arrays, where the major array elements represent the vertex data for 3D meshes of variable length, with the sub-arrays representing floats for the 3D vertex data as ...
1
vote
6answers
41 views

Loop through tuple and calculate percentage of a number

I am trying to loop through the below tuple (tuple1), create a total from the integers (b), calculate a the percentage each value represents, and store it along with variable a, in a new variable (...
0
votes
1answer
20 views

Cannot import name <name_of_function> - can't see circular imports

I have a problem with my code. There are two files - scraper and parser. There is a very few imports in them but I'm still getting import error. from parser import parse_price ImportError: ...
0
votes
1answer
18 views

Adding Hours for Data and time in Python

i want to add 5:30 for but am getting AttributeError: type object 'datetime.datetime' has no attribute 'datetime' My code: from datetime import datetime, timedelta from openerp.tools import ...
0
votes
1answer
21 views

Python celery: link_error not able to attach with an apply_async function call

I am new in python and trying to attached a error_handler function in celery apply_async function call like below code but getting SyntaxError: invalid syntax save_stream_data.apply_async(( ...
-1
votes
0answers
7 views

Digitalocean Ubuntu Server Django Admin Panel First Time login

After I deploy my website to my domain I couldnt reach admin panel I mean my admin un and password is not worked anyway. Actually I didnt try to login before. So any way I did something to solve this ...
-2
votes
0answers
25 views

Why 'Fibs' object is not iterable? [on hold]

class Fibs: def _init_(self): self.a=0 self.b=1 def _next_(self): self.a,self.b=self.b,self.a+self.b return self.a def _iter_(self): return self ...