Python is a dynamic and strongly typed programming language that is designed to emphasize usability. Two similar but incompatible versions of Python are in widespread use (2 and 3). Please consider mentioning the version and implementation that you are using when asking a question about Python.

learn more… | top users | synonyms (3) | python jobs

0
votes
1answer
11 views

Print won't work in if statement

When I run this script, it skips the print function in line 8. I cannot figure out why for the life of me. I have tried so many things to get this working but I just can't seem to figure out the ...
0
votes
1answer
3 views

How can i load an image with the same name number of for cycle iteration on python?

I have a question I want to load a few images from a folder into an array . These images are named ( 1.jpg , 2.jpg , 3.jpg ) and want to load corresponding image to the number of the iteration for ...
-2
votes
1answer
15 views

Python tuple indexing issue

i am having a problem indexing a tuple in that tuple[1] throws an index out of range, but tuple[-1] works fine. I have never experienced this before. Any clues? (tuple has 2 elements)
-1
votes
0answers
6 views

Python - Selecting All Row Values That Meet A particular Criteria Once

I have a form set up with the following fields: Date Time, ID, and Address. This form auto assigns each entry a unique id string (U_ID) and then this data is later output to a csv with headers and ...
0
votes
0answers
2 views

django writing my first custom template tag and filter

I am attempting to write a simple django Custom template tags and filters to replace a html break (< b r / >) with a line space on a template. I have followed the django docs, but I am getting the ...
-1
votes
1answer
15 views

Prompt user to enter names and prints out the list in python

trying to make a program that prompts user to enter a famous peoples names and continues asking until they type "done" and prints out the list with the names and the number of names. could anyone give ...
0
votes
0answers
2 views

Django rest API Framework : Serializer use dynamically

I am trying to create a framework using Django rest API. I want to configure Serializer fields and Name of class variable of serializer dynamically using a factory pattern. My code is a bit complex so ...
2
votes
1answer
15 views

Random selection with criteria in python

I want to (pseudo)randomly select an object from a list that fits a criterion. I have a function that does this for one criterion I need: from random import randint def choose(array): return ...
0
votes
0answers
4 views

Google endpoints

I have a specific question about retrieving a query from an Endpoints model method in Python. # DataPointModel GET LIST api method @DataPointModel.query_method(query_fields=('user_key', ), # ...
0
votes
0answers
7 views

Soundcloud redirect_uri_mismatch with Flask

I'm developing a webapp using Python Flask. Authentication is done using Soundcloud OAuth. I developed everything locally and it worked fine. I configured the Soundcloud app 'Redirect URI' to ...
0
votes
0answers
2 views

Using the Python-Twtter API to add friends

I'm playing around with the Python-Twitter API and trying to follow a user with an account. Let's say I've got an authenticated account named SteveBot. SteveBot = Twitter(auth=OAuth('blah', 'blahhh', ...
0
votes
2answers
5 views

Send messages to ZeroMQ server using conventional TCP, possible?

I'm not sure if I'm doing this right, but I would like to be able to send messages to my server running ZMQ from normal TCP connections. The server is running Python ZMQ on port 5555 using a TCP ...
0
votes
2answers
11 views

How do i move all the numbers to allign with the columns

CANOEING = 3.5068 HIKING = 6 ROLLER_BLADING = 7.5068 TAE_KWON_DO = 10.3014 TAI_CHI = 3 body_mass = float(input("Enter your body mass: ")) canoeing = 0 hiking = 0 roller_blading = 0 tae_kwon_do = 0 ...
2
votes
1answer
6 views

Restoring the default display context in Pandas

I have found myself in cases where I accidentally run: pd.option_context('display.max_columns', None, 'display.max_rows', None, 'display.width', None, ...
-2
votes
0answers
9 views

Does django use processes or threads when handling multiple requests?

Since threads cannot fully utilize all the present cores, can I assume it uses processes?
0
votes
0answers
9 views

How to make Tkinter object oriented?

Ok, I wrote code using Tkinter to make a counter. I have been asked to make this code object oriented. I don't really know how to do that at all so if someone could show me the best way to do this ...
-1
votes
0answers
3 views

How do I return a value when @click.option is used to pass a command line argument to a function?

I am trying to use click python package to pass a command line arguement to a function. Example from official documentation works as explained. But no where in the documentation of click package, it ...
-1
votes
0answers
8 views

How do I obtain the principal frequency of a pylab FFT output

I have a python code which plots the FFT frequencies of a dataset that I have. It uses pylab and gives me an output like this: I want to know the exact value of the principal frequency shown in the ...
-1
votes
0answers
14 views

Outputting ipython display table to a pdf

Does anyone know if it is possible to output a table produced with IPython.display called on a pandas DataFrame to a PDF file? Essentially, I have a bunch of paired tables and figures (produced with ...
0
votes
0answers
4 views

Django Crispy form will not save/submit

I am unable to get the Submit to work with crispy-froms. Normal django forms with bootstrap works fine. I have tried all the tutorials i could find and are at this time unable to find what is wrong ...
0
votes
4answers
22 views

populate a class variable with the value of another class variable

I am trying to populate my title variable from the contents of chart_title like this: class LineHighChart(object): chart_title = '' title = {'text':chart_title, 'x':-20 ...
2
votes
2answers
39 views

Python sorting a text file?

So I know how to import a texfile and sort numbers such as: 1 6 4 6 9 3 5 But I don't know how to sort a data that looks like: Merchant_9976 20122 Merchant_9977 91840 Merchant_9978 92739 ...
-1
votes
2answers
17 views

How do I check if a button exists in tkinter?

So I'm making a Tic-Tac-Toe program because I'm bored. I am using tkinter, and I have a program that asks which side you want to be, then a window pops up with 9 buttons. When one of these buttons is ...
-1
votes
1answer
23 views

Class constructor throwing attribute error Python

Here is my program structure: class parent(object): def __init__(self): pass def __post_init_stuff(self): #post initialization stuff class child(parent): def __init__(self): ...
0
votes
0answers
3 views

DHT22 Sensor import Adafruit_DHT error

So I've properly attached DHT22 Humidity Sensor to my BeagleBone Black Rev C. I'm running OS Mavericks on my MacBook Pro and I followed the directions provided by Adafruit on how to use my DHT22 The ...
0
votes
0answers
6 views

Python threaded subprocess.Popen() SIGKILL exit value:137

I am running python 2.7 on Ubuntu in Eclipse I am trying to call subprocess.Popen from a thread other than the main thread. When I run this code: #lsbt.py class someThread(threading.Thread): ...
0
votes
0answers
7 views

Extending C program using Python unable to parse dictionary to C function using swig

I have trouble parsing dictionary from python to C program using swing module. I have written a wrapper_dict.c and struct.c program. wrapper.c #include <Python.h> #include "struct.h" ...
0
votes
0answers
7 views

Configuring multi-tenancy

In a local dev env, I'm currently attempting to hack my way to multi-tenancy using Mezzanine: Mezzanine makes use of Django’s sites app to support multiple sites in a single project. This ...
0
votes
0answers
5 views

Scraping paginated sites and appending output in Python

I have a simple scraping task that I would like to improve the pagination efficiency of, and append lists so that I may output the results of scraping to a common/single file. The current task is ...
0
votes
1answer
11 views

Fastest way to combine two models by attribute in Django

I have two models which have an attribute in common, I would like two combine them if the attributes in both are equal, each one fetches the data from different databases: First Model class ...
0
votes
2answers
22 views

Python: Write output in a csv-file

I have the following text (as string, \t = Tab): Article_1 \t Title of Article \t author of article \n Article_2 \t Title of Art 2 \t author of article 2 \n I'd like to save this in a ...
-1
votes
2answers
23 views

Python name to/from file

I want the text to display the users name if they have entered it before. I have this working in c++ but wanted to practice python. the output will continue to do the "else" statement. I have tried ...
0
votes
1answer
10 views

Function statement() that outputs the sum of the deposit and the sum of the withdraw

I'm having trouble with this question: Write a function statement() that takes as input a list of floating point numbers, with positive numbers representing deposits to and negative numbers ...
0
votes
0answers
9 views

Python: DBSCAN in 3 dimensional space

I have been searching around for an implementation of DBSCAN for 3 dimensional points without much luck. Does anyone know I library that handles this or has any experience with doing this? I am ...
1
vote
0answers
30 views

How to manipulate a huge csv file (> 12GB)?

I am dealing with a huge csv file of approximately 13GB and around 130,000,000 line. I am using python and tried to work on it with pandas library, which I used before for this kind of work. However, ...
2
votes
0answers
17 views

Dreamhost - ImportError: No module named _weakrefset

Dreamhost upgraded a number of servers this weekend, including the one I was on. It broke my configuration, so as recommended I attempted to delete the virtual environment it was running on and ...
0
votes
1answer
15 views

Reducing pandas series with multiple nan values to a set gives multiple nan values

I'm expecting to get set([nan,0,1]) but I get set([nan, 0.0, nan, 1.0]): >>> import numpy as np >>> import pandas as pd >>> l= [np.nan,0,1,np.nan] >>> ...
-1
votes
0answers
13 views

How secure is Django-Python scripting for servers? [on hold]

I have been working on an App idea with a friend of mine, and we're both fairly capable Objective-C programmers. We've got the UI all hashed out and data models are functional, but now we are facing ...
-1
votes
2answers
41 views

How can I skip the header in Python?

This is my code. I am trying to import the data from net Skip 12 lines Store the rest of the data in a variable and perform some simple operations. import urllib2 airtemp = ...
-1
votes
0answers
5 views

Display entry python tkinter [duplicate]

I want to make an entry where the program asks for two names and then display it onto another window. I tried but I am having trouble. The information does not display onto the new window. This is the ...
-1
votes
0answers
9 views

matplotlib array solution with python

i am learning matplotlib python. but there is same problem in this program import matplotlib.pyplot as plt x = [] y = [] readf = open('data.txt', 'r') splitdata = readf.read().split('/n') ...
-1
votes
0answers
17 views

global variable not changing when I think it should [duplicate]

Im almost sure this is due to a behavior with decorators. Code is as follows : from pyglet import image from pyglet.gl import * from pyglet.window import mouse window = pyglet.window.Window() pic ...
-1
votes
1answer
14 views

Type error with json item

I am returning a json list containing dictionaries from a website by mimicking an XHR request. The code for this is below: import requests url = ...
-1
votes
3answers
36 views

Reading a text file into list in python

I'm trying to learn python. This is a little test program that I made to read a text file into a list. This is the text file: 42 1 35 5 50 2 41 6 42 3 48 4 And this is my codes: score = []; for i ...
0
votes
1answer
10 views

How can you pass a string or list object to fabric as a parameter?

The problem I have is that my string is several words long, and actually contains the ' character ... so I'm at a loss of how to pass the string I want. I'm trying to do: fab -H myhost.serv.com ...
-5
votes
0answers
13 views

How do I make a button in python operate a counter?

How do I write a program in Python that shows a window with a button and a label. I want the label to update each time the button is pressed and show how many times it has been pressed.
-2
votes
2answers
15 views

I need to write a program in Python to calculate the calories burned while doing an activity

I need to use a "for" loop in order to calculate the calories from the user input. Everything is based around the input except for the rate at which the calories are burned. (3.4) per minute. This is ...
0
votes
1answer
14 views

How can I save every Outlook Express Email as an html without clicking “Save As” for every email

I am trying to save a whole slew of emails as html in Outlook Express, but the program only lets me save them individually. If I click "Save As" on more than one email Outlook only lets me save them ...
0
votes
0answers
7 views

Django unit testing

Suppose there is a function as below def XXXX(request, **kwargs): username = request.user.get_username() password = request.user.get_password() if kwargs['xxxx']: I'm relatively new to python ...
0
votes
0answers
6 views

how to point django website to python version besides default on centos

I am using Centos and have installed python 2.7 so that I can run django 1.7. I installed python 2.7 according to ...