text stringlengths 226 34.5k |
|---|
How to build PyQt5 on Ubuntu
Question: I'm trying to move my work from `PySide` to `PyQt5`.
My project works with `Python3.4.1` yet Ubuntu's default python3 is
`Python3.4.0`, So I have to compile `PyQt5` by myself.
`Python3.4.1`'s path is `/opt/python3.4.1/bin/python3.4` and it works well
my system is ubuntu14.04
*... |
Python: Simple TypeError
Question: This is a module containing two class:
import datetime
# Store the next available id for all new notes
last_id = 0
class Note:
'''Represent a note in the notebook. Match against a string
in searches and store tags for each note... |
Multi-threaded Z3?
Question: I'm working on a Python project, where I'm currently trying to speed things up
in some horrible ways: I set up my Z3 solvers, then I fork the process, and
have Z3 perform the solve in the child process and pass a pickle-able
representation of the model back to the parent.
This works great,... |
Passing arguments in class in Python
Question: In the given code, lists x and y are randomly assigned numbers between 0-N
with some probability 0.5. I am randomly choosing an agent and removing it
using func1. I am adding one agent using func2. Now I have defined two class
objects x1 and x2. The input argument 'state1'... |
Regridding regular netcdf data
Question: I have a netcdf file containing global sea-surface temperatures. Using
matplotlib and Basemap, I've managed to make a map of this data, with the
following code:
from netCDF4 import Dataset
import numpy as np
import matplotlib.pyplot as plt
from mpl_too... |
How does local rebinding of global names in Python make code faster/optimized?
Question: I was reading about [**Default Parameter Values in
Python**](http://effbot.org/zone/default-values.htm) on Effbot.
There is a section later in the article where the author talks about [**Valid
uses for mutable defaults**](http://e... |
Biopython parsing a GBK file without genome sequence
Question: I wrote a script that uses a GenBank file and Biopython to fetch the sequences
of given genes from the sequence part of the GBK file, which my colleagues use
for their work.
We had some problems now with a new data set, and it turned out that the GBK
file ... |
Tweepy Update with media error
Question: I want to post an Image to twitter every hour out of an folder.
import os, tweepy, time, sys,
path="C:\Users\Kenny\Desktop\dunny"
files=os.listdir(path)
CONSUMER_KEY = 'hide'
CONSUMER_SECRET = 'hide'
ACCESS_KEY = 'hide'
ACCESS_SECRET =... |
Showing element in html with flask and BeautifulSoup 3 and Python 2.7.8
Question: The question is: I have my @app.route and the relative def() which shows a
list of urls taken from "<http://annotaria.web.cs.unibo.it/documents/>". How
can i show this urls in a html format? When i click
`http://localhost:5000/articoli` i... |
ImportError: No shared library could be loaded, make sure that librtmp is installed
Question: I am using Windows 8, and trying to work with python-librtmp. I have followed
the steps to install librtmp from here: `http://pythonhosted.org/python-
librtmp/`. For me, the two pip install lines worked successfully when run i... |
Can't work out why I'm getting NameError: name 'thread' is not defined
Question: I've downloaded this .py file and I'm trying to get it to run. However,
everytime I do I get the following callback error and I'm at a loss to work
out what is causing it. I'm running Python 3.4.1 if that's any help, but as
far as I can se... |
How to Crawl Multiple Websites to find common Words (BeautifulSoup,Requests,Python3)
Question: I'm wondering how to crawl multiple different websites using beautiful
soup/requests without having to repeat my code over and over.
Here is my code right now:
import requests
from bs4 import BeautifulSoup... |
Uploading file with AngularJS fails
Question: Below are the snippets of my code regarding file upload.
Here is my HTML code where I will choose and upload the file:
<form ng-click="addImportFile()" enctype="multipart/form-data">
<label for="importfile">Import Time Events File:</label><br><br>
... |
Nested Dictionary Python with fantasy football data
Question: I'm trying to run my own statistics model to try and get an edge in my fantasy
football league, and I'm having troubles creating my data structure of
dictionaries. My data looks like this.
Player Team G Att Yard TD Target Rec Yard ... |
UnicodeDecodeError with word stemming in Python
Question: I'm so stumped.
I have a list of a couple of thousand words
x = ['company', 'arriving', 'wednesday', 'and', 'then', 'beach', 'how', 'are', 'you', 'any', 'warmer', 'there', 'enjoy', 'your', 'day', 'follow', 'back', 'please', 'everyone', 'go', 'wat... |
Passing a polymorphic object from C++ to a python function
Question: I have a C++ library with 2 classes defined in it: **t_foo_base** and
**t_foo**. t_foo is derived from t_foo_base. Both of them implement a virtual
function **text**. This function returns a string with the name of the current
class. I use boost.pytho... |
Python groupby behaves strangely
Question:
from itertools import groupby
source = [ [1,2], [1,3], [2, 1] ]
gby = groupby(source, lambda x: x[0])
print 'as list'
for key, vals in list(gby):
print 'key {}'.format(key)
for val in vals:
print ' val {}'.format(val)... |
error creating virtualenv in existing folder
Question:
$ virtualenv virtenv
Overwriting virtenv/lib/python2.7/site.py with new content
New python executable in virtenv/bin/python
Overwriting virtenv/lib/python2.7/distutils/__init__.py with new content
Installing setuptools, pip...
Complete ou... |
What's the best way to have QTableView and Database in sync after inserting the record?
Question: Let's suppose I have a QTableView with QSqlTableModel/Database. I don't want
to let user edit the cells in QTableView. There are CRUD buttons that open new
dialog forms and the user is supposed to enter data. After the use... |
external functions in Python 3.4
Question: I have been working on an elements dictionary and I have encountered a problem
with running external functions through inputs. I need to take an input and
use it to call a function with several variables. here is my code:
import atoms
import time
print("... |
the purpose of interpreter interactive mode keep file opening
Question: If the code is run as script:
$ cat open_sleep.py
import time
open("/tmp/test")
time.sleep(1000)
$ python open_sleep.py
OR I do this without interactive mode:
$ python -c 'import time;open(... |
Python: Setting tuples from csv file
Question: So essentially what I have is a csv file which is loaded in via some function,
lets call it
get_csv
So when I have this data, I want to create a new function to format the data
sent from the server into tuples. Which I will call
csv_form... |
When/how to change python sys.prefix from /usr when site-packages is in /usr/local?
Question: If I'm following <https://docs.python.org/2/library/site.html> correctly, I
need to either move the site-packages directory to /usr/lib/python2.7 or
change sys.prefix to /usr/local.
The former seems wrong. For the latter the ... |
Why am I getting these errors and how to fix them?
Question: When I run this script I get a ton of errors. import urllib, urllib2
proxy = urllib2.ProxyHandler({
'http': '127.0.0.1',
'https': '127.0.0.1'
})
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)
... |
Unable to repeat code according to user input in python
Question: I started programming a week ago and I decided I should write a program that
randomly assigns the numbers for the european lottery. I have a working script
that gives the 5 numbers and 2 stars that make a bet. However, I would like
the program to print a... |
How to get log likelihood for exponential and gamma distributions
Question: I have some data and I can fit a gamma distribution using for example this
code taken from [Fitting a gamma distribution with (python)
Scipy](http://stackoverflow.com/questions/2896179/fitting-a-gamma-
distribution-with-python-scipy) .
... |
Extend the functionality of the print statement/function
Question: I want to print things to a certain specification, such as printing containers
(`[]`, `{}`, `()`) using their `str()` method instead of `repr()`. It's
trivial to write a function that will do that
def str_print_list(alist):
print ... |
Weka python wrapper Loader
Question: I've installed weka python wrapper on Mc Os X 10.9.4. And I tried running the
sample code:
import weka.core.jvm as jvm
jvm.start()
from weka.core.converters import Loader
l = Loader("weka.core.converters.ArffLoader")
d = l.load_file("X.arff")
... |
python managing redundant data by incrementing no. in a text file
Question: I am new to python.I have a text file, i need to avoid the redundancy not by
deleting ,but by incrementing the number in a text file if the lines are found
to be same.
Please help!Answers will be appreciated! eg of a random text file:
... |
www-data user unable to import installed python modules
Question: I am trying create a web-server which ultimately calls a python script
("MyScript.py") from PHP code with the following command
echo exec("MyScript.py ....some arguments")
MyScript.py actually contains a code which uses RDkit and oth... |
bge python if statements getLinearVelocity
Question: Im new to scripting and programming in general, but I have a decent handle on
the concepts, however, I need a little help and I am not sure I'm even
searching and googling the right terms for what I want to do. I need help with
what I would imagine is a simple if sta... |
Raspberry Pi Camera auto capture python script
Question: I have been trying to set up my raspberry pi to auto take pictures every 5
seconds and save the file as image1,image2 etc. This is the Python code I have
been trying:
import time
import picamera
counter = 0
with picamera.PiCamera() as c... |
TypeError: unsupported operand type(s) for -: 'str' and 'datetime.datetime'
Question: I am working on my python script to get the list of date format from the
sqlite database.
I'm creating the variable `startDelta` to get the list of rows from the
variable called `program_startDate`.
When I use this statement to exec... |
ipython notebook doesn't work on ipython 2.2.0
Question: I tried to run IPython notebook. I entered following in the commandline:
ipython notebook
I get the that error (stack trace)
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 11, in <module>
sys.exit(start_ipython())
... |
Sorting a Dictionary by Value then Alphabetically by Key Python3
Question: Let's say I have a dictionary like:
h=[('a',5), ('f', 3), ('b',3), ('c',3), ('d',1), ('e',4) ]
I want it sorted like:
[('a',5), ('e',4), ('b',3), ('c',3), ('f',3), ('d',1)]
I can solve this with Python 2... |
Using Python to read newline characters correctly in Linux
Question: In Windows, if I'm using Python's "for line in file" syntax to read the
contents of a normal text file, the final line will not end with a newline
character, but all the lines before it will. In Linux, this behavior seems to
be different -- when I rea... |
Can't get json through ajax and flask
Question: I am trying to make a simple web application for logs show. On the web side:
python 3.4 and flask and on the client side it's simple web form with ajax.
Flask:
import json
from flask import Flask, jsonify, render_template, request
app = Flask(... |
Passing directory to python script as command line argument
Question: I am trying to pass a particular directory to a python script and later use
that directory in the script . the Directory can be located anywhere. for
example, the script should run on the command line as
script.py directory_name
... |
(unicode error) 'unicodeescape' codec can't decode bytes in position 16-17: truncated \uXXXX escape
Question: I want to import one module of pyusb library that is in the
**d:\pyusb-1.0.0a2\usb**. So first of all I must add its path to `sys.path`.
But I receive the below error.
Note : I successfully can import `d:\pyus... |
Syntax error installing gunicorn
Question: I am following this Heroku tutorial:
<https://devcenter.heroku.com/articles/getting-started-with-python-o> and when
I am trying to install gunicorn in a virtualenv I am getting this error:
(venv)jabuntu14@ubuntu:~/Desktop/helloflask$ pip install gunicorn
Dow... |
Differences between BaseHttpServer and wsgiref.simple_server
Question: I'm looking for a module that provides me a basic http server capabilities for
local access. It seems like Python has two methods to implement simple http
servers in the standard library:
[wsgiref.simple_server](https://docs.python.org/2/library/wsg... |
How to check if a file exists and if so rename it in python
Question: I am looking for a more pythonic way to do what my code does currently. I'm
sure there is a better way to do this. I would like to search up until
filename-10, and if that exists create a file called filename-11.
If you can help that would be great.... |
Can someone explain this Python code for me?
Question: This code create pty (pseudo-terminals) in Python. I have commented the parts
that I do not understand
import os,select
pid, master_fd =os.forkpty() #I guess this function return the next available pid and fd
args=['/bin/bash']
if pid ==... |
Changed proxy setting not visile on GUI
Question:
import _winreg as registry
key=registry.OpenKey(registry.HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Internet Settings",0,registry.KEY_ALL_ACCESS)
registry.SetValue(key, 'MigrateProxy', registry.REG_SZ, 'dword:00000001')
print registry.... |
Comparision of numpy module array with list
Question: I am trying to compare numpy array with list.... Because i am new to python, i
don't know about numpy array I want to know the application of numpy array
Please help out in understanding numpy array.
>>> from numpy import *
>>> res1 = []
>>> r... |
Why is there too much on my sys.path?
Question: I am trying to uninstall some package I'm developing (residing in ...plugin-
iqf\test\performance\src), but from within Python shell, I'm still able to
import it.
My `PYTHONPATH` is empty, yet ...
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 3... |
Installing matplotlib via pip on Ubuntu 12.04
Question: I'm trying to use matplotlib on Ubuntu 12.04. So I built a wheel with pip:
**python .local/bin/pip wheel --wheel-dir=wheel/ --build=build/ matplotlib**
Then successfully installed it:
**python .local/bin/pip install --user --no-index --find-links=wheel/
--build... |
the code says it is a error type but
Question: I've got this code.
#!/usr/bin/python
from optparse import OptionParser #import the OptionParser object from this module
parser = OptionParser()
parser.add_option("-f", "--first", dest="meal", help="prix repas", type="float")
... |
Using an arbitrary maximum in range()
Question: Is there a way in Python to iterate over every integer until something
happens? Right now I tend to do one of the following:
for i in range(999999999):
...
if something:
break
or
i = 0
status = True
whil... |
Using MPI4PY in FedoraScientific
Question: Recently, I downloaded and installed Fedora Scientific 20 as I was impressed
with the list of included software. My interest in the software is due to the
inclusion of the MPI framework. I was able to compile and execute a simple C
program using mpicc and mpiexec. However, I n... |
How to use Python Unittest TearDownClass with TestResult.wasSuccessful()
Question: I wanted to call `setUpClass` and `tearDownClass` so that `setup` and
`teardown` would be performed only once for each test. However, it keeps
failing for me when I call `tearDownClass`. I only want to record 1 test
result, either PASS i... |
Calling a thread within a module in python
Question: I have a log in screen which calls a module from a file which is
'HomescreenscrollCopy31' . This works perfectly fine.
The only issue is that there is a thread within the module which does not seem
to operate.
Here is the code in the login screen:
de... |
tkinter variable for drop down selection empty
Question: I tried to program an app in tkinter that would load random lines from a file
you select from a pull down menu and display the selected line in a text
window.
It seems like the variable "var" in `insert_text` does not return the selected
"option" but rather an "... |
Select specific columns in a text file by their column names and extract their contents
Question: I am a beginner in Python and I am finding it very difficult to come up with
the correct solution for this problem. I glanced through all the similar posts
in stackoverflow and couldn't find the solution.
I have a ".ext"... |
Pull large amounts of data from a remote server, into a DataFrame
Question: To give as much context as I can / is needed, I'm trying to pull some data
stored on a remote postgres server (heroku) into a pandas DataFrame, using
psycopg2 to connect.
I'm interested in two specific tables, _users_ and _events_ , and the
co... |
How to call a python script with ajax in cherrypy app
Question: I am trying to get the output from a python script and put it into a table in
the html of my cherrypy app.
Example app:
import string, os
import cherrypy
file_path = os.getcwd()
html = """<head>
<meta content="text... |
Best way to store JSON data in a Python Module
Question: I have a Python module I'm developing that's includes a big JSON file as part
of the data it relies on. I want Python users to be able to import the JSON
file as a Python variable and for users of other programming languages, to be
able to use the JSON file direc... |
Python: Possible to use urlparse to parse domain from cgi bin URL
Question: I have the following **input string** :
/cgi-bin/ivw/CP/dbb_ug_sp;?r=http%3A//www.some-super-domain.de/forum/viewtopic.php%3Ff%3D2%26t%3D18564%26start%3D75&d=76756.76050130278
I wanted to use `urlparse()` to **get the domai... |
Python: Convert timedelta to int in a dataframe
Question: I would like to create a column in a pandas data frame that is an integer
representation of the number of days in a timedelta column. Is it possible to
use 'datetime.days' or do I need to do something more manual?
**timedelta column**
> 7 days, 23:29:00
**day... |
Python 3.4 strptime() not working
Question: I am trying to convert a string to datetime and it isn't working...
self.loadsList[loadID][5] = datetime.strptime(
self.loadsList[loadID][5]+" "+self.loadsList[loadID][6], "%x %X %z")
and it raises a Value Error.
ValueError: time data '... |
LASSO regression result different in Matlab and Python
Question: I am now trying to learn the ADMM algorithm (Boyd 2010) for LASSO regression.
I found out a very good example on this
[page](http://www.simonlucey.com/lasso-using-admm/).
The matlab code is shown
[here](https://dl.dropboxusercontent.com/u/22893361/code/... |
Should import be inside or outside a Python class?
Question: # Overview
Suppose I'm building a class for general usage: I might need to import it
wherever, use it in a couple other files, etc. Should the import go before the
class, as:
import foo
class Bar():
def __init__(self):
... |
OSError: [WinError 193] %1 is not a valid Win32 application
Question: I am trying to call a python file "hello.py" from within the python
interpreter with subprocess. But I am unable to resolve this error. [Python
3.4.1].
import subprocess
subprocess.call(['hello.py', 'htmlfilename.htm'])
Tra... |
Converting values within a dictionary from strings to floats in python
Question: I have a dictionary that looks something like this that was imported from a
csv file.
X = {'0':['1.2', '3.2', '4.5', '']}
I would like for all of the values within the dictionary to be floats instead
of strings but am... |
SIGNALs are not working in PySide
Question: I wrote a simple application in Python and PySide. When I run it, SIGNALs are
not working. The application starts without errors.
from PySide.QtCore import *
from PySide.QtGui import *
import sys
class Form(QDialog):
def __init__(s... |
Determine Size of Pickled Datetime
Question: I am currently pickling a python `datetime` to be passed to a task via celery,
and am running into memory issues. I'd like to find a way to determine the
resulting size of pickling a `datetime` object so that I can compare it to
pickling the unix timestamp. I realize the tim... |
Missing file in compiled py2exe app selenium
Question: I am trying to get my Selenium app to work. It compiles everything, but when I
open the app it gives me this:
C:\Python34\dist>browse.exe
Traceback (most recent call last):
File "browse.py", line 9, in <module>
File "C:\Python34\lib\site-... |
Change the default encoding for automatic str to unicode conversion
Question: When doing the following concatenation:
a = u'Hello there '
b = 'pirate ยฎ'
c = a + b # This will raise UnicodeDecodeError
in python 2, `'pirate ยฎ'` is automatically converted to `unicode` type through
ascii encodi... |
Calling Pandas Data Frames Created with globals() Inside For Loop
Question: I am iterating through 50 files in python and dumping them each into pandas
data frames. Then from each data frame I create three new data frames based on
the values in a specific field in the original data frame. These three new
frames have ne... |
python code to play a particular song with reference
Question: There is a file `1.mp3` in the location `/home/<username>/Music/`
Whatever name is given to a value of varible **`a`** , the code should
automatically search the specific folder and play that particular (number)
song
The code structure
impo... |
How to configure wsgi application to migrate to django 1.7?
Question: I'm trying to upgrade from Django 1.6 to 1.7.
When running python manage.py runserver, I got the following error :
django.core.exceptions.ImproperlyConfigured: WSGI application 'myapp.wsgi.application' could not be loaded; Error impor... |
Python Socket gives "[Errno 24] Too many open files"
Question: I have the following UDP class sending arrays of data at about 100Hz
from six import string_types
import socket
import struct
def convert_data(iterable):
if isinstance(iterable, string_types):
return str(i... |
HTTP 500 Error with Django Ajax
Question: I'm trying to use Django with AJAX calls, and it's giving me HTTP 500 even of
MultiValueDictKeyError even though there's nothing wrong?
I sent 3 variables: sendEmail, username, error
I was able to use a request.POST on the 3 variables, and get the following
output:
* * *
se... |
Python unit test for nested if statement
Question: So I've been posting unit test questions because I'm trying to get good at
them. I'll try to be as clear as possible. Below I have a nested if statement,
I want to mock the input for the `difficulty` variable and check for the
stdout if the condition is met.
here is m... |
Xml parsing using xml.dom
Question: My xmls aren't like others. Here is an example of my xml:
"<msg t='sys'><body action='verChk' r='0'><ver v='153' /></body></msg>"
what I want is to get the value of action. How do I do that using xml.dom in
python...
Answer: Here is the code that uses x... |
Python - wrong logic in nested 'if' in a for-loop
Question: I am having script to read an Excel file, which cells A1 ~ A6 contains:
OK 17
OK 9
BKK 17
OK 16
OK 12
BKK 16
They are the only contents of the Excel file.
What I want to do is, to check the codes either โOKโ or โBKKโ i... |
Python sub processes block when doing blocking read from stdin in main process
Question: I have a Python multiprocessing application which starts "workers" using the
multiprocessing API. The main process is itself started by a service process
which is not written in Python. The workers may themselves start other non-
P... |
Ring Buffer for n-dimensional Vectors
Question: I am working on an real-time application. For this I need to store around 20
arrays per second. Each arrays consists of n Points with their respective x
and y coordinate (z may follow as well in the future).
What I did come up with is some kind of a Ring Buffer, which ta... |
Can't set character_set_results to latin1
Question: I've decided to use Django 1.7 for the first time with Python 3. I need to be
able to work with legacy `latin1` database which contains `utf8` data. I know
it sucks, but the database is so huge that it's really impossible to change
this. So I tried following:
... |
Getting rid of 'nan' from list value of dictionary , python
Question: I have this dictionary:
dict_new =
{'extracted_layout': [nan, nan, nan, nan, nan, nan, nan, nan, nan, 'shyamanna layout', nan, nan, nan, nan, 'm t s layout', nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, 'g... |
Python Web Scrape Write Output to File
Question: I have a basic Python Script which can store the output to a file. This is
file is difficult to parse. Any other way to write scraped data to a file
which can be read easily into Python for analysis ?
import requests
from bs4 import BeautifulSoup as BS... |
SoundCloud python api and GAE upload larger sounds
Question: I've been testing the SoundCloud Python API and it was working great with
smaller files (< 1MB). Now, I'm trying to upload larger files (5MB+) and I'm
getting errors.
Here's the code:
import soundcloud
client = soundcloud.Client(
... |
Mocking a subprocess call in Python
Question: I have a method (`run_script`) would like to test. Specifically I want to test
that a call to `subprocess.Popen`occurs. It would be even better to test that
`subprocess.Popen` is called with certain parameters. When I run the test
however I get `TypeError: 'tuple' object is... |
Optimize python loop
Question: The following loop creates a giant bottleneck in my program. Particularly
since records can be over 500k.
records = [item for sublist in records for item in sublist] #flatten the list
for rec in records:
if len(rec) > 5:
tag = '%s.%s' %(rec[4], rec[5... |
relative import error in python and where can find python module source code
Question: I'm quite new to python. Though I understand the basic data types,control flow
,etc, I still feel a lit bit difficult from top-level view.
One of these questions is `relative import`. I have a piece of code from a
book trying to imp... |
Sending Mail from Google App Engine
Question: I am trying to send an email from google app engine using the python 2.7
library but I keep getting Unauthorized sender in the logs. I have tried my
gmail account I created the application with as the sender, I registered
another gmail address as a developer and tried that ... |
What is the proper way I can invoke firefox from a python3 program?
Question: I'm trying to start firefox with an internet page by calling it in python 3 as
an argument to os.system or os.startfile.
The internet page I want to start is <https://schwab.com>
I can't bring it up at the command line with
C:\Python34\hsf... |
Json, urlib2 and pprint
Question: I have the following exercise:
_Use the[json](http://docs.python.org/library/json.html) module. First use
[urllib2](http://docs.python.org/howto/urllib2.html) to download this file,
then load the json as a python object and use **pprint** to make it look good
when written to the termi... |
Create users on Microsoft Active Directory using a Scripting Language
Question: I need to create and/or update the Students users in the school I work in. I
only have access to the "Remote Control" not directly on the server and I have
been told, that I will be able to remotely create, update and delete users and
group... |
Python - Reading web page after authentication
Question: First, sorry for my english, it's not my mother tongue. Anyway, some grammar
errors will not kill you :) Hopefully.
I'm not able to get some information from a web page due to authentication
system.
The website is : www.matchendirect.fr It's a French site and t... |
Parsing json element
Question: I am using Scrapy and a Regex to parse some none standard web source code. I
then wish to parse the first element of the dictionary returned:
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from s... |
AndroidViewClient remove package and broadcastreceiver
Question: I am using the AndroidViewClient library, and it works perfectly fine. I want
to know how do I remove a package and access the methods listed here:
<http://developer.android.com/tools/help/MonkeyDevice.html>
I tried using MonkeyRunner but androidviewcli... |
Python Tkinter how to take the input from multiple Entry widgets stored in one variable
Question: my code is the following.
from tkinter import *
def TakeInput():
print(tb.get()) #This will print Entry1 input
print(tb.get()) #This will print Entry2 input
tk=Tk()
#Entry 1
t... |
Import Python codes inside HTML file
Question: As mentioned
[here](http://karrigell.sourceforge.net/en/pythoninsidehtml.html), I can
import Python codes inside .html files using `<%` and `%>` tags. Just to try
it, I wrote the below code in notepad and save it as a file named test.html :
<html>
<title... |
Having trouble importing nltk.etree.elementtree
Question: I'm following along with Natural Language Processing with Python. when i run
from nltk.etree.ElementTree import ElementTree
I get this error:
ImportError: No module named etree.ElementTree
Why is this?
Answer: etree wa... |
Check if a specific Key and a value exist in a dictionary
Question: I am trying to determine if a specific key and value pair exist in a
dictionary; however, if I use the contains or has-key method, it only checks
for the key. I need it to check both the key and the specific value. Some
background: We have a total of 4... |
Socket Connection between django servers
Question: I am newbie for django and python. The thing what I need is, connecting **more
than one django server with socket**. One of these servers (main server) will
get a request from mobile client with Django-REST API, and then, it should
transmit it to the other django serve... |
Python equivalent of PowerShell Get-EventLog
Question: In PowerShell you can run this command to list all of the different Event Log
folders on a server:
Get-EventLog -list
Is there a way to do this in Python? I've seen many posts about how to get
logs from a specific folder (using e.g. `win32evtlo... |
Python mpmath not arbitrary precision?
Question: I'm trying to continue on my previous question in which I'm trying to
calculate Fibonacci numbers using Benet's algorithm. To work with arbitrary
precision I found `mpmath`. However the implementation seems to fail above
certain value. For instance the 99th value gives:
... |
Configuring Django 1.7 and Python 3 on mac osx 10.9.x
Question: I have installed the latest versions of both django and python. The default
"python" command is set to 2.7; if I want to use python 3, I have to type
"python3".
Having to type "python3" and a django command causes problems. For example if
I type: "python3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.