text stringlengths 226 34.5k |
|---|
Preventing double-output in python FileHandler when log paths overlap
Question: The following code results in the same log message being output twice:
log1 = logging.getLogger('foo')
log1.addHandler(logging.FileHandler('log.txt'))
log2 = logging.getLogger('foo.bar')
log2.addHandler(logging.Fi... |
Format Python Decimal object to a specified precision
Question: I've spent countless hours researching, reading, testing, and ultimately
confused and dismayed at Python's Decimal object's lack of the most
fundamental concept: Formatting a Decimal's output to a string.
Let's assume we have some strings or Decimal objec... |
Python: How to find more than one pathway in a recursive loop when multiple child nodes refers back to the parent?
Question: I'm using recursion to find the path from some point A to some point D. I'm
transversing a graph to find the pathways.
Lets say:
Graph = {'A':['route1','route2'],'B':['route1','route2','route3'... |
Python: file.readline adding a space at the end of the line
Question: Am using python to read a flat space-padded text file. Part of the validation
of the text file is that each line in the text file is expected to be a
specific file length including the space padding.
When I use the following code, python ends up giv... |
How can I send a signal from a python program?
Question: I have this code which listens to USR1 signals
import signal
import os
import time
def receive_signal(signum, stack):
print 'Received:', signum
signal.signal(signal.SIGUSR1, receive_signal)
signal.signal(signal... |
How to check if the sitemap contain some urls
Question: I am new to python and django, I am trying to fix a sitemap creator and one of
the bugs that it would create an empty sitemap. Meaning the sitemap does not
really have any urls in it.
example:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmln... |
How to make a python program for multiplying elements of two lists?
Question: I want to make a python program which inputs two lists of numbers from user,
and outputs a list which satisfies some specific conditions. If I input a list
`[1,2,3]`, this means the polynomial that it represents is: `3x^2+2x+1`. Or,
in other ... |
Behavior of exec function in Python 2 and Python 3
Question: Following code gives different output in `Python2` and in `Python3`:
from sys import version
print(version)
def execute(a, st):
b = 42
exec("b = {}\nprint('b:', b)".format(st))
print(b)
a = 1.
e... |
Python Mock Process for Unit Testing
Question: **Background:**
I am currently writing a process monitoring tool (Windows and Linux) in Python
and implementing unit test coverage. The process monitor hooks into the
Windows API function [EnumProcesses](http://msdn.microsoft.com/en-
us/library/windows/desktop/ms682629%2... |
Set a point on the image to act as rotate point Pygame.transform.rotate()
Question: I am newbie to both python and pygame. I want to rotate a rectangle about a
point other than center. My code so far is :
import pygame
pygame.init()
w = 640
h = 480
degree =45
s... |
How to test Django-CMS plugins packaged as a reusable app
Question: I have followed the procedure in the [Django
docs](https://docs.djangoproject.com/en/dev/intro/reusable-apps/) to make some
Django-CMS plugins reusable, and the [Hitchhiker's guide to
packaging](http://guide.python-distribute.org/quickstart.html) to pu... |
converters option in numpy genfromtxt not accepting -ve indexing of columns
Question: I want to load only last few columns in a text file with some evaluation.
I used numpy.genfromtxt with the argument converters={-1:func,-2:func}
But it is not working. On the other hand if i give the forward indexing like
converters... |
Regex does not match but seems to be correct
Question: I have a very weird problem:
Using the same regex matches in several online services, but not in my local
python 3.3 instance.
re.search("ajaxHandler\('(?P<fp>[A-Z0-9]+)",rawdata).group("fp")
where rawdata is
<select name="F4542... |
Flask, Heroku and Github Dependencies/File Structure
Question: Quite a beginner at the whole flask/heroku/github business, but been using
python for several years now and had experience with tortoise SVN. I have been
following the tutorial on how to push code to heroku at this link
<https://devcenter.heroku.com/article... |
py.test run tests in specific testSuite
Question: I'm new to py.test. So far I like what I see and want to integrate it to our
CI process.
Currently we use a different kind of parameterization scheme for our tests
which I will explain briefly:
* instead of parameterizing per-test, we parameterize per class
* say ... |
Anybody know MATLAB and Python? (Code conversion MATLAB>Python)
Question: I am trying to re-write this MATLAB program in Python. I haven't succeeded in
getting the same Python output, yet. But my attempt is given beneath the
MATLAB code. The code does not need any extra files/information to run. So
this should run OK o... |
Wrapper for libeay32.dll: how to import macro?
Question: I'm writing small wrapper for OpenSLL `libeay32.dll` in Python. For majority
of functions it is possible to import them as follows:
self.Function_Name = self._dll.Function_Name
self.Function_Name.restype = ctypes.c_int #for example
self.Fun... |
Circular module dependency in python
Question: I have two modules, baselib.Database and baselib.Application. In
baselib.Application, I have
import baselib.Database
APP = None
class BaseApplication():
def __init__(dbClass = baselib.Database.GenericDb...):
global APP
... |
How to load user code?
Question: I have a program which automatically generates a data structure from user-
provided JSON code. I also want to provide an option to allow users to write
their own function to generate this data structure programmatically. Is there
a way for Python to load an arbitrary module by path and ... |
PIL and vectorbased graphics
Question: I run into several problems when I try to open EPS- or SVG-Images with PIL.
Opening EPS
from PIL import Image
test = Image.open('test.eps')
ends in:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:... |
How to pass python variable to html variable?
Question: I need to read a url link from text file in python as a variable, and use it
in html. The text file "file.txt" contains only one line
"<http://188.xxx.xxx.xx:8878>", this line should be saved in the variable
"link", then I should use the contain of this variable i... |
Compare 2 .csv files with Python then output results
Question: I'm fairly new at programming and I am trying to write a python program that
will compare 2 .csv files by specific columns and check for additions,
removals, and modifications. The .csv files are both in the following format,
contain the same amount of colu... |
Starting out in Python Development: Coin-Tossing Loops
Question: Afternoon all,
I cross your paths as someone looking to teachimself programming. As such,
I've started with Python. As a disclaimer, I have searched the question for
some examples of Python coin-tosses but I've not really understood any of the
code that ... |
Python v2.6 rounding up with decimals (currency)?
Question: So I am very new to Python and have a question about rounding up.
product_price = '79.98'
subtotal = Decimal(product_price)
cal_tax = '0.0825'
tax_conv = Decimal(cal_tax)
tax_total = subtotal * tax_conv
total_tax = round(tax_... |
Get a JSON object in python
Question: Usually my webservice built with Bottle return JSON files, which works fine.
But, I've an exception that need to call a local function.
Here is what I tried to do:
import json
def getData():
return json.dumps({'data': someData })
def function():... |
Error "sqlserver_ado isn't an available database backend" (PyISAPIe on IIS)
Question: I'm having problems connecting my Django project to SQL Server 2008 when using
IIS to serve Django and [django-mssql](http://django-
mssql.readthedocs.org/en/latest/index.html) to handle transactions. I am using
IIS 7 and [64 bit Acti... |
Find and replace everything between two placeholders with the contents of a variable
Question: Aloha, I have been trying to figure out how to replace/insert text strings
between two place holders.
#start
REPLACE ANYTHING IN HERE
#end
Originally I was trying to do this with BASH via sed, but... |
Initialize/Create/Populate a Dict of a Dict of a Dict in Python
Question: I have used dictionaries in python before but I am still new to python. This
time I am using a dictionary of a dictionary of a dictionary... i.e., a three
layer dict, and wanted to check before programming it.
I want to store all the data in thi... |
Python CGI Issues
Question: I am building a simple web app (posted part of it yesterday) but I am
struggling with a portion:
1) Request a text file to upload 2) Save the uploaded file to a directory
I am using python and cgi for this. cgi is working as confirmed with a simple
test.cgi file.
Here is my current code f... |
Python: toggle a button (adding more buttons)
Question: This is just the initial code for what will be an array of buttons, effecting
each other. I can't seen to understand why I keep getting this definition
error!
from tkinter import *
import tkinter.messagebox
from tkinter import ttk
... |
I am trying to find and replace the values in the text file
Question: I have a text file containing values (e.g.0.2803739 0.280314). I would like to
replace the values in the text file in such a way that highest value will be
replaced by lowest value and so on. e.g. If text file contains values from 1
to 10 then value ... |
Daemonizing a python script with python-daemon - socket trouble
Question: I'm try to daemonize some code, but I'm having some trouble.
If I call the code with tklogger(), it runs just fine. However, if I call it
in the daemon context, I get the following trace:
Traceback (most recent call last):
F... |
python script advanced scheduling
Question: I'm trying to do something really complicated. Using a Windows box, I'm try to
get a script to run every half-an-hour, Mon-Fri, 9:00am-7:00pm, skipping
certain dates I define as "holidays". I would love for Python to run this
script itself. I've looked into 'apschedule', but ... |
Pure Python with Cython decorators: How to get attribute access at module level
Question: I would like to write some Pure Python with Cython decorator, but when I
rename my NONE.PY to NONE.PYX I've got an error. To workaround this issue I
need to wrap each attribute with a pure python definition call without
decorator.... |
How to make another list of the duplicate entries in existing list using python?
Question: I had a list like:
l = [[(3,4)], [(3,7)], [(3,8)]]
I used the `chain()` function to flat the list, now I have a list like:
l2 = [3,4,3,7,3,8]
I want to separate the duplicate items into a... |
Webkit under Windows with PyQt doesn't get remote resources via xhr
Question: I would like to write a Qt application which uses Webkit as its gui to get
data from a server and display it. I got it working unter Linux and OS X
without problems but under windows the XMLHttpRequest always returns status 0
and I don't know... |
How do I embed an IPython Interpreter into an application running in an IPython Qt Console
Question: There are a few topics on this, but none with a satisfactory answer.
I have a python application running in an IPython qt console
<http://ipython.org/ipython-doc/dev/interactive/qtconsole.html>
When I encounter an er... |
SQLAlchemy+pymysql Error: sqlalchemy.util.queue.Empty
Question: Trying to run Python3.2, SQLAlchemy0.8 and MySQL5.2 on Ubuntu using Eclispse
but I keep getting the error below. Am using pymysql (pymysql3 actually)
engine.
**module monitor**
from sqlalchemy import create_engine, MetaData
from sqlalch... |
Python 2.7 Unicode/IDLE confusion
Question: I've read a lot about Unicode and the various encodings/decodings in Python
2.7, but I'm still having trouble understanding why IDLE can't seem to print
the right string.
I have a unicode string:
>>> s = u"Hey I\u2019m Bob"
>>> print s
Hey I'm Bob
... |
a strange issue when trying to analysis HTML with beautifulsoup
Question: i'm trying to write some python codes to gather music charts data from
official websites, but i get in trouble when gathering billboard's data. i
choose beautifulsoup to handle the HTML
my ENV: python-2.7 beautifulsoup-3.2.0
first i analysis th... |
Python : import module once for a whole package
Question: I'm currently coding an app which is basically structured that way :
main.py
\+ Package1
+--- Class1.py
+--- Apps
\+ Package2
+--- Class1.py
+--- Apps
So I have two questions : First, inside both packages, there are modules
needed by all Apps, eg :... |
Unable to login to django admin view with valid username and password
Question: I know this question has been asked several times before but most of the
question were asked long ago and old answers did not work for me.
I have a django-nonrel based app which is using dbindexer as backend and
deployed on GAE. I am able ... |
Invalid Syntax error in Python Code I copied from the Internet
Question: One of my early courses in the University I attend, was some basic training in
Python 3 years ago. Now I was looking for a program that could help me resize
some Grid stuff and I found something that could help me in Python. I
reinstalled Python t... |
Python code runs through cmd however not in IDLE..Why?
Question: Okay so i just got my leap motion device and im trying to run the scripts.
When I press f5, the scripts load however it doesnt do the functions.. (it
initilizes, loads everything) .
But when i open by double clicking (through cmd) it works how its suppos... |
Google App Engine doesn't find local python module
Question: For some reason when I uploaded my app engine project yesterday (before this,
everything worked fine), it can't find one of my .py files/modules. My
directory is as follows:
app_directory/
gaesessions/
__init__.py
lib/
... |
Python RLock IO-Bound?
Question: I have a set of CPU-bound processes that take any number of cores to 100%
utilization as long as their only synchronization is getting jobs out of a
Queue.
As soon as I add an RLock to avoid worst case scenarios when updating a
directory in the file system, CPU/core utilization drops t... |
Python crash when downloading image as numpy array
Question: Why does the following code crash python? Is there an easier/better way to
download an image and convert it to a numpy array?
from pylab import *
from urllib import request
captcha=imread(request.urlopen('http://pastebin.com/etc/Captcha... |
How to receive reference and pointer arguments in Python + SWIG?
Question: I have a C++ function in which two arguments are given as the following
example.
void func(int& n, char** data)
{
*data = other_func1(); // returns a char array
n = other_func2(); // returns the length of the array... |
Trying to verify SHA1 message signature using Python. What am I doing wrong?
Question: I'm attempting to verify the SHA1 signature of a message by downloading a
certificate from a website and extracting its public key. There's a few bits
of sample code elsewhere on SO
([here](http://stackoverflow.com/questions/544433/h... |
Python CSV read-> write; remove and replace PLUS: end of line is JSON format
Question: I am having problems getting my Python script to do what I want. It does not
appear to be modifying my file.
I want to:
1. Read in a *.csv file that has the following format PropertyName::PropertyValue,…,PropertyName::PropertyVal... |
Python search one million strings in a file and count occurrences of each string
Question: This is more about to find the fastest way to do it. I have a file1 which
contains about one million strings(length 6-40) in separate line. I want to
search each of them in another file2 which contains about 80,000 strings and
co... |
Python, count down timer that doesn't sleep
Question: I am new to python and i am trying to make a countdown timer on a button
click. But i would like this countdown timer to start its countdown and place
the current countdown value in the text area. Also i need the rest of the
application to not sleep while this count... |
Python/BeautifulSoup Parsing HTML Fractions
Question: **Questions**
1. Why does is the output in the final two cases BOTH unicode, but in one case it shows the fraction, and in the other it shows some other code representing the fraction?
2. What is the cleanest way for me to go from the fraction to a decimal (-1... |
Minimum Weight Triangulation Taking Forever
Question: so I've been working on a program in Python that finds the minimum weight
triangulation of a convex polygon. This means that it finds the weight(The sum
of all the triangle perimeters), as well as the list of chords(lines going
through the polygon that break it up i... |
Python cannot import name <class>
Question: I've been wrestling most of the night trying to solve an import error.
This is a common issue, but no previous question quite answers my issue.
I am using PyDev (an Eclipse plugin), and the library Kivy (a Python library)
I have a file structure set up like this:
... |
python - overloading several operators at once
Question: I have a custom class and I want to overload several artihmetic operators, and
wonder if there is a way to avoid having to write out the code for each one
individually. I haven't been able to find any examples that don't explicity
overload each operator one-by-on... |
How do I set the terminal foreground process group for a process I'm running under a pty?
Question: I've written a simple wrapper script for repeating commands when they fail
called [retry.py](https://github.com/stsquad/retry). However as I want to see
the output of child command I've had to pull some pty tricks. This ... |
Print UTF-8 characters in cmd using python
Question:
# -*- coding: utf-8 -*-
print "ÆØÅ"
When running the above script in Windows 7 with python 2.7.3 using `cmd`,
`powershell` or `cygwin`, I get this output:
ÆØÅ
The file is a UTF-8 file and works fine in my text editor. How can I ... |
Is there a python (scipy) function to determine parameters needed to obtain a target power?
Question: In R there is a very useful function that helps with determining parameters
for a two sided t-test in order to obtain a target statistical power.
The function is called `power.prop.test`.
<http://stat.ethz.ch/R-manua... |
How to get the AST-tree instead of a list when parsing in Python with ANTLR?
Question: I get simple antlr3 grammar
[MicroXpath](http://www.antlr3.org/grammar/1210113624040/MicroXPath.g) and
build lexer and parser for Python.
Then I wrote a simple test code:
import antlr3
from XPathLexer import XPath... |
How to provide pre-compiled cython modules for 32 and 64 bits neatly?
Question: I have a python script using a cython module I wrote. I want to publish it,
and in order to save users the trouble of compiling the cython stuff
(especially complex on Windows), I want to provide pre-compiled extensions.
However, I will ne... |
Is it Possible to Use Imported Class Methods in A Python Class Definition Without Running All Code In the Imported File?
Question: I am using the PyMOL molecular viewer as a subset of a larger program, and for
ease of reading am breaking up my files like so...
### command1ClassFile.py
class comm... |
How to use python to extract data that is pushed to stdout?
Question: I'm trying to do some scripting, but one of the utilities I have returns a
value to stdout, where I would like to assign it to a variable.
The utility (candump) is constantly running and only prints to std out when it
receives data.
i... |
list became tuple for no reason. Bug or am I just too careless?
Question: I am in a quandary right now. This piece of code looks valid but no matter how
many times I tried to change its syntax, it still gives me the same result.
Basically, my problem is that even though I've created a list-nested list n x
n matrix, wh... |
Python 3.3 cx_freeze weird error: 'NoneType' object has no attribute 'path'
Question: So, here's my problem.
I'm making a game in Pygame and Python 3.3, using Ubuntu 12.10. Fine. I'm
gonna bundle a bunch of Python scripts into one executable, then distribute
it. Also fine. I'm going with cx_freeze, because since I'm u... |
Fade between images on screen using Python TKinter / imageTK
Question: I am a python newbie and have been making a somewhat odd slideshow script that
cycles through images and also sources a variable from another file to
'settle' on an image.
I'm sure my code is tragic. But it does work (see below)!
My question is - ... |
Uniform Random Numbers
Question: I am trying to understand what this code does. I am going through some
examples about numpy and plotting and I can't figure out what `u` and `v` are.
I know `u` is an array of two arrays each with size 10000. What does
`v=u.max(axis=0)` do? Is the `max` function being invoked part of th... |
How do I load and unload a Python module dynamically, disassemble and inspect it, but not execute init code or add it to sys.modules?
Question: I'm experimenting with disassembling Python modules into bytecodes.
Must I import a Python module statically or dynamically in order to
disassemble or inspect it? If not, what... |
Using Sublime Text 2 with Portable Python
Question: I have portable python and portable sublime text installed on a flash drive. I
edited the python-build file so that it would use portable python to run the
programs but it doesn't print anything into the sublime text window, it just
opens up a command prompt window wh... |
Python unittest fails when it shouldn't
Question: I ran unit tests in the file below, and one of test cases failed, where it
should not have failed. I got an unexpected result - Assertion error, where in
TestFormatInitMethodArgs I intended to test if `'"' == '"'`, but it tested for
`'"' == None` \- it looks like test i... |
python program to accept a string from the command line and print all files matching that string within a folder
Question: How do i write a program to accept a string from the command line and print
all filenames matching that string within a folder(also subfolders)?
I'm looking for a pattern match.
Answer: You can ... |
Embarassingly parallel tasks with IPython Parallel (or other package) depending on unpickable objects
Question: I often hit problems where I wanna do a simple stuff over a set of many, many
objects quickly. My natural choice is to use IPython Parallel for its
simplicity, but often I have to deal with unpickable objects... |
how to use variable in python os.path.exists
Question: Here is my code
[root@04 ~]# python
Python 2.4.3 (#1, May 5 2011, 16:39:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> pid = ope... |
How to copy a file in Python?
Question: I need to copy a file specified by the user and make a copy of it (giving it a
name specified by the user). This is my code:
import copy
def main():
userfile = raw_input('Please enter the name of the input file.')
userfile2 = raw_input... |
What does `import _preamble` do in Python?
Question: I notice the following at the top of Twisted's `twistd.py` script:
import os, sys
try:
import _preamble
except ImportError:
sys.exc_clear()
sys.path.insert(0, os.path.abspath(os.getcwd()))
What does `import _... |
I'm making a Dungeons and Dragons style game in python, but I'm getting incorrect if returns
Question: I've worked out how to do most of this stuff in the past couple of days, but
that's all the experience i have, so this is probably simple. Anyway,
everything was going fine, until I tried to complicate a few formula's... |
Permanently caching results of Python class generation
Question: I am doing dynamic class generation that **could be** statically determined at
"compile" time. The simple case that I have right now looks more or less like
this:
class Base(object):
def __init__(self, **kwargs):
self.do... |
Python cannot compare Tkinter Value
Question: I am trying to get the value of "Dragon On" which should start off as "On". I
want to compare it to "Off" but it does not recognize the change. The second
time i press the button it will set textvariable to Off but the comparison
will not detected that it changed. I have al... |
Convert python API example to PHP
Question: I need to connect to a RESTful API. The only example the company gave me to
connect to their API is a example in Python. I do not understand the language
but am comfortable with PHP. Is there a way I can do this with cuRL and/or
PHP?
Here is the example in Python:
... |
Python treat module name as 'NoneType'
Question: I have a piece of code that behaves strangely.
At the beginning, I import a module, which is a python binding for a C
library.
try:
import pyccn
except:
print "ERROR: PyCCN is not found"
exit(1)
Later in my code, I use py... |
Keep trailing zeroes in python
Question: I am writing a class to represent money, and one issue I've been running into
is that `"1.50" != str(1.50)`. str(1.50) equals 1.5, and alll of a sudden,
POOF. 45 cents have vanished and the amount is now 1 dollar and 5 cents. not
one dollar and 50 cents. Any way I could prevent ... |
Printing all the global methods in Python REPL
Question: In Python REPL
dir(str)
prints
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '_... |
Using relational model (keys) to make references to other objects, good or bad idea?
Question: In my previous job, most of program processing relied on persistent data
stored on a DB.
So the DB data model leaded the runtime programs data structures. Thus it was
very convenient for us to use primary keys values as refe... |
How to JSON serialize hh:mm:ss in Python? How to query its type?
Question: I need to serialize a python object into JSON and am having a hard time
converting time-counters into JSON-play-nice form
Say I have something like this:
01:20:24 # hh:mm:ss
which is a time counter I'm increasing, while... |
How does python find a module file if the import statement only contains the filename?
Question: Everywhere I see Python code importing modules using `import sys` or `import
mymodule`
How does the interpreter find the correct file if no directory or path is
provided?
Answer: <http://docs.python.org/2/tutorial/module... |
What is the OAuth scope for the Google Translation API?
Question: Surely someone else is using the API, I've looked and searched, I cannot seem
to find the correct value to place for the scope parameter when
authenticating:
I've looked at all these scope lists, nothing, tried the OAuth 2.0 playground,
translation is n... |
Running out of cron.hourly won't import a Python module
Question: I have foo running out of cron.hourly. It's been chmod +x'd, and it runs fine.
My problem is it does not recognize Python modules as importable.
I have ~/Foo/src, and within that lies the original Python code that I turned
into an executable (main), as ... |
Swig and Python - different object instantation
Question: I Have a question regarding swig wrapped objects generated on the Python side
and wrapped objects generated on the C++ side. Suppose I have the following
simple C++ class definitions
#include <vector>
class Sphere
{
public:
... |
How can I generate a random url of a certain length every time a page is created?
Question: In my python/pyramid app, I let users generate html pages which are stored in
an amazon s3 bucket. I want each page to have a separate path like
www.domain.com/2cxj4kl. I have figured out how to generate the random string
to put... |
Make python send the enter key when using curl
Question: I'm making a python script that curls the fantasy hockey scoreboard page,
calls a perl to regex substitute out the team names and scores, and display
it. The regex is all set up, but now I'm having trouble getting the webpage. I
notice when I do it on my computer... |
Python flattening my tuple structure
Question: I am trying to have a python hierarchical data structure with a map and the
value will be a tuple. In some cases the tuple will be of length 1. Python
intelligently flattens the structure whenever the tuple is of length 1.
Observe the example below which can be run in a py... |
Python and efficient looping of set intersections (using trees)
Question: Below are the distinct paths of attributes and values of a decision tree. If I
were to enumerate the tree of every combination, the tree would be huge.
So...each path of the tree are all of the distinct attributes and values of
leaf node.
If giv... |
InterfaceError unknown type <class 'decimal.Decimal'> for arg 10
Question: I'm trying to fetch some data from my database., this works perfect on my
local machine. But when deployed on Google App Engine it gives me an error
> InterfaceError at /report/unit/D8500/WV_herverkoop/2013/0/10/ unknown type
> <class 'decimal.... |
How to convert a string into a localised date in django
Question: We are doing an AJAX call in Django, where a user enters a date and a number,
and the AJAX call looks up if there already is a document with that number and
date.
The application is internationalised and localised. The problem is how to
interpret the da... |
Changing factor order in ggplot2 with Rpy2 in Python
Question: I'm trying to translate the following code into Rpy2 with no success:
neworder <- c("virginica","setosa","versicolor")
library("plyr")
iris2 <- arrange(transform(iris,
Species=factor(Species,levels=neworder)),Species)... |
how do we get the output of a subprocess of a subprocess
Question: Could someone share a sample of python script that shows the output of a
subprocess (java kicked off by file.bin) of a subprocess (kicking off a
file.bin) ?
The subprocess (java kicked off by file.bin) of a subprocess (kicking off a file.bin) looks lik... |
Python: Using Excel CSV file to read only certain columns and rows
Question: While I can read csv file instead of reading to whole file how can I print
only certain rows and columns?
Imagine as if this is Excel:
A B C D E
State |Heart ... |
How can i assign (assert) values to functions in Z3py?
Question: I would like to kindly ask , How can I convert the following Z3 constraints
into Z3py (Python API).
(declare-datatypes () ((S a b c d e f g)))
(declare-fun fun1 ( S ) Bool)
(declare-fun fun2 ( S S ) Bo... |
Confusing Error when Reading from a File in Python
Question: I'm having a problem opening the `names.txt` file. I have checked that I am in
the correct directory. Below is my code:
import os
print(os.getcwd())
def alpha_sort():
infile = open('names', 'r')
string = infile.read()
... |
How do i trace a particular terminal command?
Question: In Openstack, lets say for example, i'm entering the command and i start up an
instance using the image myimage and use flavor 1.
nova boot --image myimage --flavor 1 server1
How can i actually trace this command and get details like what fun... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.