text stringlengths 226 34.5k |
|---|
Python SFTP download files older than x and delete networked storage
Question: I'd like to download some files via sftp that are older than say 2 hours. Then
I'd like to delete them from the network site. I can use the following code
for sftp but handling objects on the remote machine is giving me problems. The
code be... |
NameError at / name 'editareapage' is not defined
Question: Ok so i am a noob building a basic site in django with python. I am trying to
implement a new page in my site called edit area. Whenever i visit the page
all i get is this...
NameError at /
name 'editareapage' is not defined
Request Meth... |
Python - importing a module from same directory
Question: > **Possible Duplicate:**
> [Using the Python NLTK (2.0b5) on the Google App
> Engine](http://stackoverflow.com/questions/1286301/using-the-python-
> nltk-2-0b5-on-the-google-app-engine)
I was adding my script to the Google App Engine and I needed to get som... |
Using variables in creating a file name
Question: I'm pretty new to python, and am wondering if there's any way to put a
variable into a file name, so that you can create files with different names
each time.
In my particular case, I'd like to add date and time to the file name. If it
was possible, this would work per... |
python does not connect to local XMPP server
Question: i'm trying to connect my local XMPP server by the code coming below
import xmpp
client = xmpp.Client('localhost',debug=[])
client.connect(server=('localhost',5222))
but i always get this message :
> An error occurred while looking up _... |
Parse xsd:dateTime formatted string to python datetime
Question: Given a string in [xsd:dateTime
format](http://books.xmlschemata.org/relaxng/ch19-77049.html) I want to create
a python datetime object. I especially need to be able to parse for example a
string like this '2012-09-23T09:55:00', but also all other defined... |
Matplotlib: Repositioning a subplot in a grid of subplots
Question: I am trying to make a plot with 7 subplots. At the moment I am plotting two
columns, one with four plots and the other with three, i.e. like this:
I am constructing this plot in the fo... |
smtp proxy in python requires root authentication to run
Question: I have the following simple python code on Linux
import smtpd
proxy = smtpd.PureProxy(('0.0.0.0',25), None)
which runs fine when run as sudo, but gives an `socket.error: [Errno 13]
Permission denied` error when running as standa... |
ttk.Entry not behaving the same way that tk.Entry does
Question: I'm switching over a small app (Python 2.7.3/32 on Win 7/64) to use ttk and
I'm having trouble making ttk.Entry work the way tk.Entry does; ttk.Entry
isn't updating the displayed entry box when I set its contents:
import Tkinter as tk
i... |
How to get % usage of a network card on Windows 7 using Python
Question: How do I get % usage of one or many network cards on Windows 7 using Python? I
tried using psutil library but it returns only transfered data.
I would like to get list of network cards and their usage
Network card 1 - 1%
Networ... |
How to scrape multiple HTML tables with Beautiful Soup parser?
Question: sorry for the stupid question ... just started using python (but I love it).
**The problem:** I want to scrape data from the [center for documentation of
violism in syria](http://vdc-
sy.org/index.php/en/martyrs/1/c29ydGJ5PWEua2lsbGVkX2RhdGV8c29y... |
IntegrityError using q.save(): may not be NULL
Question: I'm not sure why I'm getting the error. Here are the views and clesses
from polls.models import Word, Results
def detail(request):
q = Word(type="How do you like")
q.save()
Word.objects.get(pk=1)
q.scor... |
Does sphinx run my code on executing 'make html'?
Question: I inherited a rather large codebase that I want to create html-documentation
for. Since it is written in Python I decided to use sphinx because the users
of the code are accustomed to the design and functionality of the python-
documention that's created with ... |
Python Merge 2 Dictionaries without overwriting
Question: If a and b are 2 dictionaries:
a = {'UK':'http://www.uk.com', 'COM':['http://www.uk.com','http://www.michaeljackson.com']}
bb = {'Australia': 'http://www.australia.com', 'COM':['http://www.Australia.com', 'http://www.rafaelnadal... |
Trouble using scriptedmain in MinGW
Question: I want to reproduce [this Perl
code](https://github.com/mcandre/scriptedmain/tree/master/perl) in C, bundling
API and CLI in the same C source code file
([scriptedmain](http://rosettacode.org/wiki/Scripted_Main#C)). This is done in
Python with `if __name__=="__main__": main... |
Error when importing programs IDLE
Question: Im new to Python but Im getting on pretty well, however I cannot seem to
import save programs into IDLE. Could someone assist me where that is
concerned, please. This is one of the errors no matter how simple the program
is:
>>> import dinner
Tracebac... |
Python Ncurses printing a single char to position
Question: I am not so into ncurses, but it should be working on C, I do not know what is
wrong, I just want to print some character to screen continuosly but I cannot
find how to fix this error:
File "capture.py", line 37, in <module>
stdscr.... |
Mapping Unicode to ASCII in Python
Question: I receive strings after querying via urlopen in JSON format:
def get_clean_text(text):
return text.translate(maketrans("!?,.;():", " ")).lower().strip()
for track in json["tracks"]:
print track["name"].lower()
get_clean_... |
Python- how to use while loop to return longest line of code
Question: I just started learning python 3 weeks ago, I apologize if this is really
basic. I needed to open a .txt file and print the length of the longest line
of code in the file. I just made a random file named it myfile and saved it to
my desktop.
... |
Python function to extract multiple segments of a file path
Question: I would like to write a Python function that is capable of taking a file path,
like:
> /abs/path/to/my/file/file.txt
And returning three string variables:
* `/abs` \- the root directory, plus the "top-most" directory in the path
* `file` \- th... |
Apache not getting access to virtual environment set up for Django project
Question: I created a virtualenv named '`pyapps`' and installed pinax and django in
it.I've installed apache 2 and mod_wsgi.I created a directory named '`apache`'
inside my django project(`testproject`) and put '`django.wsgi`' file inside
that d... |
Python scipy modules can't be imported with macports install
Question: I've just reinstalled OSX Lion and decided to use macports to get an updated
python, plus numpy, scipy, matplotlib, ipython, etc. After some fuss
everything looks installed correctly in the /opt/ folder, and numpy,
matplotlib, and ipython are runnin... |
how the python interpreter find the modules path?
Question: I'm new to python, and I find that to see the import search paths, you have to
import the `sys` module and than access the list of paths using `sys.path`, if
this list is not available until I explicitly import the `sys` module, so how
the interpreter figure o... |
Suds ignoring proxy setting
Question: I'm trying to use the salesforce-python-toolkit to make web services calls to
the Salesforce API, however I'm having trouble getting the client to go
through a proxy. Since the toolkit is based on top of suds, I tried going down
to use just suds itself to see if I could get it to r... |
add file name without file path to csv in python
Question: I am using Blair's Python script which modifies a CSV file to add the filename
as the last column (script appended below). However, instead of adding the
file name alone, I also get the Path and File name in the last column.
I run the below script in windows 7... |
Can't import logging.handlers inside a nose test
Question: I'm writing a basic test with nose to call a single function from a logging
wrapper, but once I got the test to be discovered I started getting standard
library module import errors.
This is code I'm trying to write some tests for and has been in production an... |
Python with SimPy on Eclipse installation error (Windows 7)
Question: I have been using the PyDev in eclipse for quite a while with no problem.
Today I installed SimPy in my Python and I think it is installed ok, meaning
that in idle commands like:
>>> from SimPy.Simulation import *
>>> now()
... |
what's the fastest way of converting a string time stamp into epoch time with python?
Question: I need to do lots of conversation from string time stamp like '2012-09-08
12:23:33' into a seconds which is based on epoch time.Then i need to get time
gap between two timestamp.I tried two different ways:
dat... |
Understanding "self" in Python
Question: I saw this example from udacity.com :
def say_hi():
return 'hi!'
i = 789
class MyClass(object):
i = 5
def prepare(self):
i = 10
self.i = 123
print i
def say_hi(sel... |
SQLAlchemy won't update my database
Question: I'm making a Pyramid app using SQLAlchemy-0.7.8. I'm using 64bit Python3.2.
The question is, why does the following function not commit anything to the
database?
def create_card(sText,sCard):
"""
create a wildcard instance if all is well (ie,... |
How to sort and keep the integrity of the list?
Question: So I have a minor issue with a script I'm writing. I have a text file that
looks something like:
'20 zebra 12 bear'
That's just an example, the format is 1 line all items separated by spaces.
The script works to sort them out and do a couple... |
Generate all strings up to desired length
Question: I want to generate all the random strings having length varying from 1 till
max_length. Is is there an in-built function in python that would do that? If
not, please tell me how to do this or direct me to posts which covers this
type of problem. Thanks in advance.
A... |
How to color character linux terminal
Question: I would like your your help writing some code: I would like Ubuntu 12.04.1
Terminal to color "/" character opposite as other text.
This could be very important for pretty much everyone, who writes bash/python
directly in console...
**Any ideas where to start?**
I'm thi... |
Does Python 3.3's support of xz-compressed zipfiles extend to zipimport?
Question: Python 3.3's zipfile module understands .zip archives that have been
compressed with bzip2 or xz instead of the traditional deflate algorithm. Does
this extended compression support extend to the zipimport functionality?
Answer: No, th... |
from . import * from module
Question: there is a script in the working directory which I can access with
from . import core.py
but if I would also like to import * from core.py, how would I write this in
python?
Answer: I'm pretty sure it's just:
from core import *
Assuming `... |
OSError, [Errno 13] Permission denied, thrown when I try to upload load file in django with apache/mod_wsgi server
Question: Here is the trace back
Environment:
Request Method: POST
Request URL: http://mysite.com/admin/content/author/add/
Django Version: 1.4.1
Python Versio... |
Text of a Python Function
Question: > **Possible Duplicate:**
> [How can I get the source code of a Python
> function?](http://stackoverflow.com/questions/427453/how-can-i-get-the-
> source-code-of-a-python-function)
First, let me define my problem. I will give a motivation afterward.
## Problem:
de... |
In PyCharm, I have an unresolved reference when calling nose.tools.assert_equals?
Question: When I try to use pycharm with nose, I get red underlines with "unresolved
reference" when calling assert_raises. I'm using a virtualenv interpreter, but
nose is installed and can be run from ipython. Also, running nosetests on
... |
Python - List of Lists Slicing Behavior
Question: When I define a list and try to change a single item like this:
list_of_lists = [['a', 'a', 'a'], ['a', 'a', 'a'], ['a', 'a', 'a']]
list_of_lists[1][1] = 'b'
for row in list_of_lists:
print row
It works as intended. But when I try to... |
Sklearn: ValueError: X and Y have incompatible shapes
Question: I am new to sklearn and in general to python as well. Can you help me figure
out if this script is leading to some solution? Basically I am using an hue
extractor on an Imageset: load iset for training, extract features, define
classifier and then classify... |
XML header getting removed after processing with elementtree
Question: i have an xml file and i used Elementtree to add a new tag to the xml file.My
xml file before processing is as follows
<?xml version="1.0" encoding="utf-8"?>
<PackageInfo xmlns="http://someurlpackage">
<data ID=... |
Live Profiling of Python Server
Question: I want to know where the python interpreter spends the most time. I use it on
a live django application, but it should work for all long running python
processes.
I answer my own question.
Answer:
import os, re, sys, time, datetime, collections, thread, threading, atexi... |
Jenkins: HTTP error 403 when getting config
Question: I try to update Jenkins jobs' config programmatically, and the [python Jenkins
api](http://packages.python.org/jenkinsapi/index.html) looked ok, but I can't
retrieve a config because of HTTP error 403 (forbidden):
from jenkinsapi import api
j = ap... |
Python's multiprocessing map_async generates error on Windows
Question: The code below works perfectly on Unix but generates a
multiprocessing.TimeoutError on Windows 7 (both OS use python 2.7).
Any idea why? Thanks.
from multiprocessing import Pool
def increment(x):
return x + 1
... |
python regular expression substitute
Question: I need to find the value of "taxid" in a large number of strings similar to
one given below. For this particular string, the 'taxid' value is '9606'. I
need to discard everything else. The "taxid" may appear anywhere in the text,
but will always be followed by a ":" and th... |
Getting a tweet's ID with Twython?
Question: I'm using Twython (Python wrapper for Twitter API, found
[here](https://github.com/ryanmcgrath/twython "Link to Twython's GitHub
page").)
Objective: I'm trying to make a simple bot that searches for a keyword and
replies to tweets with the keyword in them.
Example: Send se... |
Python: Way to speed up a repeatedly executed eval statement?
Question: In my code, I'm using `eval` to evaluate a string expression given by the
user. Is there a way to compile or otherwise speed up this statement?
import math
import random
result_count = 100000
expression = "math.sin(v... |
Why doesn't strip method in python take the two "\n" in a text file
Question:
import pdb
input_file_eng = open('engltreaty.txt')
word_list_eng = input_file_eng.read()
pure_word_list_eng = word_list_eng.strip("\n").strip("\r").strip('-').strip('.').strip(',').strip('(').strip(')').strip('[').strip(']')
... |
Making a Point Class in Python
Question: I am trying to create a class in python titled "Point." I am trying to create
a point on a coordinate plane x and y and track them. As well as find the
distance between the points. I have to use functions and methods. I have
started and here is my code. I am just not sure how to... |
Python Requests logging to file
Question: How can I configure logging to file requests's get or post?
my_config = {'verbose': sys.stderr}
requests.get('http://httpbin.org/headers', config=my_config)
What should I use in verbose?
Answer: Have you tried simply opening a file?
>>>... |
import variable
Question: attrubuI'm new to python but don't know how to solve this:
import wx
class myclass(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,id,'Frame',size=(300,200))
panel=wx.Panel(self)
button=wx.Butt... |
Compare multiple file in python
Question: i have a set of directories with `n` number of files, I need to compare each
of those files (within one directory) and find if there is any difference in
them. I tried `filecmp` and `difflib` but they only support two files.
Is there anything else I can do to compare/diff the ... |
Given a .torrent file how do I generate a magnet link in python?
Question: I need a way to convert .torrents into magnet links. Would like a way to do so
in python. Are there any libraries that already do this?
Answer: You can do this with the [bencode](http://pypi.python.org/pypi/bencode/1.0)
module, extracted from ... |
Finding if a string exists in a nested tuple in Python
Question: What is the best (and fastest) way, in Python 2.7.x, to check if a string (or
any other data type) exists in a nested tuple?
For example:
RECIPES = (
('apple', 'sugar', 'extreme_Force'),
('banana', 'syrup', 'magical_ends'),... |
Any examples of SQLalchemy 0.7, UPDATE using from_statement()
Question: I'm writing a quick one-off migration script that updates a single field in a
table with half a million rows.
Since I hadn't planned on writing out full models for the joins I'm doing to
fetch the initial ~25000 rows of data, I've been trying to f... |
SciPy and scikit-learn - ValueError: Dimension mismatch
Question: I use [SciPy](http://scipy.org/) and [scikit-learn](http://scikit-
learn.org/stable/) to train and apply a Multinomial Naive Bayes Classifier for
binary text classification. Precisely, I use the module
[`sklearn.feature_extraction.text.CountVectorizer`](... |
Incorporating striplist() into python3 code?
Question: I have a csv reader that pulls data values into a list, once this data has
been put into a list I would like to strip the whitespace in the list. I have
looked online and seen people using `striplist()`
e.g
def striplist(l):
return([x.strip(... |
Python find ALL combinations of a list
Question: > **Possible Duplicate:**
> [Power set and Cartesian Product of a set
> python](http://stackoverflow.com/questions/10342939/power-set-and-cartesian-
> product-of-a-set-python)
scratch the old problem. I figured everything out. Now I have an even crazier
issue. Here i... |
Boto and Python on AWS
Question: I am trying to get boto to work, but I am getting an error.
Installed boto via `easy_install`, or simply `python ./setup.py install`
cat boto.py
#!/usr/bin/python
import boto
conn = boto.connect_ec2()
3c075474c10b% ./boto.py
Traceback (most rece... |
Python: How can I make the ANSI escape codes to work also in Windows?
Question: If I run this in python under linux it works:
start = "\033[1;31m"
end = "\033[0;0m"
print "File is: " + start + "<placeholder>" + end
But if I run it in Windows it doesn't work, how can I make the ANSI escape
c... |
Debug python and Java at the same time
Question: I am using Python to invoke many of my Java programs. Is it possible to use
debug perspective for both Python and Java and trace the progress in both
languages at the same time? Thanks
Answer: I downloaded two different Eclipse, one for JavaSE and when for PyDev. A
Pyt... |
How to get the type of change in P4Python
Question: I'm trying to work with P4Python, and hoping to find a way to be able to check
what's the type of change of each file in the changelist. I mean, I'd like to
know if it's a modification, or whether this file has **Marked for Add** or
**Marked for Delete**.
My code is ... |
Pygment lexer multiple tokens
Question: I'm using the lexer of Pygments, a Python plugin. I want to get tokens for a
C++ code, in particular when a new variable is declared, e.g.
int a=3,b=5,c=4;
Here a,b,c should be given the type "Declared variables", which is different
from
a=3,b=... |
How do I find the salesforce package prefix using the sforce or suds python libraries?
Question: I need to update some custom fields of `salesforce` objects. For that I am
trying to use the `upsert` method. I am little confused on choosing the
module; `SforceEnterpriseClient` or `SforcePartnerClient` of `sforce`. I thi... |
SQLAlchemy MetaData.reflect not finding tables in Oracle db
Question: I'm attempting to reverse engineer an existing Oracle schema into some
declarative SQLAlchemy models. My problem is that when I use
[`MetaData.reflect`](http://docs.sqlalchemy.org/en/rel_0_7/core/schema.html?highlight=metadata.reflect#sqlalchemy.sche... |
Python app which reads and writes into its current working directory as a .app/exe
Question: I have a python script which reads a text file in it's current working
directory called "data.txt" then converts the data inside of it into a json
format for another separate program to handle.
The problem i'm having is that i... |
python master/child looping unintentionally
Question: Problem: I expect child to time out and be done. but instead it times out and
begins to run again.
Can anyone tell me why this program runs forever? I expect it to run one time
and exit...
Here is a working program. Master threads a function to spawn a child. Work... |
Finding out which module is setting the root logger
Question: How would I be able to find which module is overriding the Python root logger?
My Django project imports from quite a few external packages, and I have tried
searching for all instances of logging.basicConfig and logging.root setups,
however most of them ar... |
pysnmp 4.2.3: pysnmp.smi.error.SmiError: importSymbols: empty MIB module name
Question: I have two scenarios, both reference [`SNMP.py` in this
answer](http://stackoverflow.com/a/7791143/667301):
**pysnmp (v4.2.3) and pysnmp-mibs (v0.1.4)** :
>>> # pysnmp-mibs 0.1.4 and pysnmp 4.2.3
>>> from SNMP im... |
Geektools and Python
Question: I have been playing with Python and geektools and I had the script working
before I tided up the code and used loops.
Now it will not display anything past the `lalala` method.
I am working on mac 10.8.1 with geektools 3.0.2.
#!/usr/bin/python
#Simple script that... |
Extracting an element from XML with Python3?
Question: I am trying to write a Python 3 script where I am querying a web api and
receiving an XML response. The response looks like this –
<?xml version="1.0" encoding="UTF-8"?>
<ipinfo>
<ip_address>4.2.2.2</ip_address>
<ip_type>Mapped</ip_... |
Access Chrome DOM tree with python
Question: Using Chrome DevTools you can see the DOM tree of a page. Is there a way to
access and pull out that tree using python?
Answer: Have you used BeautifulSoup library? This section on the tutorial may answer
your question.
<http://www.crummy.com/software/BeautifulSoup/bs3/doc... |
KeyError when using DictReader()
Question: I have a series of .src files that I am trying to input into a dictionary
using DictReader(). The files look like the following (just the header and the
first row):
SRC V2.0.. ........Time Id Event T Conf .Northing ..Easting ...Depth Velocity .NN_Err .EE_Err .DD... |
1:1 call PHP from Python
Question: We're using Splunk (A tool to analyse machine data like log files) and have an
application in PHP. For some data we need to do a call to our application in
php (CLI-based). Unfortunately Splunk only supports Python calls.
Is there an easy way to 1:1 "forward/call" php with the same ... |
Getting 'DatabaseOperations' object has no attribute 'geo_db_type' error when doing a syncdb
Question: I'm attempting to run `heroku run python manage.py syncdb` on my GeoDjango app
on Heroku, but I get the following error:
**AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'**
[All](http://dj... |
How to organize multiple python files into a single module without it behaving like a package?
Question: Is there a way to use `__init__.py` to organize multiple files into a
**module**?
Reason: Modules are easier to use than packages, because they don't have as
many layers of namespace.
Normally it makes a package, ... |
TypeError: 'encoding' is an invalid keyword argument for this function
Question: My python program has trouble opening a text file. When I use the basic open
file for read, I get an ascii error. Someone helped me out by having me add an
encoding parameter that works well in Idle, but when I run the program through
term... |
How to custom sort a Django queryset
Question: Given a data model with Title strings, say:
class DVD(models.Model):
title = models.CharField(max_length=100)
class DVDAdmin(admin.ModelAdmin):
ordering = ('title',)
sample_titles = {"A Fish Called Wanda", "The Good, the Bad, and... |
Parsing apache log files
Question: I just started learning Python and would like to read an Apache log file and
put parts of each line into different lists.
line from the file
> 172.16.0.3 - - [25/Sep/2002:14:04:19 +0200] "GET / HTTP/1.1" 401 - ""
> "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827"
ac... |
Installing a django project, database issue
Question: I am installing the sunlight fondation's brisket and I am really new to
python, and even more to django. So I downloaded on github the project :
<https://github.com/sunlightlabs/brisket>.
So, when I run the ./manage.py run server command, I get an error message. Bu... |
Python: os.path.isdir /isfile /exists not working, returning False when they should return True
Question: So, here is my little program. It should print all files in a given directory
+ all files in every subdirectory.
import os
def listFiles(directory):
dirList = os.listdir(directory)
... |
wxpython setsizer
Question: The panel1 in page1 of the Notebook is defined with Size(400,100)..I don't
want the Sizer to resize my panel..
test.py
import random
import wx
########################################################################
class TabPanel1(wx.Panel):
#-------... |
Cannot seem to crawl a deep directory with my Python script, any idea?
Question: The script is basically creating a list with all the files in all directories.
Any idea why is seems to crash when it has to scan a directory that is larger
than a few files?
import os
correctlyNamedDirectories = []... |
"ImportError: cannot import name ..." - raised on "import from" but not on direct import
Question: What is the precise rule under which this exception is raised by Python 3
interpreter?
There are plenty of SO questions about that, with excellent answers, but I
could not find one that gave a clear, general, and logical... |
How to structure my code?
Question: Edit: I just combined all my questions to one big question: [Need tutorial for
menubar-handling & panel-
building](http://stackoverflow.com/questions/12604139/need-tutorial-for-
menubar-handling-panel-building)
I have a "bigger" question: I'm new to python and I started creating a l... |
Python 3: Documenting modules
Question: I study how to document my code. So, I prepared a file docstrings.py and
placed it in a directory. Now I would like to have a look at what I
documented. In other words I want to type help(docstrings.square) and get the
documentation on square function in my module.
... |
Creating a new file, filename contains loop variable, python
Question: I want to run a function over a loop and I want to store the outputs in
different files, such that the filename contains the loop variable. Here is an
example
for i in xrange(10):
f = open("file_i.dat",'w')
f.write(str(f... |
Encoding in python
Question: I have problem with comparing string from file with string I entered in the
program, I should get that they are equal but no matter if i use
decode('utf-8') I get that they are not equal. Here's the code:
final = open("info", 'r')
exported = open("final",'w')
lines = ... |
Take a screenshot of open website in python script
Question: I need to write a python script which opens a website and when the website is
completly opened it takes a screenshot of the opened website.
I wrote sth like this:
import webbrowser
import wx
wx.App()
link = "http://stackoverfl... |
Finding duplicate files with python
Question: I'm trying to write a Python script that will crawl through a directory and
find all files that are duplicates and report back the duplicates. What's the
best was to solve this?
import os, sys
def crawlDirectories(directoryToCrawl):
crawledDi... |
Sum all columns with a wildcard name search using Python Pandas
Question: I have a dataframe in python pandas with several columns taken from a CSV
file.
For instance, data =:
Day P1S1 P1S2 P1S3 P2S1 P2S2 P2S3
1 1 2 2 3 1 2
2 2 2 3 5 4 2
And what I need is... |
Using Python with a set of not regular point X,Y,Z in order to create a regular grid where each pixel is the minimum value of the point
Question: I have a set of not-regular points with X,Y and Z value. I wish to create a
regular square grid (to export in `TIFF` format or `ASCII` format) with a
resolution of 0.5 x 0.5 ... |
mysql int being passed to python as long
Question: I have a mysql database in which I have defined a table as:
CREATE TABLE IF NOT EXISTS tblModel (
model_id int NOT NULL AUTO_INCREMENT,
model_file varchar(50) NOT NULL,
model_name varchar(50) NOT NULL,
model_descrip varchar(200) NOT NULL,... |
how to turn readlines into a string... perhaps?
Question: I think my largest problem is I don't know how to ask the question of what it
is exactly that I am looking for.
I stole most the code from a flashcard program from
<http://www.tuxradar.com/content/code-project-build-flash-card-app> and
modified it a bit to suit... |
ValueError: Too Many Values to Unpack Aptana Studio 3
Question: I am working on exercise 13 from learnpythonthehardway.org. I should run this
code:
from sys import argv
script, first, second, third = argv
print "The script is called:", script
print "Your first variable is:", first
pr... |
Matplotlib savefig to BytesIO is slightly wrong?
Question: I'm trying to save [matplotlib](/questions/tagged/matplotlib "show questions
tagged 'matplotlib'") figures to a memory stream, exactly as in another
example on SO:
import matplotlib.pyplot as plt
import io
plt.figure()
plt.p... |
Bottle Microframework does not close the socket once is closed
Question: I ran an API RestFul with bottle and python, all works fine, the API is a
daemon running in the system, if I stop the daemon by command line the service
stop very well and closed all the port and connections, but when I go to close
the service thr... |
Python ValueError: too many values to unpack with glob
Question: I'm trying to load two sets of CSV files and do some calculations on both such
as difference of each set, mean absolute error `set1 - set2` exc.
I'm trying to load both sets like this:
import glob
for a, b in (glob.glob("*a.csv"), ... |
How to get pubsub to work with pyinstaller?
Question: I'm trying to use pyinstaller to build an exe from my python code. One of the
modules I'm using is pubsub (pypubsub really. It used to be a part of
wxpython). I'm getting errors when I try to run the exe. It complains
"ImportError: No module named listenerimpl".
I'... |
Installing a .tar.bz2 in windows
Question: I am a newbie to installing python extensions working on Windows 7, running
Python 2.6 - I need to install the Levenshtein library from
[http://code.google.com/p/pylevenshtein/downloads/detail?name=python-
Levenshtein-0.10.1.tar.bz2&can=2&q=](http://code.google.com/p/pylevens... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.