text stringlengths 226 34.5k |
|---|
How to segment text into sub-sentences based on enumerators?
Question: I am segmenting sentences for a text in python using nltk
`PunktSentenceTokenizer()`. However, there are many long sentences appears in
a enumerated way and I need to get the sub sentence in this case.
Example:
The api allows the use... |
Python Scikit-learn Perceptron Output Probabilities
Question: I'm using scikit-learn's Perceptron algorithm to do binary classification.
When using some of the other algorithms in the library (RandomForestClassifer,
LogisticRegression, etc.), I can use `model.predict_proba()` to have the
algorithm output the probabilit... |
How to make values in list of dictionary unique?
Question: I have a list of dictionaries in Python, which looks like following:
d = [{feature_a:1, feature_b:'Jul', feature_c:100}, {feature_a:2, feature_b:'Jul', feature_c:150}, {feature_a:1, feature_b:'Mar', feature_c:110}, ...]
What I want to achie... |
strip date with -07:00 timezone format python
Question: I have a variable 'd' that contains dates in this format:
2015-08-03T09:00:00-07:00
2015-08-03T10:00:00-07:00
2015-08-03T11:00:00-07:00
2015-08-03T12:00:00-07:00
2015-08-03T13:00:00-07:00
2015-08-03T14:00:00-07:00
etc.
I n... |
psycopg2 module cannot be found by Python2.7
Question: I installed psycopg2 via pip, but my programs are having trouble finding it.
So, I tried to install psycopg2 via pip again:
user@ubuntu:~/Desktop/progFolder$ sudo pip install psycopg2
Requirement already satisfied (use --upgrade to upgrade): psyc... |
Allow user to change default text in tkinter entry widget.
Question: I'm writing a python script that requires the user to enter the name of a
folder. For most cases, the default will suffice, but I want an entry box to
appear that allows the user to over-ride the default. Here's what I have:
from Tkinte... |
How to save pytest's results/logs to a file?
Question: I am having trouble trying to save -all- of the results shown from pytest to a
file (txt, log, doesn't matter). In the test example below, I would like to
capture what is shown in console into a text/log file of some sort:
import pytest
import os... |
Returning values from event handler function wxPython
Question: So in normal python scripts you can do something like this:
def func():
i = 1
return i
i = func()
Generally speaking, another python program would be able to import the file
containing this and just say i = func() i... |
Single line commands from Python
Question: I am trying to change certain entries in a file using python, which is
possible in Perl with the command below , do we have anything similar in
python, here the string in the file is replaced successfully.
[root@das~] perl -pi -w -e 's/unlock_time=1800/#unlock_t... |
Python/Flask Login form throws 500 error on IIS
Question: Due to my restrictions at work, I have to rely on hosting my webapp on **IIS
7.5**. I configured _IIS_ to serve the application via **wfastcgi.py**.
The issue is, that a login form, throws an **HTTP 500** error on IIS, when
clicking on the login button. The sit... |
Spark + Python - how to set the system environment variables?
Question: I'm on spark-1.4.1. How can I set the system environment variables for Python?
For instance, in R,
Sys.setenv(SPARK_HOME = "C:/Apache/spark-1.4.1")
.libPaths(c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib"), .libPaths()))
... |
Exceptions: Throw in C# and except in (Iron)Python?
Question: anybody have an idea how to achieve that.
Been looking for a solution and all I find are ways to 'throw in python and
catch in C#'.
Ideally I'd like to have a C# method and wrap all my py code in a try/except
block. When the C# method throws I'd like to ha... |
Plot 4th dimension with Python
Question: I would to know if there is the possibility to plot in four dimensions using
python. In particular I would to have a tridimensional mesh X, Y, Z and
**f(X,Y,Z) = 1** or **f(X,Y,Z) = 0**. So I need to a symbol (for example "o"
or "x") for some specific point (X,Y,Z). I don't need... |
Parsing XML with namespaces into a dataframe
Question: I have the following simpplified XML:
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap="http://www.w3.org/2003/05/soap-envelop... |
Can't find any info on Python's read() method (python 2.7)
Question: I'm trying to learn Python by going through Zed Shaw's "Learn Python the hard
way" and I'm stuck at what may seem as a very trivial thing. I'm unable to
find any info on the .read() method. This is what he says in the book:
> Run pydoc file and scrol... |
How to redirect stderr to variable in Python 2.7?
Question: I am trying to redirect the stderr of a script to a variable to use it in
`if/else` statements. What I need is the program to behave in one way or
another according to the stderr. I have found [this
post](https://wrongsideofmemphis.wordpress.com/2010/03/01/sto... |
Where comes the output message when submitting a python file to spark using spark-submit
Question: I'm trying out the spark-submit command to submit my python app to cluster.(3
machine cluster on AWS-EMR) Surprisingly I cannot see any intended output from
the task. Then I simplified my app to only print out some fixed ... |
How would I call a function within a class from the same class in python?
Question: Given this basic example, but in reality it's more complex: (Name of the file
is TestFile)
class Example:
def test1():
print("First test")
def test2():
print("Second test")
... |
sentiment analysis of Non-English tweets in python
Question: Objective: To classify each tweet as positive or negative and write it to an
output file which will contain the username, original tweet and the sentiment
of the tweet.
Code:
import re,math
input_file="raw_data.csv"
fileout=open("Outpu... |
How to pass Command Line arguments in Robot framework to make it available for all libraries?
Question: I have developed few libraries for robot framework for my feature testing, for
these libraries all variables are coming from a variables.py file. Below is
the code block for variables.py:
#!/usr/bin/en... |
Scrollbar into a python tkinter discussion
Question:
from tkinter import *
window = Tk()
ia_answers= "test\n"
input_frame = LabelFrame(window, text="User :", borderwidth=4)
input_frame.pack(fill=BOTH, side=BOTTOM)
input_user = StringVar()
input_field = Entry(input_frame, text... |
Except block not catching exception in ipython notebook
Question: When I try this simple example in my current Python environment (a ipython
notebook cell) I am not able to catch TypeError exception:
a = (2,3)
try:
a[0] = 0
except TypeError:
print "catched expected error"
except E... |
Python 3.4 cx_freeze [WinError 5] using Selenium - Only on other machines
Question: I've recently started devling into cx_freeze and creating .exe files for other
people to use.
The script is fairly simple: It uses Selenium to scrape javascript-sensitive
content on a website, and gives the user a notification when it ... |
File uploaded to salesforce empty using python and simple_salesforce
Question: I'm trying to upload a file to the Folder object in salesforce using python
and simple_salesforce. The file is uploaded but is empty. can anyone tell me
why and how to fix the problem? Thanks.
import base64
import json
... |
Python: How to open a multisheet .xslx file (with formatting) and edit a few cells and save it as another .xlsx file
Question: I have tried using openpyxl but it seems to fail when I am saving the file
(<http://pastebin.com/VU5LTajH>) and I cannot find any info about the problem.
Any other modules that let you read ed... |
Is it possible to configure Python interpreter to use matplotlib and/or scipy without prepending the class names
Question: I a using a a python package (SloppyCell) that relies heavily on the use of
python plotting tools within scipy and matplotlib. In this software they have
used, on several occasions functions from t... |
.dat file in python
Question: I'am doing a project in python using OpenCV. I have to store a large amount of
integer data(features of images in the database) in a separate file. I can use
.txt file but it stores integer values as strings. Is there any way that I can
store integer values directly as integers in python l... |
Can't get NLTK-Trainer to recognize/ work with scikit-learn classifiers
Question: I've been using the (excellent) NLTK-Trainer in order to train a NaiveBayes
classifier to classify snippets of text. I see that NLTK-Trainer also supports
the scikit-learn algorithms, and I would like to use these in hopes of
decreasing m... |
define Keywords in pyparsing for an interpreter
Question: So I know this may be a stupid question and is most likely impossible but is
there a way in pyparsing to create keywords (such as print for python) I am
trying to create a interpreter for a different language in python so that you
can write in this language on a... |
Python: Dynamically calling Method in separate script
Question: I'm currently working on a project to control a 6 legged robot. I've got my
scripts set up for the individual joint control and it's working fine. I have
individual scripts for the joint controllers for each leg,
leg_1_joint_control, leg_2_joint_control et... |
trying to parse csv file in python 3.4
Question: So I'm new in parsing csv files and I'm using the pycharm 4.5 IDE. I'm having
a problem parsing a csv file from crunchbase (the file I am dealing with is
pretty huge) and i get this UnicodeEndcodeError, I want to know why this is
happening.
(it's below to see the full e... |
Adjust space between tick labels a in matplotlib
Question: I based my heatmap off of: [Heatmap in matplotlib with
pcolor?](http://stackoverflow.com/questions/14391959/heatmap-in-matplotlib-
with-pcolor)
I checked out [How to change separation between tick labels and axis labels in
Matplotlib](http://stackoverflow.com/... |
Creating lists from csv files with rows with different amounts of entries
Question: I have data in a csv file which looks like this:
fromaddress, toaddress, timestamp
[email protected], [email protected], [email protected], 8-1-2015
[email protected], [email protected], 8-2-2015
send... |
Solve Polynomial equation of 6th order with Python efficiently
Question: I want to Solve Polynomial equation of 6th order with Python. I've tried the
"basic" version:
avgIrms = 19.61
c_val = (0.000002324*avgIrms**6) - (0.0001527*avgIrms**5) + (0.003961843*avgIrms**4) - (0.052211292*avgIrms**3) + (0.3... |
Scraping specific elements from page
Question: I am new to python, and I was looking into using scrapy to scrape specific
elements on a page.
I need to fetch the Name and phone number listed on a members page.
This script will fetch the entire page, what can I add/change to fetch only
those specific elements?
... |
basic python syntax that i don't quite get
Question: I keep getting this error, I'm not sure why though.
Traceback (most recent call last):
File "/home/cambria/Main.py", line 1, in <module>
from RiotAPI import RiotAPI
File "/home/cambria/RiotAPI.py", line 6
def __init__(self, ... |
How to get the time in python on android?
Question: I am trying to make a program that will use the time and display it down to
the seconds. How do I do this? So far I have found the function get_time()
that is part of kivy but I am not sure how to use it. I have imported
everything but it still says "not defined".
A... |
Compile Cython on pip package build
Question: I'm developing a Python package, [EcoPy](https://github.com/Auerilas/ecopy),
that is mostly written in pure Python. The main folder is called ecopy.
There's a subfolder called regression that has a Cython file that's already
been built. The main setup.py file includes the c... |
Installing scipy in cygwin
Question: I'm failing to install scipy in cygwin (32-bit) with any method I've tried
(pip, direct source code). Here is the error I get
from scipy/spatial/ckdtree/src/ckdtree_globals.cxx:9:
/usr/lib/python2.7/site-packages/numpy/core/include/numpy/__multiarray_api.h:162... |
why cannot print non integer epicycloid in command line?
Question: I want to create a program to print epicycloid:
import math
import sys
WIDTH=30
R=10.0
N=3.0
DELTA=0.01
pixels=[[0 for y in range(WIDTH)] for x in range(WIDTH)]
for f in range(0,(int)(2*math.pi/DELTA)):
... |
Simple Pandas issue, Python
Question: I want to import a txt file, and do a few basic actions on it.
For some reason I keep getting an unhashable type error, not sure what the
issue is:
def loadAndPrepData(filepath):
import pandas as pd
pd.set_option('display.width',200)
... |
Clean up .html reports and export as .txt files
Question: I've been searching all night but I'm still not sure how to get the job done.
I'm new to python, so please forgive me first if I'm asking some simple
questions.
I've three thousands .html files (all new product description downloaded from
a trusted website) sto... |
Pygame images won't load anymore
Question: Since I started this I've had char.png in the same folder as my .py file
**not** a subfolder and it would load my images but when I added in the
ability to move left and right, now I get an error.
Traceback (most recent call last):File "C:\Users\Shiloh\Google Dr... |
Django-cms render_to_response doesn't render to template
Question: I am working on a project in django 1.5.12. version with django-cms installed
. I have a file generated by command "pip freeze > frozen.txt" where is next
information with what I have installed:
Django==1.5.12
MySQL-python==1.2.5
... |
When comparing arrays why is "in1d" so much slower than "a==b"
Question: I need to be able to compare two images and extract any unique pixels to
create a third image. To accomplish this I did the following:
import cv2
import numpy as np
img = cv2.imread("old.jpg")
img2 = cv2.imread("new... |
Python -- list index out of range -- on a simple SELECT statement?
Question: I'm new to Python, so maybe I'm making a newbie mistake. But this doesn't seem
the kind of error I should get in this circumstance.
On a very simple SELECT statement, I'm getting a "list index out of range"
error.
sql = """
... |
change font size of facet titles using seaborn facetgrid heatmap
Question: Note: this is a different question than "[How can I change the font size using
seaborn FacetGrid?](http://stackoverflow.com/questions/25328003/how-can-i-
change-the-font-size-using-seaborn-facetgrid)". The methods suggested there do
not work whe... |
Python : Replacing Values in netcdf file using netCDF4
Question: I have a netcdf file with several values < 0\. I would like to replace all of
them with a single value (say -1). How do I do that using netCDF4? I am
reading in the file like this:
import netCDF4
dset = netCDF4.Dataset('test.n... |
Passwordless ssh with paramiko fails to authorize
Question: I am having trouble getting authentication working with paramiko SSHClient.
Trying to go from one virtual machine out to another box on the network. The
general idea is that I create a public/private key pair, ssh into the client
using a password given, take t... |
calling an api concurrently in python
Question: I need to talk to an api to get information about teams. Each team has a
unique id. I call the api with that id, and I get a list of players on each
team (list of dicts). One of the keys for a player is another id that I can
use to get more information about that player. ... |
handle two different erro codes by exception handler in python
Question: HI i am new python and please excuse me if this seems to be a silly question .
I have a function in my code which returns an exception ResponseError and the
ResponseError has two error codes 404 and 403 I want my exception handler to
give two diff... |
Reverse Geocoding using Python and Google API
Question: I am trying to reverse geocode 500 lat and long random points using google
API. I wrote the code below but I notice there are some errors that I need
help with. I want to create a output CSV that has the Lat/Long and complete
address of the reverse geocode and als... |
IPython: load extension automatically upon start
Question: In IPython, I can load a custom extension using simple command:
%load_ext physics
This will load the file `~/.config/ipython/extensions/physics.py`.
How can I tell IPython to load the extension automatically on startup?
I have added the l... |
Python- text based game not calling the correct room
Question: I am writing a text based game and I want to link each room to four other
rooms- north, south, east and west. I am starting with just north for now. The
user should be able to type 'walk north' and the north room should be called.
I have used three files- ... |
Python RegEx to report lines a string exists on
Question: I am trying to write something up real quick that will find a specific string
and report to me what lines those string exist on. I am trying to find
exponents so I am looking for "e+" which only occurs on lines that start with
AAA, but not ALL the lines with AAA... |
While statement not evaluating to false for Selenium Webdriver
Question: I'm migrating a test I wrote in the Selenium IDE to Python WebDriver and I'm
having some issues with a **'while'** loop scenario. Here's the IDE code:
while | selenium.isElementPresent("xpath=//select[@name='servers']/option")
... |
How to filter a big chunk of text which contains no line breaks in python?
Question: here is my problem : I want to filter a big chunk of text with python, but all
the things I found were filtering by line, ie with "if line.startswith", and I
don't think I could do that here :/.
Here is my actual code :
... |
Parse childs in XML python
Question: I have a XML code like:
<?xml version='1.0' encoding="UTF-8"?>
<coureurs>
<coureur>
<nom>Patrick</nom><hair>Inexistants</hair>
</coureur>
</coureurs>
... |
Automation Microsoft SQL Server 2008 R2 using Python(pywinauto)
Question: I am creating **Microsoft SQL Server Management Studio** **Automation tool
using python**. The problem is I can't select the **Child_tree**(Northwind)
database It's selecting the **Parent_tree**(Databases). I need to do much
more, clicking the ch... |
Does the dill python module handle importing modules when sys.path differs?
Question: I'm evaluating dill and I want to know if this scenario is handled. I have a
case where I successfully import a module in a python process. Can I use dill
to serialize and then load that module in a different process that has a
differ... |
as_formula specifier for sklearn.tree.decisiontreeclassifier in Python?
Question: I was curious if there is an as_formula specifier (like in `statsmodels`) for
`sklearn.tree.decisiontreeclassifier` in Python, or some way to hack one in.
Currently, I must use
clf = tree.DecisionTreeClassifier()
clf = ... |
Android Socket client unable to send and receive messages
Question: I want to send and receive messages from my socket server which is created in
python on windows with the help of twisted API. My client is going to be my
android phone through I am going send my string messages. Here is my code. can
someone please help... |
Running bash commands from python script in certain directory
Question: I am trying to write a Python script to run recursively a program from bash in
multiple directories and save(now just display) output in log file.
The problem is that when I try to run that app from home directory just giving
the full path of inpu... |
Download CSV from an iPython Notebook
Question: I run an iPython Notebook server, and would like users to be able to download
a pandas dataframe as a csv file so that they can use it in their own
environment. There's no personal data, so if the solution involves writing the
file at the server (which I can do) and then ... |
Configuration file for Flask application
Question: _I'm new to Python, so please bear with me._
I am attempting to create a file in which to store my configuration settings
in a Flask project. However, I seem to be getting errors when I attempt to
import the file.
Here's my configuration file (location: `app/config.p... |
PS1() in Python like in Octave?
Question: I am taking an online machine learning course in Octave, and I am looking for
Python equivalents to Octave's commands. One such command is PS1(), which is a
function for changing the characters of the command prompt in Octave to a
passed string.
For example, the default prompt... |
Assign part of a string to a variable [Python]
Question: So I have the string:
[53,2]
And I want to seperate it so that:
x = 52
y = 2
Answer: Easy!
X, y = [53, 2]
Isn't Python fun?
If your object is actually a string and not a list, you can safely con... |
Unexpected error from sparse.spdiags()
Question: In Python 3 I am trying to run the following line of code to get a particular
sparse matrix.
`sparse.spdiags(np.concatenate((-np.ones((9,1)), np.ones((9,1))), axis=1), [0,
1], 9, 10)`
This gives the following error message:
Traceback (most recent call la... |
Include Python in Qt Creator
Question: I am trying to embed python in my c++ code in my qt project as per [this
tutorial](https://docs.python.org/2/extending/embedding.html). I am now
getting this error code: "error: undefined reference to `_imp__Py_Initialize'"
Before this, I had the same problem in CodeBlocks and fi... |
Python and Shapefile: Very large coordinates after importing shapefile
Question: I downloaded a shapefile of Boston and wants to plot it out using the code
below. However it's giving me an error `ValueError: lat_0 must be between
-90.000000 and 90.000000 degrees `
Turns out `coords` has values `(33869.92130000144, 777... |
Installed beignet to use OpenCL on Intel, but OpenCL programs only work when run as root
Question: I have an Intel HD graphics 4000 3rd Gen Processor, and my OS is Linux Mint
17.1 64 bit. I installed `beignet` to be able to use `OpenCL` and thus run
programs on the GPU. I had been having lots of problems using the `pyO... |
Learning Django Unit test of a Jsonresponse POST
Question: I've written a **view** to handle post and get request:
from django.http import JsonResponse, request
import json
def Dati(request):
if request.method == 'GET':
dati = externalfunction()
return JsonResponse(dati)
... |
IndentationError in python script for organising Music
Question: I have made this script in the past and I want to use it now, but an error
occurs when trying to run it. This script is about organising my music. I have
a directory organised by label and want to grab the artist name from the
directory names inside label... |
python inheritence call new url after overriding
Question: In the following code even after overiding the init function it still calls
the old url,i want the new url contents instead how to do this
import urllib
import json
class process():
def processdata(self):
... |
Python Only last line is written to file
Question: When I do print all my text is shown but when written to file only the last
step is written.
import json, urllib
from urllib import urlencode
import googlemaps
start = "Bridgewater, Sa, Australia"
finish = "Stirling, SA, Australia"
... |
Python not showing the [matplotlib] window with openCV results
Question: I'm working on OpenCV 2.4.9 . Below is my code -
import cv2
import numpy as np
from matplotlib import pyplot as plt
BLUE = [255,0,0]
img1 = cv2.imread( 'sachin.png' )
replicate = cv2.copyMakeBor... |
Evaluation float('inf') times symbolic variable with Python
Question: I need integrate `exp(-c1*r)`, with respect to `'r'` that goes from 0 to
infinity, where `'c1'` and `'r'` are symbols.
The problem seems to occur when evaluate `inf*c1` not equal to `inf`
import sympy
from sympy import *
... |
Initialise or append dictionary list in python
Question: Can the following code snippet be simplified into one statement somehow?
if aKey not in aDict:
aDict[aKey] = [someValue]
else:
aDict[aKey].append(someValue)
I could write a function accepting the `aDict`, `aKey` and `some... |
Python random generator not so random?
Question: Is the python random generator considered "good"? As in, does it simulate
randomness very well? I made a small program which simulates a person starting
at (0, 0) and taking a random step either east, west, north and south. As you
run simulations with larger and larger n... |
Python quits in PhotoImage
Question: The following code makes Python "quit unexpectedly" when trying to create the
PhotoImage instance (it prints 1 and quits). I'm on OS X 10.9.5, using Python
2.7.10, ActiveTcl 8.6.4 from ActiveState, running the script from IDLE using
Run / Run Module. Any clue? I'm totally new to Pyt... |
Python3 - installing Scapy in OS
Question: I installed the networking module **Scapy**. When I import scapy (`import
scapy`) everything works fine. When I import all from scapy (`from scapy.all
import *`), it brings up this error:
Traceback (most recent call last):
File "/Users/***/Downloads/test.py"... |
How to remove duplicate nodes xml Python
Question: I have a special case xml file structure is something like :
<Root>
<parent1>
<parent2>
<element id="Something" >
</parent2>
</parent1>
<parent1>
<element id="Something">
... |
How to format Json query results
Question:
#!/usr/bin/env python
import urllib2
import json
api_key = 'VtxgIC2UnhfUmXe_pBksov7-lguAQMZD'
url = 'http://www.energyhive.com/mobile_proxy/getCurrentValuesSummary?token='+api_key
response = urllib2.urlopen(url)
content = response.read()
for x ... |
IPython Notebook two functions that depend on value widget
Question: I have an IPython noteboook with **two widets** (`carW` and `speedW`) and
**two functions** (`print_car` and `print_car_and_speed`) that depend on the
values of the widget. What I'm trying to achieve is that the output of
`print_car` changes when the ... |
Boto3 to download all files from a S3 Bucket
Question: I'm using boto3 to get files from s3 bucket. I need a similar functionality
like `aws s3 sync`
My current code is
#!/usr/bin/python
import boto3
s3=boto3.client('s3')
list=s3.list_objects(Bucket='my_bucket_name')['Contents']
for key ... |
How to solve decoding while using stanford parser for Chinese text with python
Question: I want to use Stanford Parser to parse Chinese texts with Python interface. My
code is below:
#!~/anaconda/bin/python
# -*- coding: utf-8 -*-
from nltk.parse import stanford
parser = stanford.St... |
Insert tweet search result in mongodb with python
Question: I'm trying to insert tweet search results into MongoDB using following code:
import json
import tweepy
from pymongo import MongoClient
ckey = ''
consumer_secret = ''
access_token_key = ''
access_token_secret = '... |
Parsing file that has nested loop structures into list structure using python
Question: I am struggling to parse an FPGA simulation file (.vwf), specifically at the
point where the input waveforms are specified using a kind of nested loop
system. An example of the file format is:
TRANSITION_LIST("ADDR[0]... |
Trying to upgrade graphite and now it's not working properly
Question: I've tried to update graphite from version '0.9.10' to '0.9.13' and I broke
our graphite installation.
The problem is that the graph images no longer render but the tree view still
works and all the old data is still there.
The trace back I get is... |
Import modules from different folder (python)
Question: I have a folder, which contains two separate folders, one of which holds some
python modules, and the other one holds a python script that uses those
modules:
parentFolder/
lib/
__init__.py
readFile.py
writeF... |
python 2.7 - setting up 2 loggers
Question: I'me trying to setup 2 loggers, unfortunately one of them doesn't write into
the file, Here is a snippet of my code:
LOG_FILENAME = 'test.log'
LOG_FILENAME2 = 'test2.log'
error_counter = 0
error_logger = CustomLogger(LOG_FILENAME2, 'w', '%(asctime)s... |
How to get clean text from MediaWiki markup format using mwparserfromhell or a simple parser in python?
Question: I am trying to get clean sentences from the Wikipedia page of a species.
For instance _Abeis durangensis_ (pid = 1268312). Using the Wikipedia API in
python to obtain the Wikipedia page:
imp... |
Run command and get its stdout, stderr separately in near real time like in a terminal
Question: **Two answers were provided, one of which addresses the first two criteria and
will work well where you just need both the stdout and stderr using Threads
and Queue. The other answer uses select, a non-blocking method for r... |
Get Visio Shape.BoundingBox method with Python
Question: I am using Python with the win32com.client to get the page names and shapes
description for a Microsoft Visio drawing. The Python code below works for
getting the shape index, shape name and shape text. The command to get the
shape bounding box fails with an inva... |
Time and conditional statement is not working in python?
Question: What the purpose of this file is for, is to switch a Boolean to false when the
time (EST) is between 8 AM-11 PM.
import time as t
from datetime import datetime
while True:
t.sleep(1)
current_time = datetime.now().strftime(... |
Construct caffe.Net object using NetParameter
Question: From the
[documentation](http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1Net.html)
I thought there was a constructor taking a NetParameter argument,
> explicit Net(const NetParameter& param);
but when I try to use it like this:
import ca... |
How to deal with python import with custom API
Question: I created an API for my work. (python version 3.4) My API look like this:
* MyAPI
* `__init_.py`
* Communication
* `__init_.py`
* `SerialCom.py`
* JsonManager
* `__init__.py`
* `VersionHandler.py`
* Sessions
* `__init__.py`
... |
Unable to import os in Brython - TypeError
Question: I am trying to import the os module in Brython, but no matter what I do, no
matter what I try, I am unable to. I get the following error (in the Firefox
console):
"TypeError: obj is undefined for module os" brython.js:6329:21
"message: undefined" b... |
AttributeError when monkey patching an object in python
Question: I tried to monkey patch an object in Python.
class C:
def __init__(self):
self.__n = 0
def f(self):
self.__n += 1
def __str__(self):
return str(self.__n)
c... |
Why HTML convert python output '<' = <, '>' = >?
Question: I created a script who send mail whith a specific output took from a server. I
splited this output and each element I sent it to a html cell. I also created
a header for the table what is looks like that:
def get_html_table_header(*column_nam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.