text stringlengths 226 34.5k |
|---|
Python Reportlab - Unable to print special characters
Question: `Python Reportlab`:
I am facing problem while printing special characters in my `pdf` like `"&"`
# -*- coding: utf-8 -*-
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleS... |
Python Jenkins API does not allow to queue several jobs at once. Is there a way to work around the restriction?
Question: There is a parametrized job in my Jenkins server. I would like to initiate
several builds of the job with different parameters using Python Jenkins API.
This is completely legitimate in Jenkins. If ... |
Can't set up neo4jDjango graph database: object has no attribute 'db_type'
Question: I'm starting a project and I keep getting this error when executing the
manage.py sql *ApplicationName*
The trace back is as follows:
File "manage.py", line 10, in <module>
execute_from_com... |
Round timestamp to nearest day in Python
Question: In Python 2.7.2 I am getting the seconds since epoch using:
`sec_since_epoch = (date_obj - datetime(1970, 1, 1, 0, 0)).total_seconds()`
Now I want to round these seconds to the nearest day e.g. if:
`datetime.fromtimestamp(sec_since_epoch)`
corresponds to `datetime(... |
Python: Pixel values in image display?
Question: Using any of the numpy, scikit-image libraries, I can easily load and display
an image as an ndarray. However, I'd like some sort of display where I can
move the cursor around the image, and see the indices of the current pixel,
and its gray (or RGB) values, for example:... |
why telnetlib write function not working in my python code?
Question: I was learning python for a few weeks, I was trying to build a chat app, I
chose twisted and felt comfortable with it, but I run into a strange problem
in client tesing code.
Here is my server code:
from twisted.internet.protocol impo... |
Why am I getting repetitive output while trying to scrape data from Google Scholar?
Question: I am trying to scrape the PDF links from the search results from Google
Scholar. I have tried to set a page counter based on the change in URL, but
after the first eight output links, I am getting repetitive links as output.
... |
Segfault 11 with pandas with Python v2.7.6 RC1 on Mac OS X 10.9
Question:
In [1]: import json
In [2]: path = 'ch02/usagov_bitly_data2012-03-16-1331923249.txt'
In [3]: from pandas import DataFrame, Series;
In [4]: records = [json.loads(line) for line in open(path)]
In [5]: frame ... |
Nonblocking client-server in python
Question: I have been coding a blocking client-server in python. how can I change it to
nonblocking without thread?
Answer: Check out the [asyncore](http://docs.python.org/2/library/asyncore.html) and
[asynchat](http://docs.python.org/2/library/asynchat.html) Python modules.
Here's... |
Python: Get caret position
Question: I'm trying to get the caret position in Python. I tried using
`win32gui.GetCaretPos()` but it always returns 0,0.
Do you have any ideas how to make it work?
Thanks Chris
Answer: If the caret is in a window created by another thread, you need to call
[`AttachThreadInput`](http://... |
Python function always returns false when comparing to ints
Question:
from pip.backwardcompat import raw_input
from PFD import *
def getInput():
try:
n = raw_input("Please enter the file size: ")
int(n)
print(str(n))
order = raw_input("Pleas... |
How to Calculate Dry and Wet Spell in Python?
Question: I have a random time series data with four columns like: year, month, day,
precipitation. I want to calculate dry/wet spell for different spell-length. I
am looking for a more convenient way to do that while currently doing with
some ugly codes like below:
... |
How do I calculate how many hashes I need in order to find a collision?
Question: I'm working on a program that hashes image URLs to a 10 character string using
hexadecimal characters, e.g. 64fd54ad29.
It's written in Python, and the hash is calculated like this:
def hash_short(self, url):
retu... |
How to use iter function to loop through a list until a certain match is found
Question: I frankly don't understand how to use the
[`iter(o[,sentinel])`](http://docs.python.org/2/library/functions.html#iter)
function and I'm trying to loop through `lst` _(a list)_ and print all the
values until `'kdawg'`
Code:
... |
Google Map API Signature Generation in Python
Question: I'm basically doing the following:
<https://developers.google.com/maps/documentation/business/webservices/auth>
In Python 2.7.3 on my MacBook and on 2.7.5 on a Windows 64bit Server
environment I fail to reproduce the correct signature, while I follow the
original... |
Parsing Nested JSON using Python
Question: This JSON output is from a MongoDB aggregate query. I essentially need to
parse the nested data JSON down to the following to the total and _id values.
{
'ok': 1.0,
'result': [
{
'total': 142250.0,
... |
Bitmap fonts in SFML (OpenGL)
Question: I'm writting a simple bitmap font renderer in pySFML and wanted to ask is
there a better and faster way to approach this problem.
I'm using [VertexArray](http://www.python-sfml.org/api/graphics.html#id22) and
create a quad for each character in a string. Each quad has appropriat... |
How do I preserve symlinks when unzipping an archive using Python?
Question: Many zip archives (especially those include OS X applications) contain
symlinks. When using the `zipfile.extractall` method, symlinks are turned into
regular files. Anyone know how to preserve them as links?
Answer: There seems to be no way ... |
Cannot bring any url in browser from PyCharm/selenium: http proxy responds regardless of settings
Question: I have Python 2.7.4 and selenium bindings (installed via "pip install
selenium") on Ubuntu 13.04 with Firefox 25. I have PyCharm Community Edition
3.0.1 I'm behind a proxy. I have a very simple python test, test_... |
randint() error 'empty range for randrange' in the python random module
Question: when I use randint() sometimes this error will appear:
ValueError: empty range for randrange() (1,1, 0)
why is this/how do i stop it from happening?
im not doing anything wrong as far as i can tell, this error dosnt ... |
Python Selenium, scraping webpage javascript table
Question: I am going to scrap the javascript tables inside below link.
<http://data2.7m.cn/history_Matches_Data/2009-2010/92/en/index.shtml>
import codecs
import lxml.html as lh
from lxml import etree
import requests
from selenium import ... |
Multiplying Block Matrices in Numpy
Question: Hi Everyone I am python newbie I have to implement lasso L1 regression for a
class assignment. This involves solving a quadratic equation involving block
matrices.
minimize x^t * H * x + f^t * x
where x > 0
Where H is a 2 X 2 block matrix with eac... |
make a total list of a returned map (python)
Question: I have the lambda function f:
f = lambda x:["a"+x, x+"a"]
and I have the list lst:
lst = ["hello", "world", "!"]
So I did map on the function and the list to get a bigger list but it didn't
work as I thought:
... |
In Python edit Non Global Names
Question: In Python Version: 2.7.5, I have Zelle's Graphics installed and I have no idea
what to do because I am trying to edit a non global name in a function with a
different function. Here is an example of my code.
from graphics import *
import time
keyPad=Graph... |
Losing queued tasks in Python apply_async
Question: I am attempting to write a wrapper that iterates through running another
program with different input files. The program (over which I have no control,
but need to use) needs to be run out of the same directory as the input
file(s). So far my method is to use OS-modul... |
Python 2.7 & Regular Expressions: False if statement returns
Question: To practice regular expressions, I'm trying to create a very simple text based
game similar to Zork. However I can't seem to have the code work using regular
expressions.
**Movement.py**
import re
def userMove():
use... |
notify user from service with python
Question: In the following text the word "write" refers to the unix write command which
writes a message to another user's tty.
I have a service running (in inetd, but that shouldn't matter) which needs to
notify an arbitrary user. Until now I tried to call the write command with
s... |
Options for audio input into Kivy?
Question: I saw from [here](http://kivy.org/docs/api-kivy.core.audio.html) that
"Recording audio is not supported" in kivy. Some googling told me that [there
is some work being done on this](https://groups.google.com/forum/#!topic/kivy-
users/LsEuwhuKQek), but nothing looked conclusiv... |
Django Settings folder ImportError
Question: I am replacing the Django settings file for a folder of different settings.
The directory of the structure looks like this:
.
├── manage.py
├── media
├── quito_events
│ ├── __init__.py
│ ├── urls.py
│ └... |
file.readlines() leaving blank lines
Question: I have read the `file.readlines()` reads the whole file line by line and
stores it in a list. If I have a file like so -
Sentence 1
Sentence 2
Sentence 3
and I use `.readlines()` to print each sentence like so -
file = open("test... |
Python script sys.argv error
Question: This is my first python script:
#!/usr/bin/env python
# Years till 100
import sys
name = sys.argv[1]
age = int(sys.argv[2])
diff = 100 - age
print 'Hello', name + ', you will be 100 in', diff, 'years!'
When I run it, it gives ... |
Decrypt an AES encoded message (encrypted in Python) in Java
Question: I want to decrypt an AES encrypted message in Java. I’ve been trying various
Algorithm/Mode/Padding options from the [standard
library](http://docs.oracle.com/javase/7/docs/api/javax/crypto/Cipher.html)
and from [BouncyCastle](http://www.bouncycastl... |
Searching a file for a list of regexs, Python
Question: I'm having a bit of trouble searching a file using python regex.
I would like to input a list of regexs and return the lines of the file that
match one of them in a jagged list that is indexed in the same way was the
rexex list, i.e. if a line matches the 1st reg... |
Real time matplotlib plot is not working while still in a loop
Question: I want to create a real time graph plotting program which takes input from
serial port. Initially, I had tried a lot of code that posted on websites, but
none of them worked. So, I decided to write code on my own by integrating
pieces of code I've... |
How to organize database connections in larger Python/Flask applications?
Question: I am currently trying to write a little web-application using python, flask
and sqlite and I'm not sure about how to handle the database-connections.
Basically I've been following the "official" Tutorial (and
<http://flask.pocoo.org/do... |
Upload with wtforms - unexpected end of regular expression
Question: I am trying this code from here
[docs](http://wtforms.simplecodes.com/docs/0.6/fields.html#wtforms.fields.FileField)
class Form(Form):
image = FileField(u'Image File', validators=[Regexp(u'^[^/\\]\.jpg$')])
def vali... |
Need to modify files top to bottom using python's os walk. Generator object?
Question: I need to modify some files using a python script, and I figure OS walk is the
way to go about it. I need to modify everything under
/foo/bar
/foo/baz
/foo/bat
....for example
I've never used os.walk ... |
Searching strings with Python
Question: I have the following sentence:
Dave put the rubbish in the {{ if dave_good }}bin{{ else }}street{{ endif }}.
I'm currently replacing variables in text strings by capturing `[[ something
]]` and replacing the whole instance with a value _(not a problem)_. But
... |
Getting WindowsError when trying ot copy a file from one directory to another w/ paramiko
Question: Good afternoon,
I am getting the following error whenever I am trying to copy a test file from
one directory to another on a remote server:
**Traceback (most recent call last): File "", line 1, in File
"C:\Python27\lib... |
qwebview in pyside after packaged with pyinstaller goes wrong
Question: Here's my code
import sys
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import *
from encodings import *
from codecs import *
class BrowserWindow( QWidget ):
def... |
Why does php md5() always different from python's hash.md5() if using chinese character?
Question: here is my php code:
$str = '你好';
$input_encoding = mb_detect_encoding($str, array('ASCII','GB2312','GBK','UTF-8'), true);
echo sprintf('input encoding:%s', $input_encoding);
$str_gb = icon... |
How to use spectral python to handle multispectral raster files?
Question: I'm interested in using [Spectral
Python](http://spectralpython.sourceforge.net/) (SPy) to visualize and
classify multiband raster GeoTIFF (not hyperspectral data). Currently it
appaers that only `.lan`, `.gis` File Formats are readable.
I've t... |
Memoize a costly computation of a data frame
Question: I have a costly computation, running on pandas `DataFrames`. I'd like to
memoize it. I'm trying to figure out, what I can use for this.
In [16]: id(pd.DataFrame({1: [1,2,3]}))
Out[16]: 52015696
In [17]: id(pd.DataFrame({1: [1,2,3]}))
... |
How to close wx.DirDialog programatically?
Question: I have wxpython app that open wx.DirDialog on button click.
dlg = wx.DirDialog(self, "Choose a directory:", style=wx.DD_DEFAULT_STYLE)
if dlg.ShowModal() == wx.ID_OK:
# Do some stuff
Since my application is multithreaded and u... |
Python Global Variable with thread
Question: How do I share a global variable with thread?
My Python code example is:
from threading import Thread
import time
a = 0 #global variable
def thread1(threadname):
#read variable "a" modify by thread 2
def thread2(threadname):... |
Selenium configuration in Firefox using proxy
Question: I'm try to test a sample in Selenium using Python. I'm using a proxy server to
my connection to Internet with authentication. When I try to run the following
code :
from selenium import webdriver
if __name__ == '__main__':
p... |
Using the with statement in Python 2.5: SyntaxError?
Question: I have the following python code, its working fine with python 2.7, but I want
to run it on python 2.5.
I am new to Python, I tried to change the script multiple times, but i always
I got syntax error. The code below throws a `SyntaxError: Invalid syntax`:... |
Authentication failing for MongoEngineResource with ReferenceField
Question: The request to the embedded field of MongoEngineResource doesn't go through
Authentication process, if it contains reference field.
My case is the following:
* there is a document Section, which consist of FieldDefinitions
* FieldDefini... |
Crash on call from boost::python::exec( anything )
Question: I'm trying to implement some Python stuff into my program and I've decided to
use Boost::Python, so I compiled it according to the instructions, with bjam,
using mingw/gcc, getting dlls and .a files
I'm using Code::Blocks for this, so I've put the dlls in t... |
Sublime Text Plugin : Adding python libraries
Question: I'm trying to write a sublime text plugin which would make some windows api
calls. I did some research and found out that [this python
library](http://sourceforge.net/projects/pywin32/) provides the API's that I
need to use.
So, I'm trying to to use this library.... |
Python code to retrieve absolute path of tomcat service
Question: I am trying to write a python code that retrieves the absolute path of tomcat
service by searching through the services with the service name in linux. Is
there any module i can use, Code snipplets will be highly appreciated.
Thanks in advance.
Answer... |
Grail (web browser) installation on Scientific Linux
Question: I'm not sure if Grail browser is a good choice nowadays, however I want to try
it, because I have some problems about graphics running on Firefox-Fermi. The
next, is what I obtain after trying grail-0.6 (tgz)
# python grail.py
Traceback ... |
python setup.py to install multiple modules
Question: Below is my setup.py code :
from os import path
import sys
python_version = sys.version_info[:2]
if python_version < (2, 6):
raise Exception("This version of xlrd requires Python 2.6 or above. "
"For older ... |
Python itertools chain: possible to fill the shorter iterable with None
Question: When using the `itertools.chain` method to flatten a list like:
list(itertools.chain(*zip(itr1,itr2)))
Is it possible to fill the shorter iterable with None like in `itertools.imap`
for example? So I won't end up with... |
How to connect to and keep the session alive using python requests
Question: I am trying to login to a site, and then view user details.
The API documentation from the site is:
LogOn : All Calls with JSON and return JSON type
post - https://www.bit2c.co.il/Account/LogOn {UserName:'',Password:'... |
Python newbie, equal to a string?
Question: Trying to get my head arround why I cannot match the output of the IP against
a set IP and therefore render a outcome.
import urllib
import re
ip = '212.125.222.196'
url = "http://checkip.dyndns.org"
print url
request = u... |
Initialize a Python Constant Using a Function Declared After It
Question: I'm used to writing the following piece of code in Java or C# without errors.
It allows me to centralize the conversion of string to a floating point
representation. Unlike the simple implementation below, I have a lot more
going on in there to h... |
Create a dictionary from a csv file in python 3
Question: I am using Python 3.2 with a Mac OS Maverick and I am trying to get a .cvs
file with this format:
'Lisa plowed ', '1A', 'field', 'field', 'field', 'field', 'field'
'John greased ', '1A', 'axle', 'wheel', 'wheels', 'wheel', 'engine'
'Tracy ... |
python dictionary into sqlite
Question: I have built a sqlite db and table in Python 2.7 with 6 variables, based on
reading a URL file.
I used JSON and created a dictionary. The code reads everything well and loops
through the keys and values.
I need to insert this into my table. That is where I am a little lost. I w... |
After Anaconda installation, conda command fails with "ImportError: no module named conda.cli"
Question: I installed 64 bit Linux version of Anaconda recently (1.8.0-Linux-x86_64).
The installation seemed to work fine:
$ python
Python 2.7.5 |Continuum Analytics, Inc.| (default, Nov 4 2013, 15:30:26... |
Python - how to convert ctime to '%m/%d/%Y %H:%M:%S'
Question: Is there any direct way to convert ctime value to '%m/%d/%Y %H:%M:%S' format?
For example, convert "Wed Nov 6 15:43:54 2013" to "11/06/2013 15:43:54"
I tried the following but does not give me the format I want, which is
"11/06/2013 15:43:54":
... |
Python - PyQT4 how to detect the mouse click position anywhere in the window?
Question: I have 1024x768 resolution window, when there is a click or mouse over, i want
to find the x, y values. How can i do that?
import sys
from PyQt4 import QtGui, QtCore
class Example(QtGui.QWidget):
... |
python isinstance(n, int) and int(n) == n
Question: Two functions:
def check(n):
if int(n) != n:
print("int(n) != n")
else:
print("int(n) == n")
and
def check2(n):
if not isinstance(n, int):
print("n is not an int")
... |
How to read line by line a particular length of a file and write it to a list using python programme
Question: > This is my python programme
IPS=[] # creating a list of IP addresses
w=sum(1 for line in open('my_dict.json')) # w=total no. of lines in my_dict.json ... |
Python- Copy folders to another location without using disutils
Question: I'm iterating through a directory that contains lots of folders. I want to
copy each one of those folders from `src` to `dest`.
I have tried using `shutil's copytree`, but there is an issue involving
overriding existing folders. I see that the s... |
Sending binary/hex through socket (Python)
Question: I'm developing a secure file transfer system with Python and I'm dealing now
with the protocol. My idea is to have something like:
[Command:1byte][DataLength:2bytes][Data]
My problem is that I have no idea on how to deal with binary/hex in Python... |
PyQt: displaying Python interpreter output
Question: I've implemented [this answer](http://stackoverflow.com/a/8356465/889604) into
my code, which I was hoping would do what I want. However, I'm running a
method via a connection on a `QPushButton`, and I want to pipe what happens in
this method to the GUI.
The first t... |
Python regex, pulling patterns out of a match and using them as input back into the match
Question: I have searched for an answer. I am sure they are out there, but there are way
too many false hits.
This is my script (my attempt fails):
#!/bin/env python
import re
usage="""
My... |
Stop python from going to the very last statement
Question: I am currently writing a program that will solve the pythagorean theorem.
However, I have a bug in the program. Whenever I put in a negative number for
length a or b, it prints out "A cannot be less than zero" but goes ahead and
solves for C anyway and prints ... |
Matplotlib funcanimation blit slow
Question: I'm having issues with a slow animation in Matplotlib. I'm animating results
from a simulation, which is easiest visualized with an array of rectangles
that change color with time.
Following recommendations
[here](http://stackoverflow.com/questions/8955869/why-is-plotting-w... |
What factors cause data not to go through in sockets in python (or python/node.js)?
Question: (Suggestions for rephrasing questions?)
I'm sending data over a socket with client/server pattern. When I run python
(in pycharms) the output on the receiving end doesn't get data. However, when
I use the re-rerun icon (in py... |
Get elements out of list in python
Question: Hi i just started with python and have a pretty nooby question.
I have a list which looks like this:
[(1.0, 'Test1'), (1,3 'Test2'), (1.4 'Test3')]
How can i get only "Test1 Test2 Test3" as a return?
best regards
Answer:
>>> L = [(1.0, 'Test1'),... |
Distribute a simple python script
Question: I have a simple python script which reads a text file and do some processing
on it. I need to distribute this code. So any one with Ubuntu operating system
could run it. I import some modules as follows.
import pandas
import httpbl
from prettytable impo... |
How does `findAll` work in BeautifulSoup?
Question: Can someone please explain how `findAll` works in BeautifulSoup?
My doubt is this row: `A = soup.findAll('strong',{'class':'name fn'})`. it
looks like find some characters matching certain criteria.
but the original codes of the webpage is like ......`<STRONG class=... |
Python exercise with url and string counting
Question: i'm having a little problem with an exercise i have to do : Basically the
assignment is to open an url, convert it into a given format, and count the
number of occurrences of given strings in the text.
import urllib2 as ul
def word_counting... |
sending mail from gmail account - Python
Question: could someone kindly tell me, what's wrong with the code below? TIA :)))
import smtplib
if raw_input("if you want to send a message from a gmail account, type yes: ") == 'yes':
try:
sender = raw_input("from:\n")
... |
NZEC Runtime Error in Python 2.7 in SPOJ
Question: I think my algo is right(may be done very badly) But I get the desired outputs
in ideone.com. But in SPOJ it keeps on saying "Runtime Error NZEC". Please
suggest a few changes to get this right.
Here is the link to the Question :
<http://www.spoj.com/problems/RAFANOL... |
Rendering Persian (Farsi) words in PIL for Python
Question: I am trying to make images based on Persian (Farsi) text. I am using PIL for
Python3. Here is my code:
from PIL import Image, ImageFont, ImageDraw
text = "خطاب"
image = Image.new("RGBA", (100,100), (255,255,255))
font = ImageFont.tru... |
python pandas beginner: multi-dimensional data-analysis workflow (groupby+agg+plot)
Question: I'm new into pandas and try to learn how to process my multi-dimensional data.
## My data
Let's assume, my data is a big CSV of the columns ['A', 'B', 'C', 'D', 'E',
'F', 'G']. This data describes some simulation results, wh... |
ValueError: Invalid \escape while running query
Question: I am trying to query DBpedia using SPARQLWrapper in Python (v3.3). This is my
query:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?slot WHERE {
<http://dbpedia.org/resource/Week> <http://www.w3.org/2002/07/owl#sameAs> ?slo... |
Where is font 'nametofont' in python33?
Question: This code generates an error:
import tkinter
from tkinter.font import Font, nametofont
default_font = Font.nametofont("TkDefaultFont")
The error is:
Traceback (most recent call last):
File "C:\__P\nametofont.pyw", l... |
"Cannot import name __version__" when installing pip package in Python 3
Question: I've created a fresh venv running Python 3.3.2. While trying to install
Campaign Monitor's createsend package via pip, it yields:
Running setup.py egg_info for package createsend
Traceback (most recent call last)... |
Insert a file to google drive using google app engine. python client api used
Question: Using Google App Engine, I am trying to insert a file "a.txt" into my google
drive. The error that i get when i view page source of InsertDrive page is
HttpError 401 "Login Required" **_bound method InsertDrive.error of
main.Insert... |
Installing Mapnik 2.2.0 in windows 7 with Python 2.7
Question: I've been trying to install mapnik on my computer for hours but what i always
get when I import mapnik is `ImportError: DLL load failed: The specified
procedure could not be found`.
I'm using Windows 7. The currently installed software is Geoserver from
Op... |
rearrange the array elements using numpy in python
Question: How to get new array (NEW) from old array (OLD)?
import numpy as np
OLD=np.array([1,4,7,2,5,8,3,6,9])
NEW = [[1,2,3],[4,5,6],[7,8,9]]
NEW = OLD.reshape (???
Answer: Do you mean like this?
>>> import n... |
How to give multiple values to a single key using a dictionary?
Question: I have a html form which has `Firstname`, `LastName`, `Age` and `Gender` and a
`ADD` button. I enter the data into the form and that gets into the Berkeelys
db. What my code does is it prints only the last values. I want that it should
show all t... |
Python Script invalid syntax answer
Question: This is a python script i am working on, i am new to pyhton scripting, this is
what we are learning in school, i need some help with it. this is the error i
keep getting, i dont understand what the invalid syntax is. thank you for any
help. The "import maya.cmds as cmds", t... |
Efficient way to shift 2D-matrixes in python in both directions
Question: Given a two dimensional matrix, e.g.
l = [[1,1,1],
[2,5,2],
[3,3,3]])
what is the most efficient way of implementing a shift operation on columns
and rows?
E.g.
shift('up', l)
[[2, ... |
Interactive input/output using python
Question: I have a program that interacts with the user (acts like a shell), and I want
to run it using python subprocess module interactively. That means, I want the
possibility to write to stdin and immediately get the output from stdout. I
tried many solutions offered here, but ... |
Restart gobject.timeout_add_seconds counter after a socket.error
Question: I decided to make some modifications to the weather tray applet **[found
here](http://heap.zloduch.cz/software/scripts/weatherboy)**.
After many tests, I found that **update_tray()** stops updating after my
computer spends some time on hibernat... |
Python timer clocking
Question: I am thinking to implement a function like below:
timeout = 60 second
timer = 0
while (timer not reach timeout):
do somthing
if another thing happened:
reset timer to 0
My question is how to implement the timer stuff? Multiple thr... |
Creating buttons dependent on input, getting user data
Question: Relative noob to Python, still learning all the ins and outs, but I'm
learning. I'm diving into GUI for the first time for a personal project I'm
working on. (I'm a linguistics grad student and this will greatly improve my
ability to research.) I know abo... |
Python: `from x import *` not importing everything
Question: I know that `import *` is bad, but I sometimes use it for quick prototyping
when I feel too lazy to type or remember the imports
I am trying the following code:
from OpenGL.GL import *
shaders.doSomething()
It results in an erro... |
PyZMQ Gevent Websocket Connection Error
Question: I am trying pub/sub pattern using python zmq. I am facing a strange problem on
the client side. On the client side I am using pyzmq, gevent-websocket and
bottle as wsgi server. Though it works perfectly for one client, the other
clients are waiting for the first client ... |
How to pass dictionary from Jinja2 (using Python) to Javascript?
Question: How to pass dictionary from Jinja2 (using Python) to Javascript ? I have
dictionary in Python and when I render template I need to use that dictionary
with Javascript, I passed from Python
template = JINJA_ENVIRONMENT.get_template... |
Replacing XML tags in Python
Question: I have an XML document with an `<en-media>` tag:
<en-media type="image/png" hash="06c5ec15535babbcd3eef471f51af870"/>
I am trying to change that tag to a HTML `<img>` so it would look like the
following:
<img src="06c5ec15535babbcd3eef471f51af87... |
python - error in tkinter.py line 1470; lambda takes exactly 1; 0 given. when trying to load window
Question: I get this error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1470, in __call__
return self.func(*args)
T... |
how to shuffle a list correctly in python
Question: I have this code that shuffles a list. I first split it into two lists because
I have a interleave function that interleaves 2 lists:
def shuffle(xs, n=1):
il=list()
if len(xs)%2==0:
stop=int(len(xs)//2)
a=xs[:sto... |
Parsing xml in python - don't understand the DOM
Question: I've been reading up on parsing xml with python all day, but looking at the
site i need to extract data on, i'm not sure if i'm barking up the wrong tree.
Basically i want to get the 13-digit barcodes from a supermarket website
(found in the name of the images)... |
Can't get python to write to next line repeatedly. Tried \r initially
Question: I cannot get this program to work.
'''
Tasks are as follows:
1. The code to clean up the raw data and to use this information in the graphics package (R Project)
2. A graph of the month of birth and the number of ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.