Interesting Tags
   11 tags on

2 answers

python-iptables how to specify multi argument matches

How do I specify multi-argument matches with python-iptables? For example, the following iptables command: -A INPUT -s 1.1.1.1 -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j DROP If I create the ...

2 answers | 9 secs ago by pepoluan on Stack Overflow stackoverflow.com
5 answers

How to loop over form field choices and display associated model instance fields

I have a ModelForm with a multiple choice field. The choices are populated instances of Hikers belonging to a specific Club. I want to customize the way my form displays, by displaying the choices in ...

2 answers

How to get name of function's actual parameters in Python?

For example: def func(a): # how to get the name "x" x = 1 func(x) If I use inspect module I can get the stack frame object: import inspect def func(a): print inspect.stack() out: [ ...

1 answer

How to replace non-ASCII by ASCII in pandas data frame

I have a pandas Data Frame from a Excel File as Input in my program. I would like to replace some non ASCII characters in the pandas Data Frame. import pandas as pd XList=['Meßi','Ürik'] ...

1 answer

Python Multiprocessing Array initialization

I'm trying to use Process Arrays in order to use an Array structure across multiple Processes, but cant seem to initialize the example: from multiprocessing import Process, Lock from ...

2 answers

A plethora of Python OSC modules - which one to use?

Open Sound Control (OSC) is a protocol for communication among computers, sound synthesizers, and other multimedia devices that is optimized for modern networking technology. It is particularly common ...

4 answers

Update a MongoEngine document using a python dict?

Is it possible to update a MongoEngine document using a python dict? For example: class Pets(EmbeddedDocument): name = StringField() class Person(Document): name = StringField() address ...

4 answers | 6 mins ago by rednaw on Stack Overflow stackoverflow.com
0 answers

Python C-Api 32bit PyDict_Check Access Violation, Win7, Python 2.66

I am trying to use the Python C-Api for 32bit Project in VS2010. I have installed the 64bit and 32bit Python. To distinguish the two Versions, I have renamed the 32bit dll to 'python26_32.dll'. I ...

3 answers

Python moving files and directories from one folder to another

I would like to move in python files and directories in one directory to another directory with overwrite ability. I started with the following code: #moving files from progs path = ...

3 answers | 8 mins ago by Richard on Stack Overflow stackoverflow.com
0 answers

Add custom code into Drupal 7 webform

I'm looking to add a custom captcha input into a Drupal Webform. The captcha I wish to use isn't available as a plugin so I want to hook the form as it is output and then add my captcha presentation ...

1 answer

path finding in python using adjacency matrix

I am having a problem in my program, here's my code: graph= [#a,b,c,d,e,f,g,h,i,j [0,1,1,1,1,0,0,0,0,0], #a [1,0,0,1,0,0,1,0,0,0], #b [1,0,0,1,0,0,0,0,0,0], #c ...

0 answers

HoverTool for multiple data series in bokeh scatter plot

I have the following small example script makeing use of numpy and bokeh: import numpy as np import bokeh.plotting as bp from bokeh.objects import HoverTool bp.output_file('test.html') fig = ...

2 answers

Python failing IF STATEMENTS/ Changing Variables

I'm having an issue. Speedy responses would be greatly appreciated! My program is failing IF conditions becuase my functions are not changing the global variable properly for me. They're supposed to, ...

2 answers | 11 mins ago by John Snyder on Stack Overflow stackoverflow.com
0 answers

joining clusters using depth/breadth first search in python

I'm doing a small python project about finding clusters. I've read http://eddmann.com/posts/depth-first-search-and-breadth-first-search-in-python/ and used the depth first search in my code to ...

0 answers

Combining numpy arrays to create a value field

i have coded so far: from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from scipy.special import * import matplotlib.pyplot as plt import numpy as np from math import * import csv ...

0 answers

Advice on handling deadlocks in MySQL with Django

I have multithreaded script where each thread makes bulk updates and inserts into database. Problem is that sometime deadlock appears and data not being updated/inserted. What I want is retry failed ...

3 answers

OpenCV-Python dense SIFT

OpenCV has very good documentation on generating SIFT descriptors, but this is a version of "weak SIFT", where the key points are detected by the original Lowe algorithm. The OpenCV example reads ...

3 answers | 15 mins ago by Dow on Stack Overflow stackoverflow.com
0 answers

Starting python script from RoR on Nginx server

I have followed section 4 and calling url configured in nginx.conf file results in showing hello world however whenever I try to run actual python script which I madde by editing passenger_wsgi.py as ...

0 answers

The path '/node/7/' is either invalid or you do not have access to it

I am new to drupal. Using Drupal7 just tried creating some main menus to my test site. I tried creating a link 'about us' under the main menu. I just can't the set the path for the link. Each time ...

1 answer

binarize data in python and create barplot

How can I binarize the following list of integers: [0, 11, 25, 46, 67, 82, 1, 5 8, 86] based on the following bins? [0,1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100] and then create a bar ...

1 answers | 17 mins ago by user706838 on Stack Overflow stackoverflow.com
0 answers

Using cursors to get the query result

When performing two different queries, a cursor is used to get the result. However, row_2 does not get the value that I expected. It seems that it is still using the result in row. con = ...

1 answer

Importing financial data into Python Pandas using read_csv

I have a .csv with the following structure: date_begin,date_end,name,name_code,active_accounts,transaction_amount,transaction_count 1/1/2008,1/31/2008,Name_1,1001,"123,456","$7,890,123.45","67,890" ...

1 answers | 22 mins ago by harrisried on Stack Overflow stackoverflow.com
2 answers

How do you set up neo4j to work with Google Compute Engine?

I'm wondering how one would get neo4j to work with Google Compute Engine. Has anybody done this? What problems did you encounter?

1 answer

pseudocolor an image using python

import cv import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import Image cam = cv2.VideoCapture(0) s,img1 = cam.read() height, width, depth = img1.shape ...

1 answers | 25 mins ago by basheer on Stack Overflow stackoverflow.com
2 answers

pip install UnicodeDecodeError

When I'm trying to install beautifulsoup4 on my new notebook (Win 7 64) using pip, I get this error: Cleaning up... Exception: Traceback (most recent call last): File ...

2 answers | 31 mins ago by Milan on Stack Overflow stackoverflow.com
4 answers

Python documentation standard for docstring

I am currently beginning with python and I have a strong PHP background and in PHP I have took the habit of using javadoc as a documentation template. I was wondering if javadoc has its place as the ...

1 answer

Unable to execute python web scraping script successfully after user submits a form on a website built with Flask from the second time onwards

Using Flask and Python, I have a website running on localhost which allows user to select a specific month to download a report for. Based on the selected month, I will than have my web scraping file ...

0 answers

I can't install 'pip' for python

I'm going trough the book Learn Python The Hard Way and i need to install pip.(ex46,ex47) So i saved get-pip.py on my computer and in powershell i did : PS C:\Users\Toto\pip> python Get-pip.py ...

0 answers

django chunked upload and imports

I am having trouble getting https://github.com/juliomalegria/django-chunked-upload to work. I have installed the module using pip, and have the 'chunked_upload' in my installed apps setting. The test ...

0 answers

gnupg giving me Windows error 5 access denied

I am very new to gpg keys and In trying to figure out how to use the gnupg python module I cant get past a access denied error. Traceback (most recent call last): File "pgptest.py", line 3, in ...

15 30 50 per page
1 2 3