Tagged Questions
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.
0
votes
1answer
20 views
having issues with python time object
i am having a small program that gets time from system and dose some arithemetic on it.
here is my code:
import time
import datetime
c_time = time.strftime("%H:%M;%S")
# now to convert it into time ...
0
votes
3answers
22 views
Getting TypeError: unhashable type: 'list' in python dict
I have a dictionary in python :
aDict = {
'form-1-device': ['2'],
'form-0-test_group': ['1'],
'form-1-test_scenario': ['3'],
}
i need to remove the form-1-device with device and so ...
0
votes
0answers
8 views
Display a specific template when Django raises an exception
In my django app, I have multiple places where I raise a specific custom exception DeserializationError. My goal is to show/redirect to a pretty page to show the user this error, including the error ...
0
votes
0answers
7 views
Decode HTML Entity on Python
I have a file that contain some lines like this:
StatsLearning_Lect1_2a_111213_v2_%5B2wLfFB_6SKI%5D_%5Btag22%5D.mp4
Respect to this lines, i have some files on disk, but saved on decoded form:
...
0
votes
0answers
15 views
how to import file csv without using bulk insert query?
i have tried import file csv using bulk insert but it's failed, is there another way in query to import file csv without using bulk insert ?
so far this is my query but it use bulk insert :
bulk ...
0
votes
1answer
23 views
python regular expression with re.split()
i have this string equation:
400-IF(3>5,5,5)+34+IF(4>5,5,6)
i want to split it by string 'IF(3>5,5,5)', means 'IF()' syntax, so here i used two if syntax.
so re.split() should give list ...
-2
votes
0answers
15 views
Make an interactive plot . Python
I have two column data:
1 0.1
2 0.2
3 0.01
0 0.01
1 23
2 0.9
3 0.01
i want to plot the the data using python and be able to pick the values using the mouse cursor.
Any advice ?
0
votes
0answers
3 views
objectiveC upload image to django
I am trying to post an image to django from an IOS app. I succeed in posting the request to django
but the image data is always empty. Here is the small code snippet
I would appreciate if someone is ...
2
votes
0answers
13 views
Why two threads accessing one resource crashes one thread?
I have created a client server program (in python), wherein the client(CMD for e.g.) establishes a TCP connection with the server, queries for the information regarding a particular process and if the ...
-2
votes
1answer
19 views
How to convert array inside list into list item using Python?
I have array as list item inside a list that I want to convert into list later on. Code below is a result from looping over a and b.
Output
>>>
[[2, 0], [0, 0]]
[array([5, 7]), array([5, ...
0
votes
2answers
13 views
How to make array entries complex variables in numpy arrays?
I am working with numpy arrays in python. Is there a way to keep the entries of the arrays as variables so that they follow proper matrix multiplication and other matrix functions ( ...
1
vote
3answers
21 views
Python: Convert array into integer
I was wondering if there is a way in Python to convert an array or a list into one single number:
A=[0xaa,0xbb,0xcc]
d=0xaabbcc
Thanks for your help!
1
vote
1answer
9 views
OpenCV algorithm of contours searching and creation of bounding rectagle
Hi to the whole programmers society!
It has become habitual to me to get acknowledgement of every algorithm I employ in projects. And not long ago I implemented OpenCV library methods to detect ...
-1
votes
0answers
14 views
Way to extract Twitter data using Python
Is their a way to extract Twitter data as per my requirement i.e. only a small part of data related to my project(in Json format) and store it in my laptop for analysis. If Yes can you please suggest ...
0
votes
0answers
9 views
Unsupervised clustering with Pearson correlation as measure of similarity
I have data from the cell lineage as samples:
Cell1 -> Cell2 -> Cell3
Then for each of the above samples I obtained the expression for 'coding' and 'non-coding' genes.
What I want to do is to ...
1
vote
0answers
8 views
easy_install unmet dependencies which already exist
I am trying to use easy_install on ubuntu 14-04, but running fails due to a missing dependency on setuptools 3.3
$ easy_install
Traceback (most recent call last):
File ...
-1
votes
0answers
28 views
integrating Python and Java
I am working on a project in which a couple of sections are written in java and other section in python. Now I need to integrate all the codes to run as a single entity.
I was thinking of using ...
0
votes
0answers
9 views
How to start an application in android mobile by using uiautomator python wrapper
I am trying to use UIAUTOMATOR python wrapper for automating an android native application. I read the document provided in the document presents on GitHub
But didn't get any idea on how to start ...
0
votes
0answers
11 views
Need Help in Creating a Local Proxy Server in Android
I'm building a little script that uses some of the "Go Agent / Gaaps" (Google Engine proxy/apps ) in windows it works well ,since I have used the google official app to upload my apps and everything.
...
-10
votes
0answers
20 views
How to factory unlock an iPhone without AT&T SIM card? [on hold]
I wanted to use another Prepared SIM card for my iphone4. I tried using r-sim but it didn't work. I reset the cellular setting of my phone and tried to factory unlock my phone.
0
votes
0answers
6 views
No such file or directory when trying to easy_install livestreamer
Trying to install livestreamer on mac OSX Yosemite following this guide http://docs.livestreamer.io/install.html running this in terminal:
# easy_install -U livestreamer
But I recieve this error ...
1
vote
2answers
52 views
Writing a Python script that runs everyday till a specified date
I want to schedule a job (run a python script) everyday at a specific time till a specific date has been reached.
Researching on a lot of Pythonic schedulers, I thought that APScheduler was a good ...
0
votes
1answer
4 views
Changing priority of job in SGE using python drmaa wrapper
When I try to submit a job using the python drmaa wrapper, I get a DeniedByDrmException: code 17: job rejected: positive submission priority requires operator privileges.
How do I change the priority ...
0
votes
0answers
7 views
how to package pyqt5 program and qml into exe ,using cx_Freeze
i write some codes with python and qml. i want to package them into exe. And i have some troubles.
following is my code .
main.qml
import QtQuick 2.2
import QtQuick.Controls 1.1
import ...
0
votes
0answers
10 views
Blurring in PyGame
I'm working on a short intro in PyGame, and I need to blur some static lines. After two days of searching, I can't find anything.
Does PyGame have a built-in method to blur a shape or surface? Will I ...
0
votes
1answer
10 views
Set A Column Value in a Multiindexed DataFrame Using One Index and One Column Value
I have a Pandas frame with two levels of indexing.
Class Score Mean
Date Student
2000-01-01 'John Smith' 'A' 92 None
'Jane ...
1
vote
2answers
19 views
Loading scraped data into Postgresql
I have combined some tutorials on web scraping and made a simple web crawler that is scraping new posted question here on SO. I want to load them into mine postgresql data base, but I am having ...
0
votes
4answers
37 views
Using .find to search a string inside a list
I want to loop through a list of strings...
eg:
list_of_strings = ['Hello!, my name is Carl', 'Hello!, my name is Steve', 'Hello!, my name is Betty']
I want to loop through the list items and ...
1
vote
2answers
40 views
Python: Problems when iterating over a dictionary
So, I have been working on this simple Python program to get familiar with dictionaries. Basically, it works as a database which you can search in. If your entry is in the dictionary key, it brings up ...
1
vote
0answers
21 views
How to weight station to Order Least Squares in python?
I have 10 climate stations data about precipitation and it's DEM.
I had done a linear regression follow:
DEM = [200, 300, 400, 500, 600, 300, 200, 100, 50, 200]
Prep = [50, 95, 50, 59, 99, 50, 23, ...
-3
votes
0answers
22 views
Coding Languages for eCommerce in 2015 [on hold]
I am fluent in Python and HTML/CSS as it stands today.
If I were to get into the entire realm of eCommerce/CMS what languages are best practice in 2015, is PHP still leading the charge? I heard good ...
0
votes
0answers
14 views
Receive Error in import opencv in python
I have installed OpenCV successfully using brew on my mac with OS X 10.10.3. Created the symbolic link as well to the cv.py and cv.so files.
when I use the import command in python I receive the ...
4
votes
6answers
78 views
Efficient algorithm to find the largest run of zeros in a binary string?
I am looking for an efficient algorithm to find the longest run of zeros in a binary string. My implementation is in Python 2.7, but all I require is the idea of the algorithm.
For example, given ...
0
votes
2answers
11 views
How do I calculate the standard deviation with a pivot table in Pandas?
I have a bunch of data involving certain numbers for certain players of specific sports. I want to use pivot tables in Pandas to have it split up the data by sport, and for the corresponding value for ...
0
votes
0answers
8 views
why the AES result is different between Crypto and M2Crypto with Python?
i have two script in python , one is encrypt data using Crypto
from Crypto.Cipher import AES
from Crypto import Random
IV = 'c782dc4c098c66cb'
secrect_key = 'c286696d887c9aa0'
cipher = ...
0
votes
0answers
8 views
Error while updating a document in ElasticSearch using python es.update()
I am trying to update a document in elasticsearch using the default python interface for Elasticsearch using the below command.
res = es.update(index='its', doc_type='vents', id=txid, ...
0
votes
1answer
12 views
How to properly use matplotlib render an image histogram?
I'm trying to write a python small program to obtain the grayscale histogram for an image. I'm using OpenCV and matplotlib but I'm not getting good results when trying to display the graph.
This is ...
0
votes
1answer
39 views
Python: Array subtract Matrix - TypeError: unsupported operand type(s) for -: 'int' and 'list'
I have code below that help me to use array minus matrix but the system return error at this line union = total - zero. zero is actually the count of intersection. If I put a comment # in front of ...
0
votes
1answer
10 views
reshaping and rearranging a pandas table
I have the following dataframe (pandas version 0.13.1)
>>> import pandas as pd
>>> DF = ...
0
votes
1answer
10 views
Selenium Firefox webdriver does not adopt profile
I have created a FF profile:
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.dir", CLIENT_SAVING_DIR)
fp.set_preference("browser.download.folderList",2)
...
0
votes
0answers
21 views
Memoize decorator not returning actual value
I have this memoize decorator:
import functools
cache = {}
def memoize(obj):
@functools.wraps(obj)
def memoizer(*args, **kwargs):
if args not in cache:
cache[args] = ...
0
votes
0answers
10 views
Twisted Python: Capture IP address of users who uses the manhole_ssh terminal
I am currently using manhole_ssh to provide a commandline ssh terminal. However, I want to log the IP of these users who are logging in to my service.
my code is currently as such
class ...
0
votes
0answers
18 views
Scrapy CrawlSpider not following links
I am trying to crawl some attributes from all(#123) detail pages given on this category page - http://stinkybklyn.com/shop/cheese/ but scrapy is not able to follow link pattern I set, I checked on ...
0
votes
1answer
14 views
opencv python error: Assertion failed (size.width>0 && size.height>0)
I am getting an error while running the following code.
import cv2
import numpy as np
img = cv2.imread('messi.jpg',0)
img = cv2.line(img,(0,0),(50,50),(255,0,0),5)
cv2.imshow("image",img)
...
2
votes
1answer
29 views
Python: pattern matching(?)
I am a beginner in Python programming and I have a question about constructing a code.
Let's say I have the following data:
150 z Brazil
160 a Toys R Us
I want to code such that if we see ...
-1
votes
0answers
20 views
Django Web App to iOS
Does anyone have any experience creating an iphone app from a django web application? (not theory, actual experience)
From what I know:
You have to create the app in objective C or swift
The mobile ...
0
votes
1answer
8 views
pygame.draw.circle, still draws a square
I'm making a version of http://agar.io and i'm trying to make the circle shape for the player. I have been trying to use pygame.draw.circle to draw it, however it keeps showing a square. Thanks for ...
0
votes
0answers
8 views
Cloud Endpoints - ImportError: No module named endpoints
I'm running into this weird error with a Cloud Endpoints app that I'm just starting to write. I'm not sure if Google changed their libraries or not, but I think this should work?
In my app.yaml I've ...
1
vote
0answers
10 views
Unable to access files from public s3 bucket with boto
I recently created a new AWS account (let's call it "Account A") and created an S3 bucket in this account (let's call it "bucketa"), uploading a file foo.txt. Following advice from the internet, I set ...
0
votes
0answers
10 views
python - selenium change frame not working
im trying to navigate a webpage so as to download some csv files. The thing is that there is a dropdown and everytime you change it the page reloads. So im trying to use selenium so as to get work ...