text stringlengths 226 34.5k |
|---|
AttributeError: 'tuple' object has no attribute 'high0'
Question: I am trying to write a list of data to an excel spreadsheet. Something is
going wrong when I try to iterate over my entire list in parallel. I get the
following error:
File "canadascript.py", line 57, in <module>
sheet.write(row, h... |
MySQLdb on MAC OS 10.6.8
Question:
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.6-intel.egg/MySQLdb/__init__.py", line 19, in <module... |
How to share Ipython notebook kernels?
Question: I have some very large IPython (1.0) notebooks, which I find very unhandy to
work with. I want to split the large notebook into several smaller ones, each
covering a specific part of my analysis. However, the notebooks need to share
data and (unpickleable) objects. Now, ... |
Moving Around A Python Canvas Without Using Scrollbars
Question: **Background:**
I have a program using Tkinter as the basis of the GUI. The program has a
canvas which is populated with a large number of objects. Currently, in order
to move all objects on the screen, I am simply binding a movement function to
the tag... |
Iterate over two nested 2D lists where list2 has list1's row numbers
Question: I'm new to Python. So I want to get this done with loops without using some
fancy stuff like generators. I have two 2D arrays, one integer array and the
other string array like this:
1. Integer 2D list:
Here, dataset2d[0][0] is number o... |
NetLocalGroupGetMembers returns different members number according to LOCALGROUP_MEMBERS_INFO value
Question: I'd like to retrieve the number of users belonging to some Windows UserGroup.
From the documentation of the Python API :
win32net.NetLocalGroupGetMembers(server, group, *level*)
I understa... |
wxPython: program runs but not displaying
Question: Before I made some changes to the following program, everything went fine:
## Program before modification:
#! /usr/bin/env python
""" A bare-minimum wxPython program """
import wx
class MyApp(wx.App):
def OnInit(self):
... |
Python Tkinter indeterminate progress bar not running
Question: I'm currently creating a Tkinter Gui for Python 2.7 and having trouble working
the progress bar. I need to load largish files into my program which takes
some time, so I wanted to get a progress bar to show the user the program
isn't frozen loading the fil... |
ssh using sshpass in python seems to not work
Question: I have a python script which is supposed to ssh in to a client and execute a
bash from the client. As a test scenario I am using just 1 machine to connect
but the objective is to connect to several clients and execute bash scripts
from those machines.
My Python c... |
Python simplejson quoting for R rjson input
Question: I'm processing data within Python, and would like to stream records to R using
JSON formatting and `simplejson` on the Python side, and `rjson` on the `R`
side.
How can I output records out of Python so that R's `fromJSON` can process them
into a one-line dataframe... |
Python set Parallel Port data pins high/low
Question: I am wondering how to set the data pins on a parallel port high and low. I
believe I could use PyParallel for this, but I am unsure how to set a specific
pin.
Thanks!
Answer: You're talking about a software-hardware interface here. They are usually set
low and hi... |
Necessary data structure for making heatmaps in Python
Question: **EDIT** Just realized the way I was parsing in the data was deleting numbers
so I didn't have an array for the correct shape. Thanks mgilson, you provided
fantastic answers!
I'm trying to make a heatmap of data using python. I have found this basic
code... |
Parsing args and kwargs in decorators
Question: I've got a function that takes args and kwargs, and I need to do something in
my decorator based on the value of the **2nd** arg in the function, like in
the code below:
def workaround_func():
def decorator(fn):
def case_decorator(*args,... |
python xml to string, insert into postgres
Question: Here is my code:
#!/usr/bin/python
import psycopg2
import sys
from lxml import etree
def main():
#Define our connection string
conn_string = ("host=host dbname=lal user=user password=pass")
# ... |
Google Drive SDK not returning headRevisionId for google Docs format
Question: I have been working on google drive sync mechanism. I am using Google Drive
Python SDK for it. The issue i am having is that the google SDK does not
return headRevisionId is file resource's metadata if the file is google
MimeType i.e it has ... |
NameError: name 'FileAttachment' is not defined
Question: I have two different Django Apps, one of them is `fileUpload`. In File Upload
I added a Generic Relation as:
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import Conten... |
why my coroutine blocks whole tornado instance?
Question:
from tornado import web, gen
import tornado, time
class CoroutineFactorialHandler(web.RequestHandler):
@web.asynchronous
@gen.coroutine
def get(self, n, *args, **kwargs):
n = int(n)
def callbacker... |
RRD wrong values
Question: I'm playing with RRDTool, but it shows wrong values. I have little python
script:
import sys
import rrdtool
import time
i = 0
rrdtool.create(
'tempo.rrd',
'--step', '10',
'DS:temp:GAUGE:20:-40:100',
'RRA:LAST:0.5:1:1500'... |
Using Iron Python with Solidworks API
Question: I've been working on scripting some repetitive behaviors in Solidworks using
python. I spent a while trying to go through the win32com library and managed
to get a lot to work, but ran into a roadblock. So I'm now trying to control
the API via Iron Python. Just trying to ... |
At what point does a cache key get correctly generated
Question: In the according to the
[docs](https://docs.djangoproject.com/en/dev/topics/cache/#cache-key-
prefixing) it effectively says that you should use a `KEY_PREFIX` when sharing
a cache instance between servers. My question is when does is at what point
does t... |
Corrupted VIM Indentation?
Question: From time to time the identation within my python scripts suddenly become, i
suppose you could say corrupted. The identation will suddenly alter, making my
programs fail.
If I look at the file using cat I can see the identation is wrong. But within
VIM it shows as fine. Here is the... |
facing errors in installing django-tracking
Question: I am trying to install django-tracker and have extracted it in a directory and
now when am running python setup.py i am getting the followig error
vikas@vikas-laptop:~/djcode/django-tracking-0.4.1$ python setup.py
Traceback (most recent ... |
Trying to use timeit.timeit
Question: I'd like to measure the time of running for two codes, I tried looking up the
python documentation for timeit, but I didn't really understand. Could someone
explain in a more beginner-level vocabulary?
Answer: _Note:_ Copied to [How to use timeit
module](http://stackoverflow.com/... |
Python Reading Multiple NetCDF Rainfall files of variable size
Question: The issue I have is that the Australian Bureau of Meteorology has supplied me
with Rainfall Data Files, that contains rainfall records recorded every 30
minutes for all active gauges. The problem is that for 1 day there are 48
30Minute files. I wa... |
Tornado websockets supporting binary
Question: I am using tornado as a server. I would like it to receive binary data. The
server side is as simple as simple gets:
import tornado.websocket
import tornado.httpserver
import tornado.ioloop
import tornado.web
class WebSocketServer(tornad... |
Stopping a turtle when it reaches a point, Python
Question: I am currently in a beginning programming class, and I am blowing through the
assignments. Right now, I have to make 3 houses with the module turtle (which
I accomplished):
def drawBody(mover):
#Rectangle part
mover.fillcolor("bl... |
Python script for trasnforming ans sorting columns in ascending order, decimal cases
Question: I wrote a script in Python removing tabs/blank spaces between two columns of
strings (x,y coordinates) plus separating the columns by a comma and listing
the maximum and minimum values of each column (2 values for each the x ... |
Dynamic Semantic errors in Python
Question: i came across this as an interview question. This question seemed interesting.
So, i am posting it here.
Consider the operation which gives semantic error like division by zero. By
default, python compiler gives output like "Invalid Operation" or something.
Can we control th... |
GAE Configure for Django App
Question: Can someone please help me transition a django app into the Google App Engine
(GAE)? I would like to be abel to take all of the files in my django app and
copy them to the GAE app. However, I am not sure how the default files for the
GAE should be configured. How should main.py fi... |
Python Import Error for modules installed with Homebrew
Question: I've already installed PySide using homebrew, but I get an error when my
scripts run things such as
from PySide import QtWebKit
When I try `brew install pyside` I get an error that `pyside-1.2.0 already
installed`
When I try `pip in... |
xampp-control-panel import error missing gtk on mac os x lion
Question: I installed XAMPP 1.8.3 on Mac OS X Lion (10.8.5). I'm trying to launch xampp-
control-panel in /Applications/XAMPP/xamppfiles/share/xampp-control-panel. It
asks that I run xampp-control-panel application as root. I get the following
error:
Traceb... |
Paste formatted Python code in command line
Question: I want to run Python code from an
[example](http://docs.scipy.org/doc/scipy/reference/generated/scipy.cluster.vq.kmeans.html#scipy.cluster.vq.kmeans)
in the [Anaconda](https://store.continuum.io/cshop/anaconda/) shell.
Unfortunately the statement I want to paste has... |
Automatically remove hot/dead pixels from an image in python
Question: I am using numpy and scipy to process a number of images taken with a CCD
camera. These images have a number of hot (and dead) pixels with very large
(or small) values. These interfere with other image processing, so they need
to be removed. Unfortu... |
how to fetch data from google plus using api key in python?
Question: ***** *When i send a request like --
f = urllib.urlopen(https://www.googleapis.com/plus/v1/people/103777531434977807649/activities/public?key=*************** )
json=f.read()
print json
it returns some thing like this not ... |
Making a layout with variable number of columns per row in kivy?
Question: In kivy, what is the preferred way to make a screen that has a variable number
of columns per row? Is there a way to accomplish this without explicitly
specifying the positions and sizes of the widgets in a layout (i.e. is there a
way to do this... |
how to pass char pointer as argument in ctypes python
Question: Please help me in converting below line of c++ code into ctypes python:
Ret = openFcn(&Handle, "C:\\Config.xml");
below are the declarations of each:
typedef uint16_t (* OpenDLLFcnP)(void **, const char *);
OpenDLLFc... |
Calculate entropy of a file
Question: I have tried to search this function for over two hours from google, forums,
wikipedia and many, many forums but I couldn't find it. How I can do this? I
tried the following but it didn't work.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
... |
Printing net-snmp getbulk results with newlines at each index
Question: I have the following Python code:
#!/usr/bin/python
import netsnmp
session = netsnmp.Session(DestHost='_destination address_', Version=2, Community='_string_')
vars = netsnmp.VarList(netsnmp.Varbind('ifInde... |
Plugins usually don't work, how do I debug?
Question: I am trying to write a plugin that will create a bitmap font. However, this is
very frustrating to learn... while I am not familiar with python, it is not
that hard to pick up and have not had problems with it outside of GIMP.
Copied some of the code from:
<https:/... |
How should data files be included to mrjob on EMR?
Question: I am trying to run a mrjob on Amazon's EMR. I've tested the job locally using
the inline runner, but it fails when running on Amazon. I've narrowed the
failure down to my dependence on an external data file `zip_codes.txt`. If I
run without that dependency us... |
Commands starting with "%" and "-" characters
Question: I've seen these in books and over the internet but never understood them.
Something like this
...modify changer.py without stopping Python...
% vi changer.py
and
python -mtimeit -s
What do they mean? And where are they... |
Python SHA512encryption with PHP
Question: This is the first time I am trying to deal with a python code. My client has
recently gave me a python code:
python -c 'import crypt; print crypt.crypt("Pa55w0rd!", "$6$x88yEvVg")'
Which is used to encrypt the password, in the above code.
The password is ... |
Python3: TkInter
Question: I've just coded this simple program but need help with Tkinter! I want to use
what the user types into the adult ticket box so i set it as global but
because the user hasn't clicked the button yet the input_adult.get() only
returns a blank string instead of the integer the user typed. Is ther... |
Python - How to run a specific function with variables
Question: I'm new to Python. This is the code I am trying to use, basically I am trying
to start by adding a hosted zone:
<http://ijabour.com/myfaceapp/build/boto/bin/route53>
The function for this is: **create**
If I want to add a hosted zone called "test.com",... |
Python module import error with command prompt of Windows 7
Question: I have a script in Python where i import several modules
from __future__ import division
import os
import glob
import sys
import tempfile
import shutil
import math
import datetime
import gdal
import ... |
Filtering data with pandas
Question: I'm a newbie to Pandas and I'm trying to apply it to a script that I have
already written. I have a csv file from which I extract the data, and use the
columns '_candidate_ ', '_final track_ ' and '_status_ ' for my data frame.
My problem is, I would like to filter the data, using ... |
Python - Uniquely determining which text file an element originated from
Question: I'm loading in three separate text files using numpy with the code:
str = 'data'
Di = np.loadtxt(str+'i.txt', dtype=np.float64)
Dj = np.loadtxt(str+'j.txt', dtype=np.float64)
Dk = np.loadtxt(str+'k.txt', dtype... |
How do you listen for Mediakey events under gnome 3 using python?
Question: I'm trying to listen for MediaKey events under Gnome 3 (Gnome Shell). All the
examples I find refer to using DBus to connect to
org.gnome.SettingsDaemon.MediaKeys. This service doesn't seem to exist on my
platform.
I'm trying to do this using ... |
Differences between Matlab and Numpy and Python's `round` function
Question: ## Simplified question
Can I make Numpy agree with Matlab and Python's `round`?
Matlab 2013a:
>> round(-0.5)
ans =
-1
Python (using a Numpy array, or just a scalar, same result):
>>> import num... |
Python. GUI(input and output matrices)?
Question: Python 3.3.2 Hello.My problem - need create GUI for input data(matrix or
table).And take from this form data. For example:
`A=[[1.02,-0.25,-0.30,0.515],[-0.41,1.13,-0.15,1.555],[-0.25,-0.14,1.21,2.780]]`
Perfect solution is restrictions to input form(only float).
Que... |
Can Python optimize this simple variable call?
Question: It seems like python (2.6) is not able to optimize this simple temp variable
'a' ?
I use to assign a local variable to some code in order to reduce the line
length.
To me this is a simple optimization any correct compiler can do automatically.
fr... |
Python Barcode Generation
Question: I'm using the elaphe package for python to generate ean-13 barcode images. The
package was installed from source using the tar file found at
<https://pypi.python.org/pypi/elaphe>.
When I run the code:
BARCODE_IMAGE_PATH = "/tmp/"
def create_barcode_image(prod... |
Cannot import FTP_TLS on EC2
Question: I'm writing an FTP script in python on EC2 where I need to be able to import
FTP_TLS for the connection.
`from ftplib import FTP_TLS`
Except, it gives me:
`ImportError: cannot import name FTP_TLS`
I can import FTP_TLS on my local python shell, but it fails on EC2.
What's goin... |
python threading Queue producer-consumer with thread-safe
Question: I am using threading and Queue to fetch url and store to database.
I just want one thread to do storing job.
so I write code as below:
import threading
import time
import Queue
site_count = 10
fetch_t... |
Storing a list, then reading it as integer
Question: I have a question. It may be an easy one, but anyway I could not find a good
idea. The question is that I have 2 python programs. First of them is giving 2
outputs, one of output is a huge list (like having thousands of another lists)
and the other one is a simple cs... |
opening a batch file but when it opens my python code is stopped because the batch file opens in the same window
Question: So I am basically trying to open and close a batch file (that runs a minecraft
server) at specific times. The thing that is bothering me though is that when
the file opens it does so in the same wi... |
'Drunk' input from readline, OK from other programs (reading smart meters P1 port)
Question: I'm new to Python and want to read my smart meters P1 port using a Raspberry
Pi and Python. Problem: the input looks like some component is drunk. I'm sure
it's pretty simple to fix, but after several hours of searching and try... |
Python time.clock() result not precise and way off
Question: I have the following script with which I measure real elapsed time forseveral
sleep functions. I use either time.sleep() to pause the program or
psychopy.core.wait() which is said to be more precise and use the high
resolution timer. I'm testing the latter ex... |
django "Exception Value: No module named urls" for admin site
Question: I am django newbie , trying to follow a tutorial. When I am trying to access
django administration site
http://127.0.0.1:8000/admin/
it giving the error "Exception Value: No module named urls" for the below code
... |
Pythonic way to correctly separate Model from application using SQLAlchemy
Question: I'm having a hard time to make my application run. Flask-SQLAlchemy extension
creates an empty database whenever I try to separate module in packages. To
better explain what I'm doing, let me show how my project is structured:
... |
Why do I not get a good binary image with a grey background using the mahotas python module?
Question: I got some problems with image with grey background with mahotas library:
Example:
This is the code:
import mahotas as mh
path ="./imagepath/a.jpg... |
how to use scipy.stats.kstest/basic questions about Kolmogorov–Smirnov test
Question: The help link is
<http://docs.scipy.org/doc/scipy-0.7.x/reference/generated/scipy.stats.kstest.html>
I can compute the ks-test value now,but I do not understand it. The code is as
below.
from scipy import stats
impo... |
Python3: ZipFile instance has no attribute 'extractall'
Question:
from zipfile import ZipFile
fzip=ZipFile("crackme.zip")
fzip.extractall(pwd=b"mysecretpassword")
the script works only on IDLE, but when i run it from the command line, it
displays:
> unzip.py
fzip.extractall(pwd=b"mysecret... |
How to install pyodbc to be used in ipython
Question: I'm confused. I have installed pyodbc on my computer and I was able to import
it using other IDE but i'm new to ipython.
I use Ananconda , and was able to install other library using something like
pip install BeautifulSoup
But when I do that w... |
Python multiprocessing: calling pool.map within a function
Question: I am trying to use the `mutltiprocessing` package to use multiple CPUs within
a function. When I run a toy example outside of a function it runs in a
quarter of a second with no problems (see below).
from multiprocessing import Pool
... |
Creating a maze in Python/Pygame but not sure how to make walls
Question:
import pygame, sys
from pygame.locals import *
pygame.init()
windowwidth = 600
windowheight = 800
WALLWIDTH = 30
WALLHEIGHT = 30
PLAYERWIDTH = 20
PLAYERHEIGHT = 20
BLACK = (0, 0, 0)
... |
Python 27 can't import shared object from guppy
Question: I installed guppy the memory profiler from its svn#95 via "sudo python
setup.py install".
It looks properly installed.
yey@yey:/usr/local/lib/python2.7/dist-packages/guppy/heapy$ ls *.so *.py
AbstractAlgebra.py ImpSet.py Path.py ... |
Discovering Poetic Form with NLTK and CMU Dict
Question: **Edit: This code has been worked on and released as a basic
module:<https://github.com/hyperreality/Poetry-Tools>**
I'm a linguist who has recently picked up python and I'm working on a project
which hopes to automatically analyze poems, including detecting the... |
Using with python selenium WebDriverWait in pysaunter for async pages?
Question: I'm trying to code nicely against a web site with AJAX like functionality, and
using pysaunter (<http://element34.ca/products/saunter/pysaunter>).
When I use the available synchronization method wait_for_available, perhaps
improperly, my ... |
Simple game in python
Question: I have looked at the other posts about this topic but still can not find what
I'm doing wrong at the beginning. Instead of rock, paper, and scissors, I am
using python, ruby, and java. It is not close to being done yet. I'm not into
the if loops yet for, but if the user inputs something ... |
Parsing object in python
Question:
{u'jobs': {u'_total': 301746, u'_count': 10, u'_start': 0, u'values': [{u'position': {u'title': u'Director of Sales, New York '}, u'id': 7489651}, {u'position': {u'title': u'Senior Software Development Engineer'}, u'id': 7489610}, {u'position': {u'title': u'Senior Analyst, ... |
ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there
Question: I have a situation very much like the one at [ImportError: DLL load failed: %1
is not a valid Win32
application](http://stackoverflow.com/questions/14629818/importerror-dll-load-
failed-1-is-not-a-valid-win32-applicatio... |
python sqlite3 code works in global space but thows error when I place it in a function
Question: I'm trying to run the follwoing 'sqlite3_custom_type.py' example from the book
"Python Standard Library by Example". The following code works 'straight out
of the box':
import os
import sqlite3
... |
python finding text and after that text multiple numbers
Question: I have big xml file and I want edit it with notepad++ (python script). I need
replace all numbers in text like this
(x text)="number1;number2;number3;number4;number5;number6"
to numbers divided on 2 (no float numbers).
... |
Solr indexing issue with solrpy
Question: Just started learning solr. I am trying to use solrpy as a client. My python
code is:
import solr
# create a connection to a solr server
s = solr.SolrConnection('http://localhost:8983/solr')
# add a document to the index
doc = dict(
... |
Ninja-IDE virtualenv not importing
Question: I started a new project in the Ninja-IDE and assigned it to a virtualenv
folder in the settings.
The virtualenv works fine in the terminal, but Ninja-IDE doesn't recognize the
packages in it and throws an import error.
How can I access the packages in the virtualenv in Nin... |
How to override a function call in Python?
Question: I've something like this:
import os
from node import Node
def make_sum(num,done):
for i in range(0,100):
num = num + 1
done(num)
def result(num):
print num
return num
node = Nod... |
Python - defining global name datetime
Question: I'm trying to create a function where I use various functions from the
datetime module, such as strftime, strptime and timedelta.
I feel like I've tried everything, but every time I am told this:
4 date = '2012.09.07'
5
----> 6 q = ne... |
A library like Python's collections.Counter library for C# -> Getting the difference of values between two dictionary objects in C#
Question: This is how I would create a Dictionary in C#.
Dictionary<string, int> d = new Dictionary<string, int>()
{
{"cheese", 2},
{"cake... |
python library and example for gmail smtp using oauth2
Question: The [python oauth2 library](https://github.com/simplegeo/python-oauth2) seems
to implement oauth 1.0 protocol. The `import oauth2 as oauth` is misleading,
most probably it is referred to the 2nd version of the python lib implementing
oauth 1.0.
Is there ... |
Installing pycuda-2013.1.1 on windows 7 64 bit
Question: FYI, I have 64 bit version of Python 2.7 and I followed [the pycuda
installation instruction](http://wiki.tiker.net/PyCuda/Installation/Windows)
to install pycuda.
And I don't have any problem running following script.
import pycuda.driver as cuda... |
elegant way of convert a numpy array containing datetime.timedelta into seconds in python 2.7
Question: I have a numpy array called `dt`. Each element is of type
`datetime.timedelta`. For example:
>>>dt[0]
datetime.timedelta(0, 1, 36000)
how can I convert `dt` into the array `dt_sec` which cont... |
Analog sampling on the Beaglebone Black only reads noise
Question: I want to write a script in python that will do data acquisition with the
beaglebone black. However, I'm only getting noise when I read in values.
I have a circuit set up to feed in a signal (I was running about a .1-10 Hz
12v square pulse), the voltag... |
Config file for Python with repeated sections/objects
Question: I would like to store this kind of configuration, with repetition of sections
and the keys within each:
[item]
name = 'name1'
url = 'address1'
whatever_var = 'foo1'
[item]
name = 'name2'
url = 'address2'
what... |
Beginning word counting program only produces output for the last line in python
Question: I am a beginner programmer attempting to build a simple program. It should
count every word in the file but as I wrote, it only counts the last line of
text.
tm = open('myfile.txt', 'r')
for line in tm:
... |
Python CSV Module Issue With JSON
Question: I am using the python `csv` module to create a csv where some of the values
are `json` strings. However the `csv` module's quoting is totally breaking the
json:
import csv
import json
writer = csv.writer(open('tmp', 'w'))
writer.writerow([json.dumps... |
execute a remote python script, locally with additional arguments
Question: I have a python script that resides on a remote server, under version control,
and I'd like to execute it from my local shell.
I know that `curl https://remote.path/script.py | python` will work ([as confirmed here)](http://stackoverflow.com/q... |
adding admin interface to existing pyramid app
Question: I'm trying to add a nice admin interface to an existing Pyramid project. I
created a test project using `pcreate -s alchemy -s pyramid_fa fa_test` and
then copied all the extra files created into my project and altered them to be
suitable.
Everything looks to be... |
Duplicated results when importing methods from a class of another py file
Question: I am quite new in python, so I hope you can help me with this silly problem as
I couldnt find any reason for this problem to happen. So, I have a file called
calcoo.py which has a class called Calculator that sums and subtracts, and
the... |
Python Count Certain Character
Question:
def file(char, filename):
for currentFile in filename:
print(currentFile.strip())
def string(char, str):
count = 0
if char in 'abcdefghijklmnopqrstuvwxyz':
count += 1
string(char,str)
else:
... |
Trying to combine (concatenate) elements from 3 lists into one, new list
Question: I have 3 lists that contain Town, Range and Section (These are also the names
of the lists) information. For example, List Town has 'N14'...'N20', List
Range has 'E4'...'E7' and List Section has '01'...'36'. I want to be able to
put all ... |
Python: calling function from imported file
Question: How do you call a function from an imported file? for example:
Test:
import test2
def aFunction():
print "hi there"
Test2:
import test
aFunction()
This give me a name error, saying my function isn't defined.... |
Python string/list with £ symbols failing writing to file?
Question: I am having issues writing data to a file due to `£` signs being in my
string/list.
For example in my code below, `x` is created by a series of appends from
various regex searchs, matches, subs and generic trims/splits.
# -*- coding: u... |
Stuck on learnpython.org exercise using JSON
Question: <http://www.learnpython.org/Serialization_using_JSON_and_pickle>
Here are the instructions:
The aim of this exercise is to print out the JSON string with key-value pair
"Me" : 800 added to it.
And below is the starting code, which we should modify.
... |
PyQt4: Which one of these would be better/more correct? (Notepad++ clone)
Question: I'm making a super simple Notepad++ clone in Python/PyQt4, and I'm wondering
which of these options of storing editor tab data:
OPTION 1: I have a class called QQCodeTab, which stores the current
Qsci.QsciScintilla instance for the cur... |
change CLIENT_FOUND_ROWS flag in django for mysql-python (MySQLdb)?
Question: I have a problem with MySQL 5.5 `INSERT ... ON DUPLICATE KEY UPDATE` rows
effected mismatch cursor.rowcount in a normal Django project
According to [doc](http://dev.mysql.com/doc/refman/5.5/en/information-
functions.html):
> For INSERT ... ... |
Tkinter Label, TypeError: cannot concatenate 'str' and 'instance' objects
Question: I am coding a dice simulator that will roll either a 6 sided dice or an 8
sided dice. I am using Python 2.7 and Tkinter. Here is my file with a
dictionary with the dice in:
DICE = dict(
sixsided={'name': 'Six Side... |
How to count the number of commas in a string using regular expression in python?
Question: I have a string in the following format:
str ="India,USA,Australia,Japan,Russia"
I want to extract the word present after third comma by counting the number of
commas using regular expression in python.
des... |
Error in Simple PyGame
Question: I was trying to make a game using Python, so this is the code:
# 1 - Import library
import pygame
from pygame.locals import *
# 2 - Initialize the game
pygame.init()
width, height = 640, 480
screen=pygame.display.set_mode((width, height))
... |
Python: How would you save a simple settings/config file?
Question: I don't care if it's JSON, pickle, YAML, or whatever.
All other implementations I have seen are not forwards compatible, so if I
have a config file, add a new key in the code, then load that config file,
it'll just crash.
Are there any simple way to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.