text stringlengths 226 34.5k |
|---|
png loading in pygame
Question: I am writing a simple game in python, and I need to load an image from a
bmp/png file and draw it to the screen. The important part of my code looks
like this:
temp = pygame.image.load("debris.bmp").convert()
temp.convert_alpha()
temp.blit(screen, (250,250))
py... |
dynamically update module using exec and compile in Python
Question: I would like to dynamically import and update modules. The more efficient way
would likely be to use `importlib` and `imp.reload` [as suggested by
abarnet](http://stackoverflow.com/questions/18500283/how-do-you-reload-a-
module-in-python-version-3-3-2... |
Django can't find any views but index
Question: I'm pretty new to Python and Django as well, but I'm going through the
tutorial as closely as I can and I must be missing something. I can get my
default index view to load, but I want to send an ajax call to a view called
'search' and I have another view called 'show' th... |
Using 'r+' mode to overwrite a line in a file with another line of the same length
Question: I have a file called `vegetables`:
> carrots
> apples_
> cucumbers
What I want to do is open the file in python, and modify it in-place, without
overwriting large portions of the file. Specifically, I want to overwrite
... |
paramiko SSHClient connect stuck
Question: i have 3 source code(main and imported from it).
## test.py - just import file
import test_child
## test_child.py - call function defined in imported file
import test_grandchild
test_grandchild.check_sshd()
## test_grandchild... |
Python3 urllib.request will not close connections immediately
Question: I've got the following code to run a continuous loop to fetch some content
from a website:
from http.cookiejar import CookieJar
from urllib import request
cj = CookieJar()
cp = request.HTTPCookieProcessor(cj)
hh ... |
Jinja2.5 Syntax error on import
Question: I am using Python 3.2.3. And I installed Jinja2.5 by downloading from this
page: `https://pypi.python.org/pypi/Jinja2/2.5.5`
Then I used the setup.py to install it. This seemed worked like a charm. When
I tested it by using this line:
from jinja2 import Template... |
Python Calculator Error output
Question: So I made a Calculator using python 2.7.8 and everything works like it should,
unless one thing. I want to receive the error message "ERROR: Minimum Input:
Number Operator Number!" when i for example try to calculate "2 +". But I
can't get it working. Would be amazing if someone... |
Parse error with same name nested tags using python xml to json
Question: I have a small set back I have a large xml file in the following format
<doc id="1">Some text</doc>
<doc id="2">more text</doc>
Im using the following python script to convert into a json format:
from sys i... |
I like Python; do I have to use Django/Flask/etc?
Question: I like Python a lot (check out my username!), and I'm building a web
application. I've used Django for a couple of projects. Most of my web dev
friends prefer Node, or Rails, though.
Python provides data analysis tools that are important to my application.
I... |
Python Need Access to variable created in a function from another function
Question: As i have set search term to global for the first function - shouldnt the
second function be able to access it - if not how would i get this to work?
import sys
import os.path
from tkinter import *
import mat... |
Apply reduce on generator output with multiprocessing
Question: I have a generator function (Python) that works like this
def Mygenerator(x, y, z, ...):
while True:
# code that makes two matrices based on sequences of input arrays
yield (matrix1, matrix2)
What I want... |
Combination list python
Question: I want to make a list of all posible combinations of a list
example:
list = [1, 2, 3, 4]
and the output should give me: [[1], [2], [3], [4], [1, 2] ... [1, 2, 3, 4]]
(I have to look for a combination which sum gives me the highest possible
value which is less than or equal to varia... |
Difference between php and python mongodb adapter
Question: I have code in php which reads example record from mongodb:
<?php
$client = new MongoClient("mongodb://localhost:27017");
$db = $client->foo;
$collection = $db->bar;
$item = $collection->findOne();
var_dump($item);
And ... |
Intersection of two list in N time
Question: I have two lists `(['a', 's', 'f', 'f', 's'], ['f', 'f', 'a', 's'])`. The
required output is `['a','s','f','f']`. The output should give the
intersection of two lists. The arrangement of characters in the output list is
according to the order of occurrence in the first list ... |
Praw AttributeError: 'NoneType' object has no attribute 'get_comments'
Question: I wrote a simple script for identifying users who contribute to certain
subreddits. As a disclaimer, if you plan on using this code you should be sure
to anonymize the data (as I will, by aggregating data and removing all
usernames). It wo... |
Cuda out of resources error when running python numbapro
Question: I am trying to run a cuda kernel in numbapro python, but I keep getting an out
of resources error. I then tried to execute the kernel into a loop and send
smaller arrays, but that still gave me the same error.
Here is my error message:
T... |
generating emails group by tuple values python
Question: I have a tuple in the format (Name, email, units sold). I would like to
generate an HTML table, grouped by Name and then embed that table into an
email through Outlook.
My Code:
from itertools import groupby
from operator import itemgetter
... |
Sending a URL in a GET request to a Python server on Google App Engine
Question: I have written a very simple server in Python on Google Apps engine. I want to
be able to send it a command via a GET request, such as
`"http://myserver.appspot.com/?do=http://webpage.com/?secondary=parameter"`
This does not work, as the ... |
Scrapy on Mac OS 10.10 tries to use Python 3.4
Question: I've had some trouble installing Scrapy on Yosemite. I've gotten all the
dependencies installed, but when I try to run scrapy I get this error.
$ scrapy crawl my_crawler
----------
File "/Library/Frameworks/Python.framework/Versions/3.4/bin... |
How can I optimize this double-loop over an array using numpy?
Question: This code is quite slow in Python. How can I optimize this using numpy. The
array m and z are already numpy arrays but I assume I need to vectorize this
somehow though I can't find an example where the vectorized function also has
access to the va... |
Calculate the frequency of words in python
Question: I have to calculate the frequency of each word which is there in text file if
it matches with the word which is there in an array but i am getting this
error **TypeError: unhashable type: 'list'**
import string
from collections import Counter
f... |
wget not working in python
Question: I am using the os module to issue a wget request through python. It looks
something like this:
os.system("wget 'http://superawesomeurl.com'")
If I issue the wget request straight from terminal, it works, but I have two
problems:
1. When I build this in sublim... |
keep only lowest value per row in a Python Pandas dataset
Question: In a Pandas dataset I only want to keep the lowest value per line. All other
values should be deleted. I need the original dataset intact. Just remove all
values (replace by NaN) which are not the minimum.
What is the best way to do this - speed/perfo... |
Python os.walk() loop directories for attribute
Question: I have a text file containing directory names on each line (1, 2, 3), how can
I iterate through the text file and have the result inserted into os.walk?
So far, I have
import os
from os import listdir
dir_file = open("list.txt", "r")... |
Access HTTP Header Details Through Python Instagram API
Question: I'm using the Instagram API to retrieve all photos from a list of hashtags.
Starting today, I've been hitting the API rate limits (429 error,
specifically). To debug this, I've been trying to see how to get the number of
calls I have left per hour and in... |
Ruby gem equivalent of "pip install -e"?
Question: In Python I can install a package from source in ["editable"
mode](https://pip.pypa.io/en/latest/reference/pip_install.html#editable-
installs) using `pip install -e`. Then I can carry on editing the code, and
any changes will be automatically picked by other Python sc... |
Connect Python to MS SQL Server using pyodbc
Question: I am having a problem connecting pyodbc to my SQL Server. When I run it, there
is no output at all and there is not error message or anything to tell me what
is wrong? Even after I hit enter a few times nothing?
import pyodbc
cnxn = pyodbc.conn... |
Python : redirected message order
Question: I can redirect Python script output simply with ">" character in command line.
However, if Python script has subprocess.call(), the order of output lines is
missed.
test.py
import subprocess
print("Message from Python... this should appear at 1st line... |
Get the length of each line in file with C and write in output file
Question: I am a biology student and I am trying to learn perl, python and C and also
use the scripts in my work. So, I have a file as follows:
>sequence1
ATCGATCGATCG
>sequence2
AAAATTTT
>sequence3
CCCCGGGG
T... |
How to override a function in a package?
Question: I am using a package from `biopython` called `SubsMat`, I want to override a
function that is located in SubsMats `__init__.py`.
I tried making a class that inherits `SubsMat` like this:
from Bio import SubsMat
class MyOwnSubsMat(SubsMat):
bu... |
Python - Metmatplotlib error
Question: I am using Windows 7. I have installed Python 3.4 and Metmatplotlib.
I have tried the below code
from pylab import *
plot([1,2,3])
show()
But i am getting the follwoign error
Traceback (most recent call last):
File "E:/Work/Python... |
Best way to handle multiple table query linked to "main" table
Question: I am tracking visitor sessions and have a "master" table that contains the
session start, end and some visitor info.
CREATE TABLE "sessions" (
session_id BIGSERIAL PRIMARY KEY,
session_start TIMESTAMP NOT NULL,
... |
Process hangs on urllib2 socket reset
Question: We have a server program which occasionally hangs in a `read` call on a
`urllib2` socket when getting a connection reset, like so:
Traceback (most recent call last):
File "run.py", line 112, in fetch_stuff
raw = response.read()
File "/us... |
Again urllib.error.HTTPError: HTTP Error 400: Bad Request
Question: Hy! I tried to open web-page, that is normally opening in browser, but python
just swears and does not want to work.
import urllib.request, urllib.error
f = urllib.request.urlopen('http://www.booking.com/reviewlist.html?cc1=tr;pagena... |
python return list from linux command output
Question: I am new to python and I'm learning rapidly, but this is beyond my current
level of understanding. I'm trying to to pull the output from the linux
command apcaccess into a list in python.
apcaccess is a linux command to get the status of an APC UPS. The output is
... |
Faster way to build a tree graph using Networkx Python?
Question: Is there any faster, nicer way of building a Networkx tree. Currently, my code
is
for numb in range(0,len(previous)):
nodos = list(chunks(current,3))
for i in range(0,3):
G.add_edge(previous[numb],nodos[... |
Pygame - How to stop an image from leaving the edge of the screen?
Question: A section of jetfighterx leaves the screen when the mouse hovers over the edge
of the window, this causes tarantula to explode from time to time as soon as
it respawns to the top of the window, how can I stop this from happening
(without the u... |
Multiprocessing Python with RPYC "ValueError: pickling is disabled"
Question: I am trying to use the multiprocessing package within an `rpyc` service, but
get `ValueError: pickling is disabled` when I try to call the exposed function
from the client. I understand that the `multiprocesing` package uses pickling
to pass ... |
python seaborn to reset back to the matplotlib
Question: I'm using seaborn version o.4 and matplotlib version 1.42 I have a chart
displays both line and marker through simple plot command eg.
plt.plot([1,5,3,8,4],'-bo');
Due to a potential bug (<https://github.com/mwaskom/seaborn/issues/344>),
afte... |
How to find perfect squares in a range efficiently when the inputs are large numbers in Python
Question: The question is how to find perfect squares in a given range efficiently when
the inputs are very large numbers. My solution is giving `Time Limit Exceeded`
error. I have already checked the following links, but the... |
logic for String replacement in python
Question: How to replace a string in python For example If the text is 'new words are
newest n ew' and i want to replace 'new' word with 'y' If I use string.replace
command The above text will change to 'y words are yest n ew' I don't want
this to happen Ideally it should be 'y wo... |
ipython notebook on linux VM running matplotlib interactive with nbagg
Question: I want buttons and other interactive matplotlib objects to appear from within
my ipython notebook. 
Here is what I've done:
1. Installed <http://datasciencetoolbox.org>, it is a vagrant ... |
Revit API : "PickObject" not displaying dialog window
Question: I just did what is written
[here](http://stackoverflow.com/questions/21296317/revit-python-pick-object-
select-object), but I got a problem with `__window__.Topmost = True`.
(So, I'm running directly from the Shell)
Here is my complete code :
... |
Optional dot in regex
Question: Say I want to replace all the matches of `Mr.` and `Mr` with `Mister`.
I am using the following regex: `\bMr(\.)?\b` to match either `Mr.` or just
`Mr`. Then, I use the [`re.sub()`
method](https://docs.python.org/2/library/re.html#re.sub) to do the
replacement.
What is puzzling me is t... |
Access/Edit pixel values of a jpeg image in python
Question: I'm involved in a image processing project and I use python. I'm new to
python, so please bear my lack of knowledge. I want to read a `jpeg` image,
split it into `r,g,b`. Then I have to change add a value to each pixel `r,g,b`
separately. Finally, I have to m... |
python decimal print all internal decimal places
Question: i am looking for a way to print all internal decimal places of a python
decimal. has anyone an idea how to achieve following. The example code is
written in Python.
from decimal import *
bits = 32
precision = Decimal(1) / Decimal(2**bits)... |
Read out RGB data from images with C on Raspberry PI
Question: After looking for a long time on the internet I could not find a real solution
for my "problem".
* * *
**What I want to do:**
Compare 2 images (created with the Raspberry Pi camera in a Python script) in
C. I have tried this in Python but it is too slow ... |
reverse geocoding with python geocoder
Question: I'm trying my hands on reverse geocoding with python and the module geocoder
I built this script
#!/Users/admin/anaconda/bin/python
import geocoder
import unicodecsv
import logging
with open('locs2.csv', 'rb') as f:
... |
Python tornado stop function
Question: I've got a tornado web server running on my Raspberry and a ultrasonic sensor
connected to it. I've got a html page with a start and stop button, when I
click start the script is sending a message "start" to the serwer and it runs
a function that prints the distance.
Now i'm tryi... |
How to change class object parameters from another module (python)
Question: So I've searched around and couldn't find an answer. I'm looking to change
parameters from an object created in my main file, in a module. For example,
I'm testing this with a simple piece of code here:
-this is my main file, from which i cre... |
Converting WxPython code to C++
Question: Let' say I have written a wxPython application
import wx
app = wx.PySimpleApp()
frame = wx.Frame(None, -1, "Just one child", size=(250,150))
button = wx.Button(frame, -1, "This is resized")
frame.Show()
app.MainLoop()
How can I reuse or ... |
Normalize Small Probabilities in Python
Question: I have a list of probabilities, which I need to normalize to equal 1.0.
e.g. `probs = [0.01,0.03,0.005]`
I realize that this is done by dividing each probability by the sum of
`probs`. However, if the probabilities become really small, Python will tell
me that `sum(p... |
How to Partition Pandas DataFrame using DateTime
Question: I am writing a Python script to import pictures from my digital cameras, and
I'm using Pandas to help with the bookkeeping of the incoming images. I am
using the EXIF data to tag individual images with information, such as the
Camera Model, image mode, image fo... |
Script incompatibility for Python 2.x and Python 3.x
Question: I cannot understand what happens with python3 that prevents this from working,
when I try with python3, it just hungs on line 11.
import io,re,unittest,os,json,sys
from subprocess import PIPE, STDOUT, Popen
sub = Popen(["/usr/bin/pyth... |
How can I join two tables in Django and use the result in my template?
Question: I am having a hard time utilizing a foreign key in Django 1.7. For reference:
**models.py** looks like this:
from django.db import models
class Transaction(models.Model):
transaction_num = models.IntegerFie... |
PyOpenGL on Ubuntu for Python 2.7
Question: I am trying to install PyOpenGL and so far have tried the following ways:
1. $ pip install PyOpenGL PyOpenGL_accelerate
2. $ sudo python2.7 -m pip install PyOpenGL PyOpenGL_accelerate
3. Some variations of the above...
4. Installation from source.
Unfortunately I s... |
export tkinter calendar to another tkinter
Question: I have a tkinter calendar file called `wckcalendar.py`.I wanted to import this
to another file,which is coded below.I wanted to display the calendar and my
button in the **same tkinter window** Please letme know the changes I need to
do,so that both will be displaed ... |
Python posting answer from function to entry box in GUI
Question: I am trying to return an answer from simple addition to an entry box in Python
3.4 but keep getting the following error. Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", lin... |
Searching basic comments in C++ by regex
Question: I'm writing a Python program for searching comments in c++ program using
regex. I wrote the following code:
import re
regex = re.compile(r'(\/\/(.*?))\n|(\/\*(.|\n)*\*\/)')
comments = []
text = ""
while True:
try:
x= r... |
Can't find getcwd() function definition in os.py file
Question: I thought that I should be able to see the source code of packages that I
import in Python from the Python Standard Library. When I opened the os.py
file, I didn't see any definition of getcwd(). Why is this so?
Answer: `os` imports system dependent func... |
How to use Tkinter's 'file' variable across different functions in Python?
Question: I'm using Python 2.7. I'm also using a library known as id3reader to get
metadata from mp3 files. If I use this code:
import tkFileDialog
import id3reader
file = tkFileDialog.askopenfile()
id3r = id3read... |
Regarding ICMP "Fragmentation needed, DF bit set" or ICMP packet too big message
Question: I'm injecting ICMP "Fragmentation needed, DF bit set" into the server and
ideally server should start sending packets with the size mentioned in the
field 'next-hop MTU' in ICMP. But this is not working.
Here is the server code:... |
Python read a file and make a nth list from the
Question: I have a file that each line has 2 element like below which have nth lines:
1 2
2 3
3 4
4 5
1 6
2 7
1 8
I need to make a list in python.
list[1]=[2,6,8]
list[2]=[3,7]
list[... |
Is there a more pythonic way to write
Question: Learning to be pythonic in 2.7. Is there a way to avoid the explicit loop?
answer = `[5, 4, 4, 3, 3, 2]`
import numpy as np
import scipy.special as spe
nmax = 5 # n = 0, 1 ...5
mmax = 7 # m = 1, 2 ...7
big = 15.
z = np.zeros... |
How to use the liblinearutil package to train and predict test file in python?
Question: Can anyone give any insight about the liblinearutil package in python? I want
to train and test files. I did read the documentation but don't quite
understand. I'm doing it this way:
from liblinearutil import *
d... |
categorizing string according to length in Python
Question: I have given n different strings. I have to form different lists of strings
according to the list. For example, given strings are
`this,that,is,am,are,i,j` then four lists should be generated like:
s[1] = [i,j]
s[2] = [is,am]
s[3] = [are... |
Python finite difference method for differential equations
Question: I must solve the Euler Bernoulli differential beam equation which is:
u’’’’(x) = f(x) ;
(x is the coordinate of the beam axis points)
and boundary conditions:
u(0)=0, u’(0)=0, u’’(1)=0, u’’’(1)=a
I... |
Selenium get http response headers or access the browsers's download history
Question: I use python 2.7 and the selenium driver as downloaded from
pip install selenium
How can I get the http headers from a web request.
In particular I click a button/link and the server replies with a response
cont... |
check date range with only month and year in Python
Question: I only have `month` and `year`, and I want to compare if that **period** (of
an entire month) is between two `datetime` objects. For example if I have
these two dates:
min_post_date = 2013-03-07 00:00:00
max_post_date = 2014-01-01 00:00:00... |
How to use a wrapper function that i generated using swig in python?
Question: Okay, I am new to swig. I have finally successfully wrapped the most expensive
part of my python program using swig and also numpy.i . The program is a
finite difference scheme for the 2D wave PDE . My question is how do I use it
now ? I can... |
Python 2.7.6 - Printing a string on a fixed position while creating a dynamic histogram
Question: I created a little script that check virtual memory and how much is being
used. According to the number that comes back it creates a histogram. The
original script creates the following output.
VIRT MEMORY U... |
Python: Find closest match of multiple words in text file
Question: I need to parse multiple financial statement .txt files similarly to this
[one](http://www.sec.gov/Archives/edgar/data/320193/000104746904035975/0001047469-04-035975.txt).
The .txt files do not have standardized format. However, they have similar
headi... |
Where does Whoosh (Python) physically store the indexed content?
Question: I am beginning to research on content indexing implementation, and was having
a look at Whoosh (<https://pypi.python.org/pypi/Whoosh/>).
I am curious to know where Whoosh stores its content physically - Is it using
files?
Answer: Whoosh uses ... |
how to implement the python `zip` function in golang?
Question: Sometimes, it's convenient to combine two lists into a tuple using `zip`
built-in function in Python. How to make this similarly in golang?
Answer: You could do something like [this](http://play.golang.org/p/CYtr4Z-UQ-), where
you give the tuple type a n... |
Installing Pygame on mac (OS X Yosemite)
Question: I have been trying to get pygame working on my mac for ages. I have been using
it on a windows laptop but it is far too slow. I tried taking all the files
from there and putting them into the correct location on my mac because
downloading the mac versions was not worki... |
How do I make Python 3.4 keep score of the amount of guesses made?
Question: I am making a Guess the Number game in Python, and I want to make Python keep
score of how many times it took you to guess the number before you got it
right. How would I go about doing this? If needed, I can post my code to view.
Thank you.
... |
Why does this class-scope variable not get updated in recursive function?
Question: I'm writing a small class for an LED controller, that runs as a process. The
idea is that some code runs constantly to blink LEDs over an i2c bus.
I'm new to OOP with Python, and I'm also new to Processes in python. I'm using
Multiproc... |
No way to convert this string to raw format for parsing
Question: I am writing a program to find the latency of the following IP:
'141.101.115.212' (A game server)
To find the latency I use the following commands:
x = subprocess.Popen(["ping.exe", "141.101.115.212"], stdout=subprocess.PIPE)
x = str(... |
Printing json results in python
Question: I'm using two files for this project. Snapchat.py and test.py
Snapchat.py contains the following (showing the important part):
def add_friend(self, username):
"""Add user as friend
Returns JSON response.
Expected messages:
Suc... |
Two Xbee in API mode - Python
Question: First, I tested the communication of 2 XBee (series 2) in AT mode and all
worked correctly.
Then I changed the Coordinator to API mode and ran the below script while the
router was in AT mode. I was successful and received the routers message.
However, I can't get the router to ... |
Qt Framework, PyQt5 and AttributeError: 'MyApp' object has no attribute 'myAttribute'
Question: Last week I started to learn Python and I developed some command line apps.
Now I would like to develop apps with GUI. I searched in internet and I found
a project that fits my needs: Qt Project (<http://qt-project.org>) and... |
How to use multiple templates that inherits from one base template? python, Flask
Question: I have my directory structure as such (from
<https://github.com/alvations/APE>):
APE
\app
\templates
base.html
index.html
instance.html
... |
datetime.strptime extracting from dataframe: error
Question: Strptime doesn't do what I (starting Python data-scientist) want it to do.
I've got a data file formatted as follows:
STN,YYYYMMDD,HH,RH
210,20121001,1,0
210,20121001,2,0
210,20121001,3,0
210,20121001,4,0
...
In the se... |
Error on ScrollView+StackLayout when binding minimum_height on Kivy
Question: I'm new to Kivy and I am trying to create a scroll view based the official
ScrollView [example](http://kivy.org/docs/api-kivy.uix.scrollview.html) on
Kivy docs.
I'm using the Kivy portable package for Windows with Python version 3.3.3.
When... |
Using "Open with" on a text file with a python application
Question: I've been looking for a way to open a text file with a text editor I made with
python, and assumed it had something to do with system arguments, so made a
simple application which would write the arguments sent by the system to a
text window, and used... |
Python statsmodels return values missing
Question: I am trying to use Robust Linear Models from statsmodels on a simple test set
of x-y data. However, as return values with model.params I only get one single
value. How can I get slope and intercept of the fit? Minimal example (in which
I'm trying to exclude the outlier... |
Python Matplotlib line plot aligned with contour/imshow
Question: How can I set the visual width of one subplot equal to the width of another
subplot using Python and Matplotlib? The first plot has a fixed aspect ratio
and square pixels from imshow. I'd then like to put a lineplot below that, but
am not able to do so a... |
Argparse - do not catch positional arguments with `nargs`.
Question: I am trying to write a function wo which you can parse a variable amount of
arguments via argparse - I know I can do this via `nargs="+"`. Sadly, the way
argparse help works (and the way people generally write arguments in the CLI)
puts the positional... |
Multiple updating plot with pyqtgraph in Python
Question: I have to plot 3 updating curves of data I read from a sensor. The updating
plot is very fast when I use just a curve but when I try to plot them all each
of them is drastically slower. The code I use is following:
#!/usr/bin/python
... |
Unspecified Python error
Question: Here is the pet class program. If I understand it correctly the class petinfo
program is supposed to be separate from the other code. Is that correct?
The display list function accepts a list containing pets as an argument and
displays the data stored in each object.
c... |
exceptions.AttributeError: class KeyAgent has no attribute 'delele_customer_node()'
Question: I've 2 files: customer.py & agent.py. It looks like this:
customer.py:
from agent import KeyAgent
class CustomerController(object):
def __init__(self, container): ... |
Python: NullPointerException for os.system() and os.popen()
Question: I am getting a `NullPointerException` for `os.system()` and `os.popen()` on
python 2.2.1. The weird thing is that i have two servers and this same code
works fine on one but not on the other. What could be missing in the second
server?
Below is the ... |
PyQt5 && QML exporting enum
Question: Is it possible to export `enum` from `Python` to `QML` instance?
class UpdateState():
Nothing = 0
CheckingUpdate = 1
NoGameFound = 2
Updating = 3
How I want to use it in `qml`:
import PythonController 1.0
... |
How to use python-twisted-web2 in Ubuntu 14.04?
Question: I am new to python twisted and I just start trying to use python twisted. My
purpose is to build a simple **reverse proxy** that supports **HTTP/1.1** ,
which requires module **web2**. But I find that `import twisted.web2` does not
work...
I tried `python -c "i... |
Multiple python installations - setting path variable
Question: I have several python installations on my system, in /usr/lib/ I have
python2.7, python 3, python3.2. I am trying to upgrade my version of scipy
from .9. When I do a
sudo pip install --upgrade scipy
It doesn't work saying that it's alr... |
python: gettng multiple results for getElementsByTagName
Question: I'm trying to get each instance of an XML tag but I can only seem to return
one or none.
#!/usr/software/bin/python
# import libraries
import urllib
from xml.dom.minidom import parseString
# variables
startda... |
python 3: Adding .csv column sums in to dictionaries with header keys
Question: I have a .csv file laid out like this:
name1 name2 name3
value1 value2 value3
value4 value5 value6
value7 value8 value9
I need to find a way in Python3 to create a dictionary where the keys are the
head names (name1, name2, name3) a... |
python module and command line program
Question: I have a code which I'd like people to be able to use as a stand alone python
program, or to import as a module for their own codes. Is there a way to
package a module which can also include a program that can be run from the
command line?
I.e. from the command-line:
... |
Python program not looping/restarting
Question: I have a school assessment which is to make a child's spelling game, it has to
loop/restart when the player clicks yes. So far when I test the game, the
option/the easygui.buttonbox that asks the player if they want to play again
and the yes/no options to play again or ex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.