text stringlengths 226 34.5k |
|---|
How to change primary text in gtk messagedialog in python?
Question: I'm creating program in python with gtk as gui using glade. In that program, I
have several message dialog. It's simple if I just make many message dialog
for every case I have. But, is it possible to just make one message dialog and
use it for differ... |
What is wrong with my code? I am new at Python 3.3
Question:
def start():
import os
os.system("cls")
print "*A Wise man once said “Be the change that you wish to see in the world.” This is the idea you have decided to live by and strive for in your quest for making a better world. You are N... |
Python Blowfish Encryption
Question: I am struggling due to my incomplete knowledge of Java to convert this
encryption code to Python code. The two should have the exact same results.
Help would be greatly appreciated.
_Java Function_
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpe... |
Python Celery could start with a threading inprocess ?
Question: I want make a testcase with my celery codes. But usually celery need start
with a new process like `$ celery -A CELERY_MODULE worker`, It's means I can't
run my testcase code directly ?
I'm configurate the Celery with memory store to void the extra I/O i... |
Print code from web page with python and urllib
Question: I'm trying to use python and urllib to look at the code of a certain web page.
I've tried and succeeded this at other webpages using the code:
from urllib import *
url =
code = urlopen(url).read()
print code
But it returns nothi... |
Extract unique rows from a matrix in numpy with the frequency of each row that was created
Question: A follow up question on:
[How can i use the unique(a, 'rows') from MATLab at
python?](http://stackoverflow.com/questions/6776821/how-can-i-use-the-uniquea-
rows-from-matlab-at-python)
The answer there explains how to ... |
Pythonic enumeration of while loop
Question: Python has an elegant way of automatically generating a counter variable in
`for` loops: the `enumerate` function. This saves the need of initializing and
incrementing a counter variable. Counter variables are also ugly because they
are often useless once the loop is finishe... |
Merging two .csv files python-pandas
Question: I have two .csv files with the same initial column-header:
NAME RA DEC Mean_I1 Mean_I2 alpha_K24 class alpha_K8 class.1 Av avgAv
Mon-000101 100.27242 9.608597 11.082 10.034 0.39 I 0.39 I 3... |
ruby equivalent of destructor
Question: I'm using [`RubyPython`](http://rubypython.rubyforge.org) to import a Python
module. I am doing `RubyPython.start` in the constructor (`initialize`), and I
suppose I should symmetrically do `RubyPython.stop` in the destructor, but
unfortunately it seems that there is no destructo... |
decorator to replace repetitive object orientated code?
Question: I'm developing a GUI with Qt/PySide with lots of separate classes handling
various widgets. Each widget manages signals between buttons and other user
inputs. I found myself having to reuse code to block widget signals at the
start of method functions an... |
How to convert Unicode dict to dict
Question: I am trying to convert :
datalist = [u"{gallery: 'gal1', smallimage: 'http://www.styleever.com/media/catalog/product/cache/1/small_image/445x370/17f82f742ffe127f42dca9de82fb58b1/2/_/2_12.jpg',largeimage: 'http://www.styleever.com/media/catalog/product/cache/1... |
Python operators pymysql
Question: I'm having some bad time with pymysql and python operators. I don't know much
about python operator though.
I want to insert into the database some values. The code:
import pymysql
conn = pymysql.connect(host='127.0.0.1', unix_socket='/Applications/MAMP/tmp/mysql/m... |
python: improve performance and/or method to avoid memory error creating, saving and deleting variable variables
Question: I have been fighting against a function giving me a memory error and thanks to
your support ([Python: how to split and return a list from a function to avoid
memory error](http://stackoverflow.com/... |
how to create a dictionary from a file?
Question: I'm trying to write a Python code that will allow me to take in text, and read
it line by line. In each line, the words just go into the dictionary as a key
and the numbers should be the assigned values, as a list. the file
'topics.txt' will be composed of hundreds of l... |
Qt tcp/ip server works with telnet, but not python or netcat
Question: I have a Qt tcp/ip server listening on a port. I can talk to it with telnet,
but when I try with netcat the input commands are truncated. When I try to
send it a command through python, it doesn't see anything. Has anyone else run
into an issue like... |
Extracting part of a string with irregular delimiters in python
Question: I am wanting to extract the last part of the name of the file that is
delimited by a constant prefix and '.csv'
Name of the file might look like:
> constant_prefix_**my file name**.csv
or
> constant_prefix_**myfilename**.csv
I would like to ... |
Multithreading in python using queue
Question: I am quite new to Python and I need to implement multithreading in my code.
I have a huge .csv file (million lines) as my input. I read the line, make a
rest request for each line, do some processing on each line and write the
output into another file. The ordering of lin... |
Print multiple variables in one line using python
Question: I need some assistance with a python script. I need to search a dhcpd file for
host entires, their MAC and IP, and print it in one line. I am able to locate
the hostname and IP address but cannot figure out how to get the variables out
of the if statement to p... |
Converting an UNIX python program to work in windows
Question: I need to make a program that drives a DYMO LabelManager PnP label printing
device. DYMO provides a SDK for this purpose, but after some desperate trying,
I'd say the SDK is useless. Then I found a program which is just what I need,
written by a guy named S... |
django syncdb script - filesystem location + altering the script?
Question: i'm using django for a few projects already and now i'm facing a problem with
the syncdb command. I need to alter the functionality of that command, have
you got any experience with that?
`python manage.py` looks like this:
#!/u... |
assertion error with np.load following numpy.savez
Question: I have 5 numpy arrays `a,b,c,d` and `e` all defined as:
array([1, 2, 3, 4, 5, 6, 7, 8, 9])
I am saving these arrays like so:
np.savez_compressed('tmp/test',a=a,b=b,c=c,d=d,e=e)
This results in a file, `test.npz` being... |
Python suds - Recursion error in wsdl.py
Question: I am currently writing a Python script using the suds package to connect to a
new client. When I call suds.Client with the url, I get a recursion error:
RuntimeError: maximum recursion depth exceeded while pickling an object
File "c:\Users\mdrisc... |
python 2.7 isinstance fails at dynamically imported module class
Question: I'm currently writing some kind of tiny api to support extending module
classes. Users should be able to just write their class name in a config and
it gets used in our program. The contract is, that the class' module has a
function called `crea... |
scrapy - how to get text from 'div'
Question: I just started to get to know scrapy. Now I am trying to crawl by following
tutorials. But I have difficulty to crawl text from div.
This is items.py
from scrapy.item import Item, Fied
class DmozItem(Item):
name = Field()
title = Field()
... |
Sum all values of database column with Queryset Model.objects.aggregate(Sum(***))
Question: So I'm creating an expense sheet app in Django and I'm trying to get the total
sum of all the expense costs, which I then want to display in my template.
My Model:
class Expense(models.Model):
PAYMENT_CHO... |
Difference between * and .* in regular expressions (using python)
Question: I'm using Python 2.7.
I would like to know the difference between `*` and `.*` while matching the
words.
Following is the code in python
exp = r'.*c' #here is the expression
line = '''abc dfdfdc dfdfeoriec''' #the words I n... |
How to display a float matrix as elevation values in a 3D plot in Python?
Question: I currently have a heat map which is a 2D float matrix (list of lists of
floats to be accurate), and I can display it in 2D with matplotlib fairly
easily, but I would like to display it in a 3D plot such that the column and
row indices ... |
Apache log file data analysis with python pandas
Question: The problem with me is bit hard to explain. I'm analyzing a Apache log file
which following is one line from it.
112.135.128.20 - [13/May/2013:23:55:04 +0530] "GET /SVRClientWeb/ActionController HTTP/1.1" 302 2 "https://www.example.com/sample" "M... |
opening an excel file and writing to it in python
Question: How do I open an existing excel file, write to it, and save it as the same
filename. None of the previous data should be lost and the new data should be
saved.
The pseudocode would be as follows:
open excel file
write data to last row
s... |
IronPython convert from Python String to SByte array
Question: for the usage of an external dll in IronPython I have to pass a string to a
**char array** (char var[len]; in C++.NET). It seems to be expected to pass an
SByte array.
If I try
myVarFromCLibrary = myPyString
I get
TypeEr... |
How to place QWebView in QTabWidget?
Question: I'm new in Python and pyQt. I'm making desktop application for some forum. My
app work correct, but I'm don't know, how I can to place my QWebView element
in tab "QTabWidget"
Here is my full code:
# -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui,... |
How do I run the OpenGrasp Robot Editor with Blender on Mac OS X?
Question: I'm using Mountain Lion at the moment. I've installed Blender (because it's a
dependency of OpenGrasp), and downloaded OpenGrasp. However, I try to load the
robot editor up and I get this:
$ python GraspRobotEditor.py
Traceba... |
Join two timelines / list of tuples
Question: I have timelines/timeseries which consist of a list of two-tuples where the
first part of the tuple is a timestamp and the second part is the value. The
tuples are ordered by their timestamp.
I now have two of these timelines and need to divide them by each other. This
mea... |
64-bit argument for fcntl.ioctl()
Question: In my Python (2.7.3) code, I'm trying to use an ioctl call, accepting a long
int (64 bit) as an argument. I'm on a 64-bit system, so a 64-bit int is the
same size as a pointer.
**My problem is that Python doesn't seem to accept a 64-bit int as the
argument for a fcntl.ioctl(... |
Regex for matching string Python
Question: I wanted to match the numeric values of a string:
1,000 metric tonnes per contract month
Five cents ($0.05) per tonne
Five cents ($0.05) per tonne
1,000 metric tonnes per contract month
My current approach:
size = re.findall(r'(\... |
python format string unused named arguments
Question: Let's say I have:
action = '{bond}, {james} {bond}'.format(bond='bond', james='james')
this wil output:
'bond, james bond'
Next we have:
action = '{bond}, {james} {bond}'.format(bond='bond')
this will ... |
Memory error reading a zip file in python
Question: I have a thread in which I am reading a zip file with
`zipfile.ZipFile().read()`, where I am getting a memory error.
I am aware that `read()` loads the entire file into memory. The size of file
after unzipping is more than 100MB. I also tried with
`zipfile.ZipFile().... |
Assigning a fieldname to a variable in Python
Question: I am new to Python and I am trying to check for nulls in the csv I am
processing. I am using a DictReader object with key pair values. I am using
the key pair values in the for loop to print out the information(kml in this
instance).
I go to run the program and i... |
Python: Tkinter Treeview Searchable
Question: Fairly straight forward question, and despite my best Google-Fu I can't find
anything on this.
I have a Python app that uses a Tkinter Treeview widget as a table. This works
fine for what I need to use it for, but there are going to end up being a
couple hundred items in a... |
Looping through a list read by pickle to find userid
Question: I am having trouble looping through a list read by pickle. The Ultimate aim of
this code was to loop through each Item and return the id number of each item.
## Opening the file, and loading it into a list##
with open('TEMP_ITEMS.txt', 'r... |
Python: wildcard subset import
Question: We have all been told using `from module import *` is a bad idea. However, is
there a way to import a **subset** of the contents of `module` using a
wildcard?
For example:
module.py:
MODULE_VAR1 = "hello"
MODULE_VAR2 = "world"
MODULE_VAR3 = "The"
MOD... |
Unpickling fails with __new__() takes exactly 1 argument (2 given)
Question: When I'm trying to load a pickled list it says:
>>> import pickle
>>> with open('tests/unit/support/modules_state.samples2.6') as f:
... print(pickle.load(f))
...
Traceback (most recent call last):
... |
How to mention height and Width in terms of percentage in size() in wxpython
Question: How do I mention `size(350,450)` in terms of percentages in `wxpython`?
# -*- coding: utf-8 -*-
# gotoclass.py
import wx
class Example(wx.Frame):
def __init__(self, parent, title):
... |
Speeding up summation for loop in python
Question: I have the following bottleneck and am wondering if anyone can suggest ways to
speed it up.
I have three lists `x,y,z` of length `N`. and I apply the following
[summation](http://en.wikipedia.org/wiki/Correlation_sum).
def abs_val_diff(x1, x2, x3, y1, y... |
How to insert a HTML element in a tree of lxml.html
Question: _I am using python 3.3 and lxml 3.2.0_
Problem: I have a web page in a variable `webpageString =
"<html><head></head><body>webpage content</body></html>"` And I want to insert
a css link tag between the two header tags, so that I get `webpageString =
"<html... |
Find bottleneck of flask application
Question: I wrote a flask application. I found it very slow when I deployed it in a
remote server. So, I did some profiling practices with it. Please take a look
at the pictures below:
The code I use to profiling is:
#coding: utf-8
from werkzeug.contrib.profiler ... |
Merge 2 lists at every x position
Question: Say I have two lists one longer than the other, `x = [1,2,3,4,5,6,7,8]` and `y
= [a,b,c]` and I want to merge each element in y to every 3rd index in x so
the resulting list z would look like: `z = [1,2,a,3,4,b,5,6,c,7,8]`
What would be the best way of going about this in py... |
How can one Python module break another?
Question: After several hours of debugging and trial and error, I found that importing
two independent Python modules caused a function in one of them to stop
working.
import arcpy
# works
sde_conn = arcpy.ArcSDESQLExecute(r"C:\temp\test.sde")
Yet:
... |
Getting mentions and DMs through twitter stream API 1.1? (Using twython)
Question: I'm using twython (twitter API library for python) to connect to the streaming
API, but I seem to only get the public twitter stream possibly filtered by
words. Isn't there a way to get a real-time stream of the authenticated user
timeli... |
Installing anaconda to use with windows
Question: I am lost in the installation process of installing anaconda on windows.
I've installed the windows 32bit package (I'm running windows 7 x64)
I have anaconda in the start menu and I can open the python console and use
scipy.stats.t.interval(), the function I am intere... |
Measuring curvature of contiguous points
Question: I have a list of points (in the order of magnitude of tens of thousands), and
I need to identify two things using python:
1- the groups of contiguous points (abs(x2-x1)<=1 and abs(y2-y1)<=1) among
these points
2- the degree/radius of curvaure of each group
Here is a... |
Python: Serving files, All carriage returns lost in text file
Question: I'm using the method described in the link
<http://stackoverflow.com/a/8601118/2497977>
import os
import mimetypes
from django.core.servers.basehttp import FileWrapper
def download_file(request):
the_file... |
python client reading json list from python server
Question: I know there are many json tutorials and Q&A here and on the net, which I've
read; but I'm still struggling to get my python script working.
I'm calling a python server program from a client to read a sample list. My
error is:
<type 'exception... |
Python - organising code and test suite
Question: I am very new to python, coming from a php background and cant figure out the
best way to organise my code.
Currently I am working through the project euler exercises to learn python. I
would like to have a directory for my solution to the problem and a directory
that ... |
How to parse XML file from European Central Bank with Python
Question: I am trying to parse an XML file from the European Central Bank with the Euro
rates. Unfortunatly I get stuck with parsing the XML file. When I remove the
difficult part (everything related with "gesmes") I have no problem iterating
through the "Cub... |
Getting a memory error when parsing a large XML file in Python
Question: My XML file looks like this:
<root>
<group from="1", to="100">
<link target="1"/>
...
<link target="100"/>
</group>
...
</root>
I have a 6000 `<group>` elements and 5M `<link>` elements.... |
Expand a relative path but not follow any symlink in the path in Python
Question: This is a subtle question, I know, but I hope you can bear with me for a
moment.
Suppose `/tmp/dir` is a symlink to `/home/user/some/dir`. Suppose also that
your current working directory is `/tmp/dir`.
Even expanding something like `.`... |
Matplotlib, adding text with more than one line. Adding text that can follow the curve
Question: I have added text to a plot, coded in each line, and then adjusted it look
decent, increase or decrease the width, or change the placement. However, is
there a way to have Python know where you want the text and how you wan... |
What causes the NZEC (Non Zero Exit Code) error in my Sums in a Triangle solution?
Question: I was doing [this practice problem](http://www.codechef.com/problems/SUMTRIAN)
on codechef. I have already [solved this in
C](http://www.codechef.com/status/SUMTRIAN,anshbansal) and was trying to do
the same in Python 2.7. I am... |
Fastest and/or most pythonic way to convert string into a number
Question: first of all, I've seen quite a few questions related to this (convert string
to float, etc etc), but I need something more generic, which I could not find
(so I hope this will also help out other people with a similar problem). I
have made a so... |
Python an open-source list of words by valence or categories for comparison
Question: I tend to take notes quite regularly and since the great tablet revolution
I've been taking them electronically. I've been trying to see if I can find
any patterns in the way I take notes. So I've put together a small hack to
load the... |
tagging pos in nltk using backoff ngrams
Question: I tried make part of speech (or POS) tagger in nltk but I can't get it to work
for more than one ngram tagger for a time using backoff. I read that you use
more taggers for higher scores but it won't work for me. I want it to first
use more words then use less down to ... |
Can't import module from library
Question: I have a script that requires two other modules to be loaded from another
folder in the same directory as the script.
In the main script I have the line:
from modules import *
But I keep getting this error:
AttributeError: 'module' object h... |
Bash commands tail fails to produce output in python
Question:
#!/usr/bin/env bash
I am working on using bash commands in python I found this example in Red hat
magazine the tail command does not produce any output. I would like to
understand why it is failing and I have also tried to import subprocess but
t... |
Cannot plot anything or display pylab frame in new process using python multiprocessing
Question: Does anyone have any idea why the code below won't even open up a pylab figure
window? If the body of the test function is moved to the main process it works
fine, but I'd like to do some plotting from within a new process... |
Python, Django, Mongodb: ImportError: No module named bson.objectid
Question: I'm following this tutorial exactly. Tried deleting and restarting many times
with virtualenv and I'm still getting errors. Is it python, mongodb and django
supposed to be this frustrating to set up?
<http://docs.mongodb.org/manual/tutorial/... |
python pack() and grid() methods together
Question: Im new to python so please forgive my Noob-ness. Im trying to create a status
bar at the bottom of my app window, but it seems every time I use the pack()
and grid() methods together in the same file, the main app window doesn't
open. When I comment out the line that ... |
PySide QThread and QProgressBar
Question: I'm kinda new in GUI programming with PySide, and in Python GUI in general.
I'm trying to set a progress bar value using a thread, but it doesn't work and
there is these errors that keeps on appearing:
QPixmap: It is not safe to use pixmaps outside the GUI threa... |
sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type
Question: I am writing a proxy crawler which stores data in sqlite database,and I prefer
to saving a complex object by statement like `cur.execute("insert into test(p)
values (?)", (p,))`
Then I find a useful official document
[here](http:/... |
How to extract using beautifulsoup python
Question: I am only interested to use beautifulsoup to extract all the value of 3-hr PSI
Readings from 12AM to 11.59PM. Such as the latest **bold** text of **82** at
5pm.
Example of website is at <http://app2.nea.gov.sg/anti-pollution-radiation-
protection/air-pollution/psi/ps... |
distance calculation in python for google earth coordinates
Question: Hi I have a kml file called Placemark and 4 nodes (placemarks) that are
located in an area on Google Earth. Each placemark-node has a longitude and a
latitude.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.n... |
How to create a self-destroying child window to monitor an activity?
Question: As a followup to [this
question](http://stackoverflow.com/questions/17117156/create-a-python-tkinter-
window-with-no-x-close-button), I wanted to know whether there's a way in
Python/Tkinter to create a child window, have it show text progre... |
iPython Notebook in Windows - Error on Startup
Question: I am trying desperately to get ipython notebook to work in a windows
environment. I installed Continuum IO's Anaconda, a scientific distribution of
python. I want to use ipython notebook, but get the following error. `ipython`
in the terminal works fine. Any thou... |
taking mean of data read in 'error cannot perform reduce with flexible type' python
Question: I am trying to read in data from a text file and take the mean of this data,
but I am getting the error cannot perform reduce with flexible type. I dont
know why, can somebody please help. here is my code.
right... |
Process xml input with python regex
Question: I need to clean up an xml file before I can process it. The file has junk at
the start and end, and then junk in between elements. Here is an example file:
junkjunkjunkjunk<root>
\par junkjunkjunkjunkjunk<level1>useful info to keep</level1>
</root>
... |
Python 3 script using libnotify fails as cron job
Question: I've got a Python 3 script that gets some JSON from a URL, processes it, and
notifies me if there's any significant changes to the data I get. I've tried
using [notify2](https://pypi.python.org/pypi/notify2) and
[PyGObject](https://live.gnome.org/PyGObject/)'s... |
How would I go about improving/making this run faster?
Question: I'm a beginner in Python trying to get better, and I stumbled across the
following exercise:
> Let n be an integer greater than 1 and s(n) the sum of the dividors of n.
> For example,
>
>
> s(12) 1 + 2 + 3 + 4 + 6 + 12 = 28
>
>
> Also,
>
>
... |
Python: Trying to set attributes of a class instance from output of another class instance
Question: I have list of content block 'instances' which as the list is processed the
content for each block is generated in an instance of a content type class (if
that makes sense).
As I iterate through the list I am trying to... |
Can distutils install the module/package as an executable script?
Question: I'm using distutils.core.setup for the first time. I got it to install my
module in /usr/lib/python/site-packages.
If I run python from any directory and do `import my_module` it all works
great.
However, I need to run my module as script. It... |
How do I log in to my online bank account and print the transaction history?
Question: I want to log in to my online bank account and print the transaction history.
I'm using an alternative to
[mechanize](http://wwwsearch.sourceforge.net/mechanize/) called
[Splinter](http://splinter.cobrateam.info/) because it's much ... |
Python - Search for hex value marker and extract data
Question: I am new to python and have tried searching for help prior to posting.
I have binary file that contains a number of values I need to parse. Each
value has a hex header of two bytes and a third byte that gives a size of the
data in that record to parse. Th... |
Can socket objects be shared with Python's multiprocessing? socket.close() does not seem to be working
Question: I'm writing a server which uses multiprocessing.Process for each client.
socket.accept() is being called in a parent process and the connection object
is given as an argument to the Process.
The problem is ... |
Working with large primes in Python
Question: What is an efficient way for working with large prime numbers with Python? You
search on here or on google, and you find many different methods for doing
so... sieves, primality test algorithms... Which ways work for larger primes?
Answer: For determining if a number is a... |
Python xml : list all elements in item
Question: I need to list all elements in my `<product>` item, because the elements of
`<product>` is variable.
XML file :
<catalog>
<product>
<element1>text 1</element1>
<element2>text 2</element2>
<element..>text ..</element..>... |
What if/ should I use threading to update global variables.[pythonic way]
Question: I have a function to update a global/class variable. So, What should care
after regularly invoke such function as subthread?(in asynchronous way)
Or, any suggestions to avoid using this pattern? (the pathonic way)
import... |
pyqt Using QDataWidgetMapper to update row in database
Question: I am trying to use the QDataWidgetmapper to update a row in the database but
my issue is when trying to call the update function row is not a global
variable and I have tried to use it in the same function that calls the
Qdialog for the input int. I canno... |
How to control gdb using Python subprocess.Popen?
Question: So I'm writing (or at least trying to) a program to compare the outputs of two
gdb runs in python. This is what I have so far:
from subprocess import *
import subprocess
file = raw_input('enter program name (with a ./ if in local di... |
Websocket/TCP proxy with autobahn and twisted
Question: I am trying to write a proxy with autobahn and twisted. When a websocket
client connects I want to open a TCP connection to a server. What I can't seem
to figure out is how to pass data received via the TCP connection back to the
websocket client.
#... |
Python tkinter error messages
Question: I have an application spread across several modules that consists of a main
module, a UI, a processing function and a module to hold the global variables.
I'm having problems with tkinter throwing error messages, but I don't
understand why, and I think the route cause may be unre... |
How do I access wity python ctypes to array values returned with a pointer from a dll coded in Delphi?
Question: I have a Delphi library that is exposing a results with a procedure like this:
procedure Script_GetFindedList(List : Pointer; out Len : Cardinal); stdcall;
var X : TArray<Cardinal>;
be... |
open file named with two digit year-Python
Question: I'm opening a file named in the following format :
ex130626.log
exYYMMDD.log
following code wants 4-digit year. How to get the two digit year like 13?
today = datetime.date.today()
filename = 'ex{0}{1:02d}{2:02d}.log'.forma... |
parallel installion of Python 2.7 and 3.3 via Homebrew - pip3 fails
Question: I would like to make the jump and get acquainted with Python 3. I followed the
instructions found [here](https://github.com/mxcl/homebrew/wiki/Homebrew-and-
Python#python-2x-or-python-3x) with the installation working flawlessly.
I'm also ab... |
python walk directory tree with excluding certain directories
Question: i am trying to walk a directory tree and exclude certain directories. Now,
according to [os.walk exclude .svn
folders](http://stackoverflow.com/questions/4276255/os-walk-exclude-svn-
folders) for example i should be able to modify the 'dirs' list w... |
reading v 7.3 mat file in python
Question: I am trying to read a matlab file with the following code
import scipy.io
mat = scipy.io.loadmat('test.mat')
and it gives me the following error
raise NotImplementedError('Please use HDF reader for matlab v7.3 files')
NotImplementedE... |
Detect from a running python script if the optimize flag is -O or -OO
Question: Sometime I'd like to spawn a child process with the same optimization flags
used to start the parent.
I can use something like:
`optimize = not __debug__`
But this way I match both `-O` and `-OO` flags.
Is there some python internal sta... |
python subprocess reading terminal output and reply using PyQt4 message pop up
Question: Hi im making a program to check adb devices in python
I cant make a pop up window please correct my code.
import sys import subprocess from PyQt4 import QtGui, QtCore
ad = subprocess.check_output(["adb", "devices"])
... |
python strings to int/float in an efficient way
Question: I have an array (in numpy, or in pandas) containing (non-unique) strings. Some
of them are ints written as strings, some comprise of both digits and letters.
What I would like to do is to map these strings onto (some) int or float
values, in order to process the... |
OpenCV VideoWriter with python gives 5.54kb file
Question: I am trying to create a TimeLapse creator in python using OpenCV, and have the
following code:
import cv2
import os
import string
directory = (r"C:\Users\Josh\Desktop\20130216")
video = cv2.VideoWriter(r"C:\Users\Josh\Desktop... |
Python script for ip to hostname lookup
Question: I have never attempted to create a script in my entire life but I've come
across an issue where I would require a script (preferably Python) to perform
lookups. I have a system that actively monitors web and ftp traffic and I'm
able to get the sender IP address (typical... |
How to get Python to look at Sub-Folders?
Question: I am trying to create a python script that will look in a series of sub-
folders and delete empty shapefiles. I have successfully created the part of
the script that will delete the empty files in one folder, but there are a
total of 70 folders within the "Project" fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.