text stringlengths 226 34.5k |
|---|
Find ports a program uses with python
Question: I want to find the ports used by 'plugin-container.exe' so I can monitor what
IP addresses interact with that program, The problem is there are two 'plugin-
container.exe's. I use Firefox Developer Edition.
I already have the monitoring part down but I need to automate g... |
How to read the file which is in other directory?
Question: My project
et->datacollector
->eventprocessor->multilang->resources->python->tenderevent->rules->Table.py
->target->inpout->Read.csv
Table.py
import pandas as pd
df_LFB1 = pd.read_csv('Read.cs... |
Why the frame area drawed by the pyplot is black?
Question: My test codes are
import numpy as np
import time
import matplotlib
from matplotlib import pyplot as plt
def run(genxy, style='point'):
fig, ax = plt.subplots(1, 1)
#ax.set_aspect('equal')
ax.set_xlim(... |
subprocess use two way, but result is not same
Question: I use `subprocess`'s `check_output()` function two ways,find the result are
different, I don't known why.
1. First way:
from subprocess import check_output as qc
output = qc(['exit', '1'], shell=True)
2. Second way:
from s... |
To detect digits from an image using cv2 and python
Question: I am trying to detect digits located inside a grid and to tell their positions
in an image and don't know where to start. So any help is welcome. So far I
have used GT Text software but it didn't solve the purpose. Any helper
function, libraries, tutorials, ... |
How can i covert a 3x3 grid from python to tkinter
Question: SO I have this piece of code and it only prints out in the python shell, I
would like to know how I can get the words and put them into a grid using
labels in tkinter. Sorry for my lack of explanation.
import random
with open('Words.txt... |
On Ctrl-d, call Close() like with file objects happen
Question: I've [wrote a
class](https://github.com/srgblnch/scpi/blob/master/scpi/scpi.py) that
inherits from _object_ and has instances of sub-objects that uses some
_threads_ for tasks. There are two socket _listeners_ that creates other
threads for each _accept_ e... |
Progress bar while uploading a file to dropbox
Question:
import dropbox
client = dropbox.client.DropboxClient('<token>')
f = open('/ssd-scratch/abhishekb/try/1.mat', 'rb')
response = client.put_file('/data/1.mat', f)
I want to upload a big file to dropbox. How can I check the progress?
[[Docs]](h... |
Python subprocess check output not working
Question: I'm trying to run my test_script.py in main_script.py with subprocess.
test_script.py is a siple sum program, and main_script.py should call it with
2 arguments, and catch output. Here is the code:
**test_script.py**
a = int(input())
b = int(input... |
Which character encoding is the IPython terminal using?
Question: I used to think I had this whole encoding stuff pretty figured out. I seem to
be wrong because I can't explain what's happening here.
What I was trying to do is to use the
[`tabulate`](https://pypi.python.org/pypi/tabulate) module to print a nicely
form... |
How to make a variable equate to another variable (Python)
Question: I don't even know how to explain this one.
Question1 = "a"
Question2 = "b"
Question3 = "c"
Question4 = "d"
Question5 = "e"
etc.
Answer1 = "a"
Answer2 = "b"
Answer3 = "c"
Answer4 = "... |
Image conversion Function using python and open
Question: Recently I have started learning opencv and python for image processing .I am
facing problems with writing a function .
I was given a task as follows:
_Write a function in python to open a color image and convert the image into
grayscale._
_You are required t... |
Why is the program taking so much time even after threading?
Question: I have been trying to look up for active hosts connected to a gateway with
specific masks, but it is taking a lot of time even after threading. Also the
total host are not showing correct.
CODE is:
import subprocess, sys, threading, ... |
python, importing function from other file which uses variable in the functions file
Question: I currently have a python program which imports a function from a file, but
this function uses a variable which is stored in the file the functon is
called from.
The code for the main function:
from second_fil... |
Python: How to send message to client from server at any time?
Question: I'm building a discussion board style server/client application were the
client connects to the server, is able to post messages, read messages, and
quit.
See client code below:
import socket
target_host = "0.0.0.0"
ta... |
Need to set up a GUI that shows output from Pocketsphinx on Raspberry Pi 2 using Python
Question: I need to set up a GUI that simply shows the output of Pocketsphinx on
Raspberry Pi. I have installed Pocketsphinx and can run it from command line,
but am not quite clear on how to set up the GUI. I have been using Python... |
Python parsing the lines from a file
Question: New to python. I'm reading from file line by line:
with open("graph.txt", "r") as f:
comList = f.readlines()
print(comList)
edge_u = [x[0] for x in comList]
edge_v = [x[1] for x in comList]
graph.txt has :
> [(0, 7), (1... |
compling python 3.5 program with pyinstall - missing tkinter
Question: I am trying to compile a python 3.5 program, which uses tkinter as a GUI. To
do that I am using pyinstall, but I run into a problem during compliation
process I get warning messages" tkinter not found" and the program does not
work afterwards (as a ... |
Python HTML to Text File UnicodeDecodeError?
Question: So I am writing a program to read a webpage using urllib, then using
"html2text", write the basic text to a file. However, the raw contents given
from urllib.read() has various characters, so it would continuously raise
_UnicodeDecodeError_.
I of course Googled th... |
Got a TypeError of the upload form in Django
Question: Now I want to add a form which is to update the existing lyrics for users.
Here is my code:
urls.py:
from django.conf.urls import url
from . import views
from django.conf import settings
urlpatterns = [
url(r'^$', views.lyric_list, ... |
Trying to add string to float variable in tkinter label/entry widgets
Question: I'm hoping to get some guidance on an issue I've been spending far too much
time trying to solve. Every time I find a solution another problem takes its
place.
My aim is to 'simply' do some basic maths on some figures and then add a '$'
at... |
Why python executable opens new window instance when function by multiprocessing module is called on windows
Question: Short Question: Why python executable generated by pyinstaller opens new
window instance when function by multiprocessing module is called on windows
operating system
I have a GUI code written using p... |
Can't run a linux .sh script with python subprocess?
Question: I am trying:
import subprocess
subprocess.call(["file.sh"])
But I keep getting:
Traceback (most recent call last):
File "project.py", line 85, in <module>
subprocess.call(["file.sh"])
File "/usr/lo... |
Python, Imagemagick, and subprocess call
Question: Trying to use a subprocess call in a python script to run an Imagemagick
command. **I installed imagemagick in /usr/local/Cellar, so I tried two
options** since it looked like it wasn't finding the convert command.
By the way, the 'convert' command is an imagemagick o... |
python lxml not showing all content
Question: I am trying to scrape a specific section of a web page, and eventually
calculate word frequency. But I am finding it difficult to get the entire
text. As far as I understand from looking at the HTML code, my script omits
the part of that section that are in a break line but... |
Appending to a list gives 'int' object has no attribute 'append'
Question: My question was to make a python program that fills the main diagonal of a
square matrix with its row number and the right to left diagonal with its
column number. The rest of the elements of the matrix are initialized to the
sum of indexes of t... |
Python sorting files in a folder error
Question: I have a folder where I have names as
file_1.txt,file_2.txt,file_3.txt,file_10.txt,file_100.txt.
I am reading these files using os.walk.i want print file names in a sorted
order.My code is as follows:
import os
import fnmatch
r... |
issue in encoding non-numeric feature to numeric in Spark and Ipython
Question: I am working on something where I have to make predictions for `numeric` data
(monthly employee spending) using `non-numeric` features. I am using `Spark
MLlibs` `Random Forests algorthim`. I have my `features` data in a `dataframe`
which l... |
Print a big integer with punctions with Python3 string formating mini-language
Question: I want a point after each three digits in a big number (e.g. `4.100.200.300`).
>>> x = 4100200300
>>> print('{}'.format(x))
4100200300
This question is specific to Pythons string formating mini-language... |
hide chromeDriver console in python
Question: I'm using chrome driver in Selenium to open chrome , log into a router, press
some buttons ,upload configuration etc. all code is written in Python.
here is the part of the code to obtain the driver:
chrome_options = webdriver.ChromeOptions()
prefs = {"d... |
lambda in for loop only takes last value
Question: **Problemset:**
Context Menu should show filter variables dynamically and execute a function
with parameters defined inside the callback. Generic descriptions show
properly, but function call is always executed with last set option.
**What I have tried:**
... |
Python List interpretation (w/ Turtles)
Question: Little python question, how to make the turtle move according to `[(160, 20),
(-43, 10), (270, 8), (-43, 12)]` where the first number is the angle turned
and the second is distance traveled.
My attempt:
print('Question 11')
import turtle
wn ... |
Import a Python module when using WSGI
Question: I just installed WSGI on Apache to start using Python as a web programming
language. I only added this line to my Apache config (except for the loading
of the `mod_wsgi` module)
WSGIScriptAlias MyApp/ /path/to/app.wsgi
I have my `app.wsgi` running fi... |
Python context manager that measures time
Question: I am struggling to make a piece of code that allows to measure time spent
within a "with" statement and assigns the time measured (a float) to the
variable provided in the "with" statement.
import time
class catchtime:
def __enter__(sel... |
Interactive labels on nodes using python and networkx
Question: I am trying to make a graph using python with networkx which has many nodes
that can be interactively investigated. I want to be able to click or hover
above a node and reveal a label which is otherwise not shown.
[D3](http://d3js.org/) seems able to do t... |
python distance formula coordinate plane error
Question: My goal is to make a circle shape out of lines in pygame, using random
endpoints around the edge of a circle and a constant starting point (the
middle of the circle). So I decided that I would give the pygame.draw.line
function: screen, aRandomColor, startingPosi... |
Map object is not JSON serializable
Question: This happens when returning a `JSONResponse`, which was added in Django 1.7.
and is a wrapper around `json.dumps`. However, in this case it results in an
error. I'm sure the data is correct and can be serialized to JSON through
Python shell.
What is the right way to serial... |
How to run two non-terminating scripts in parallel in a GUI?
Question: I know I can easily do this manually by opening two terminal windows. I am
trying to automate the process as much as possible by creating a GUI with two
buttons. One to connect and run the listener, and one to run the talker.
This is my code:
... |
CentOS 6.7, python distutils and bloody brp-python-bytecompile
Question: I am trying to get python distutils to build me an RPM. This is proving to be
very difficult tho!
On my mac everything works fine, but on CentOS 6.7 (my CI server) it doesn't
due to the differences RPMs are built for different platforms.
On Ce... |
NameError: name "webdriver" is not defined
Question: I have create a python script which requires the webdrive. In my code I have
imported it like so, `from selenium import webdriver`.
I went to their website
[here](https://pypi.python.org/pypi/selenium#downloads) downloaded and ran
setup.py but still does not import ... |
Removing Characters from python Output
Question: I did alot of work to remove the characters from the spark python output like
**u u' u" [()/'"** which are creating problem for me to do the further work.
So please put a focus on the same .
I have the input like,
(u"(u'[25145, 12345678'", 0.0)
(u"(... |
Error in Reading a csv file in pandas[CParserError: Error tokenizing data. C error: Buffer overflow caught - possible malformed input file.]
Question: So i tried reading all the csv files from a folder and then concatenate them
to create a big csv(structure of all the files was same), save it and read it
again. All thi... |
Convert exception to string in Python 2.7
Question:
import httplib
webservice = httplib.HTTPSConnection(host)
# ....
try:
webservice.endheaders()
except Exception, exc:
handle_failure(request, exc_str=unicode(exc))
The exception contains:
> error(110, 'Die Wartezeit f\xc... |
importing module with same name as file
Question: I want to import logging <https://docs.python.org/3/library/logging.html> into
a document named logging.py . When I try to import logging.handlers though, it
fails because I believe it's searching the document for a handlers function,
instead of importing from the modul... |
Indexing through a list in python
Question: I have a list that I'm trying to loop through and index the number of each
number in the list. The total list is around 1500-2000 numbers where each
number represents subject behavior. I imported the list of numbers via an
excel sheet:
import openpyxl
from ... |
Telnet from inside a telnet session (Python)
Question: I am trying to telnet to a remote device from another remote device, doing a
nested telnet using telnetlib. While I can easily communicate with the first
device, I am not able to get the output from the second device. Below is my
code, am I doing this correctly?
... |
Theano -- Unresolved symbol when multiplying two matrices. All works for vectors and tensor3
Question: When I try to run the following code:
a = T.matrix('a')
b = T.matrix('b')
f = theano.function([a, b], T.batched_dot(a,b))
f([[1, 2], [5, 6]],[[3,4],[7,8]])
I get the following error an... |
Uploading a zip file in python flask without form
Question: I'm trying to upload a zip file to my server using python flask request and
then unzip it using zipfile module.
Here is my code:
@app.route('/uoload', methods=['POST'])
def upload ():
data = request.data
current_path = ... |
iPython/jupyter qtconsole fails to start in anaconda 2.4.0
Question: After upgrading Anaconda3 (32-bit) from version 2.3.0 to 2.4.0 (by
reinstalling Anaconda) on my Windows 7 64-bit machine, the iPython/jupyter
qtconsole fails to start: when executing `jupyter-qtconsole.exe` or `jupyter-
qtconsole-script.py`, the follo... |
Python Requests - Azure Graph API Authentication
Question: I am trying to access the Azure AD Graph API using the Python requests
library. My steps are to first get the authorization code. Then, using the
authorization code, I request an access token/refresh token and then finally
query the API.
When I go through the ... |
CSV file with random double quotes
Question: I have a CSV file that has a double quote character in some fields. When
parsing with Python, it begins ignoring the delimiter in between these quotes.
For instance:
5695|258|03/21/2012| 15:16:02.000|info|Microsoft-Windows-Defrag|shrink estimation, (C:)|36|"6y... |
Django get class from string
Question: I'm looking for a generic way in Python to instantiate class by its name in
similar way how it is done in Java without having to explicitly specify the
class name in IF..ELIF condition.
This is because I have several different models and serializers and want to
make them addressa... |
UDP connection do not receive any reply from server - Python (potentially also c++ using boost)
Question: I am trying to establish a connection to a server, and send some data to it.. The problem is that, if i try to debug the connection using this MICHAEL SIEGENTHALER | TCP/UDP Debugging Tools which clearly shows that... |
scikit-neuralnetwork mismatch error in dataset size
Question: I'm trying to train an MLP classifier for the XOR problem using sknn.mlp
from sknn.mlp import Classifier, Layer
X=numpy.array([[0,1],[0,0],[1,0]])
print X.shape
y=numpy.array([[1],[0],[1]])
print y.shape
nn=Classifier(layer... |
Reconcile np.fromiter and multidimensional arrays in Python
Question: I love using `np.fromiter` from `numpy` because it is a resource-lazy way to
build `np.array` objects. However, it seems like it doesn't support
multidimensional arrays, which are quite useful as well.
import numpy as np
def f... |
Multiple assignment from a function
Question: In Python, is it possible to make multiple assignments in the following manner
(or, rather, is there a shorthand):
import random
def random_int():
return random.randint(1, 100)
a, b = # for each variable assign the return values from... |
Django: 'WSGIRequest' object has no attribute 'PUT'
Question:
def my_view(request, someid=None):
if request.method == 'GET':
# do stuff
return HttpResponse({})
elif request.method == 'PUT':
print request.body
print request.PUT
pr... |
Python Pattern Design
Question: I'm trying to achieve the pattern below.
Got as far as doing the first line, then I have no clue how to code the rest
of the pattern.
[](http://i.stack.imgur.com/96C7z.png)
Here's what I've done so far:
#Timothy Shek
... |
How to list commits unique to a branch using Dulwich
Question: If I have two release branches v1.25 and v1.25-SOC how to I get commits only
in v1.250-SOC and I want to do this for every branch (get only branch specific
commits in git). I use dulwich python library.
Main idea is I want to find commits which are first c... |
Check if String is a concatenation of elements in a list
Question: Is there an elegant way (preferably pythonic too) to check if a String _s_ is
a concatenation of elements of a subset of set _L_? An element of _L_ may
appear more than once in _s_.
For example:
L = set(["a", "ab", "c", "e"])
Then ... |
Sorting JSON response with Python
Question: Need to help to figure out how to sort JSON reponse by highest to lowest
number, for example. here is part of JSON reponse below:
{
"queue": "RANKED_SOLO_5x5",
"name": "Riven's Cutthroats",
"entries": [
{
"leaguePoints": 812,
... |
How to scatter plot a dict of lists containing arrays in Matplotlib? (Screenshot in details)
Question: What I want to do is plotting data in a _dict_ , preferably using Matplotlib.
Below is a screenshot since I think looking at the data structure makes it
easier to understand. But here is also a description.
* A _di... |
How to do One Hot Encoding for Linear Regression in Spark with Python?
Question: I have this code which I had written for `Random Forest regression` encoding.
But `Random Forest regression` does not require `One Hot Encoding` after
`indexer`. Now I want to try the `Linear Regression` which requires `One Hot
Encoding`. ... |
How to loop through a dataframe, create a new column and append values to it in python
Question: I have the following problem. I have a dataframe with several columns, one of
those contains strings as values. I want to loop through this column, change
those values and save the changed values in a new column.
The code ... |
How to create json file having array in Python
Question: I want to create a json file like
{
"a":["12","34","23",...],
"b":["13","14","45",....],
.
.
.
}
key should come from the list:
lis = ['a','b',...]
and value from the sql query "select id from" + i... |
python pyparsing word excludeChars
Question: I am trying to make a parser for a number which can contain an '_'. I would
like the underscore to be suppressed in the output. For example, a valid word
would be 1000_000 which should return a number: 1000000. I have tried the
excludeChars keyword argument for this as _my u... |
python ISO 8601 date format
Question: i'm trying to format the date like this,
2015-12-02T12:57:17+00:00
here's my code
time.strftime("%Y-%m-%dT%H:%M:%S%z", time.gmtime())
which gives this result,
2015-12-02T12:57:17+0000
i can't see any other variations of %z that can provide the correct forma... |
encoding issue when reading CSV file with python
Question: I have hit a road block when trying to read a CSV file with python.
UPDATE: if you want to just skip the character or error you can open the file
like this:
with open(os.path.join(directory, file), 'r', encoding="utf-8", errors="ignore") as data... |
Whats wrong with the image scaling in igraph?
Question: I have a problem in controlling the size of objects in network plots done by
igraph. The documentation of the `plot` command says:
* **bbox:** : The bounding box of the plot. This must be a tuple containing the desired width and height of the plot. The default ... |
Python Clustering 'purity' metric
Question: I'm using a [Gaussian Mixture Model (GMM)](http://scikit-
learn.org/stable/modules/generated/sklearn.mixture.GMM.html) from
`sklearn.mixture` to perform clustering of my data set.
I could use the function `score()` to compute the log probability under the
model.
However, I ... |
Simple migration to __init__.py
Question: I'm upgrading a bunch of scripts where the ecosystem is a bit of a mess. The
scripts always relied on external modules, and didn't have any package
infrastructure of their own (they also didn't do much OOP, as you can
imagine). There's nothing at the top level, but it is the wo... |
Event listener in python script on a server
Question: I want to write a python script to run on a server that will be checking for
changes on a database (e.g. total number of records), and when one occurs it
will perform an action.
I am new in python and I don't know how I should approach this, is there a
proposed eve... |
Read numbers without spaces in text-file with ython
Question: I'm a newbie with Python and struggle to read a text file like this:
0.42617E-03-0.19725E+09-0.21139E+09 0.37077E+08
0.85234E-03-0.18031E+09-0.18340E+09 0.28237E+08
0.12785E-02-0.16583E+09-0.15887E+09 0.20637E+08
There are ... |
python count keywords in a python file without counting inside quotation marks
Question: For example:
import codecs
def main():
fileName = input("Please input a python file: ")
file = codecs.open(fileName, encoding = "utf8")
fornum = 0
for line in file:
... |
Python Requests, getting back: Unexpected character encountered while parsing value: L. Path
Question: I am attempting to get an auth token from The Trade Desk's (sandbox) api but I
get back a 400 response stating:
> "Error reading Content-Type 'application/json' as JSON: Unexpected character
> encountered while parsi... |
Python xlrd returns a no attribute error
Question: I'm trying to get a list of list with the values of certain cells within my
xlsx worksheet but when I run it, it says there is no attribute called value.
when I run the code without the ".value" method it will return a list of lists
formatted the way I want but they al... |
Get drag-n-drop qtreewidget items - Python
Question: Is there a way I can get the items being drag/dropped and their destination
parent?
In an ideal scenario what I want to happen is once the **dropEvent** finishes,
it prints the qtreewidgetitems which were moved, as well as the new parent
which the items were moved t... |
Python module not callable when importing getopt
Question: I am new to python and the getopt function. I am trying to import getopt,
however I run into an error.
My code is literally just:
import getopt
and also tried
from getopt import * /// from getopt import getopt
Output... |
Passing Arguments from Javascript to Python Function
Question: I am trying to execute/call a python method(with one parameter) from inside
Ajax Call. But I am having trouble passing the parameter from Ajax Call to
Python Function. I am using Flask to connect the two.
Updated Code: Ajax Call(Javascript):
... |
Django debug toolbar import error of analysisdebug_toolbar
Question: Trying to install the django debug toolbar and receiving the following error:
Traceback (most recent call last):
File "/home/user/project/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/u... |
csv, python, update line
Question: I am looking to update specific lines of a csv as I run through them in a for
loop. For example:
line_of_csv = "item1,item2"
for row in csv: if action: #line of code to write "action occurred" output:
(for lines that action occurred: "item1,item2,action occured") (for lines that
act... |
Best way to receive the 'return' value from a python generator
Question: Since Python 3.3, if a generator function returns a value, that becomes the
value for the StopIteration exception that is raised. This can be collected a
number of ways:
* The value of a `yield from` expression, which implies the enclosing func... |
How can I extract specific elements out of a unstructured list and put them into a dataframe using Python
Question: I have a long list of strings and I want to extract only rows that have
"Town":"Some City" & "State":"Some State" and then put those values into a
dataframe with town and state as column headers. I've cop... |
String format function does not parse my slashes character?
Question: I am doing a small python script to perform a wget call, however I am
encountering an issue when I am replacing the string that contains the url/ip
address and that it will be given to my "wget" string
import os
import sys
... |
Python - Finding keywords in a CSV
Question: Okay, so basically, I have this project to create a troubleshooting program
for an electronic device. It asks which device you have, so for example phone,
then asks for the make, model, etcetera..
I then want the program to ask, 'What is the problem', which is fine, but I
w... |
Python call URL with key=value pairs
Question: Since I do my first steps in Python, I try to figure out, how can I do a
simple URL call in Python with key=value pairs like:
http://somehost/somecontroller/action?key1=value1&key2=value2
I tried with some things like:
key1 = 'value'
... |
Django S3BotoStorage __init__ override error , "has no attribute 'rsplit'"
Question: The last lines of the trace:
File "/usr/local/lib64/python3.4/site-packages/django/core/files/storage.py", line 328, in get_storage_class
return import_string(import_path or settings.DEFAULT_FILE_STORAGE)
... |
lxml can not parse xml (wether encoding is utf-8 or not) [python]
Question: My code:
import re
import requests
from lxml import etree
url = 'http://weixin.sogou.com/gzhjs?openid=oIWsFt__d2wSBKMfQtkFfeVq_u8I&ext=2JjmXOu9jMsFW8Sh4E_XmC0DOkcPpGX18Zm8qPG7F0L5ffrupfFtkDqSOm47Bv9U'
r ... |
Why does heroku local:run wants to use the global python installation instead of the currently activated virtual env?
Question: Using Heroku to deploy our Django application, everything seems to work by the
spec, except the `heroku local:run` command.
We oftentimes need to run commands through Django's manage.py file.... |
Can't use lable in gtk3
Question: I can't use lable in gtk3(python3), it does not work and does not give an
error.
This is my try:
from gi.repository import Gtk
window = Gtk.Window(title="About")
window.set_border_width(10)
window.connect("destroy", lambda w: Gtk.main_quit())
hbox = Gtk.... |
No module name celery with uWSGI and Python3
Question:
Traceback (most recent call last):
File "./fb_archive/__init__.py", line 5, in <module>
from .celery import app as celery_app
File "./fb_archive/celery.py", line 5, in <module>
from celery import Celery
ImportError: No module na... |
How do I change directory in python so it remains after running the script?
Question: I'm trying to change the terminal directory through a python script. I've seen
this [post](http://stackoverflow.com/questions/431684/how-do-i-cd-in-
python/431715 "post") and others like it so I know about os.chdir, but it's
not worki... |
python 3 make subsection for configparser
Question: I'm trying to convert one open source project from Python 2 to Python 3
Project uses configobj module which is not supported for Python 3.
Project uses subsections in config file.
How to realize similar functionality with configparser module?
e.q. configfile.txt is... |
Python XPath : Is it possible to have optional XPath query?
Question: i have the following way of parsing an xml
import re
from lxml.html.soupparser import fromstring
inString = """
<doc>
<q></q>
<p1>
<p2 dd="ert" ji="pp">
<p3>1</p3>
... |
Understanding "Bitwise-And (&)" and "Unary complement(~)" in c++
Question: I have some trouble understanding `Bitwise-And` and `Unary Complement` when
both are used in this code snippet
if((oldByte==m_DLE) & (newByte==m_STX)) {
int data_index=0;
//This below line --- does it returns t... |
No module named django.core.wsgi with nginx, uwsgi and virtualenv
Question: uwsgi.ini
[uwsgi]
vhost = true
plugin = python
socket = /tmp/pjwards.sock
master = true
enable-threads = true
processes = 2
wsgi-file = /home/ubuntu/workspace/ward/www/fb_archive/wsgi.py
virtualenv... |
Connecting to MongoDB remotely and getting ServerSelectioinTimeoutError
Question: New to MongoDB here and I'm having some trouble connecting to the server. I
get the error ServerSelectionTimeoutError: xxx.xxx.xxx.xxx:27017:timed out
I'm using PyMongo 2.8 on OSX 10.10.
import sys
sys.path.append('/us... |
Python: itertools.product consuming too much resources
Question: I've created a Python script that generates a list of words by permutation of
characters. I'm using `itertools.product` to generate my permutations. My char
list is composed by letters and numbers
**01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRS... |
POS tagging using spaCy
Question: I am trying to do POS tagging using the spaCy module in Python.
Here is my code for the same
from spacy.en import English, LOCAL_DATA_DIR
import spacy.en
import os
data_dir = os.environ.get('SPACY_DATA', LOCAL_DATA_DIR)
nlp = English(parser=False, t... |
Python stuck in a single thread of a multi-threaded program
Question: I'm currently writing a program that is attempting to synchronize a visitor,
car, pump, and gas station thread at a zoo where guests arrive, wait for an
available car, take a tour, then exit, the cars must refuel every 5 rides, and
the gas station mu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.