text stringlengths 226 34.5k |
|---|
Searching for key words in python
Question: If I ask a question in Python and the answer is `chicken`, I want to output
something related to chicken. And, if the answer is `beef` I want to output
something related to beef, dependent on the answer provided.
How could I structure this? Should I have multiple lists with ... |
Regex doesn't return all img tags - Python
Question: I have a python script that downloads the html and the images shown in the
html so I can open the file locally.
It works fine, the only problem is, there is a certain div in which the images
don't get downloaded/found by the regex. I have no idea why tho. It's not a... |
run bash command in python and display on browser
Question: I have this simple python code:
import os
#os.system ("bash -c 'ls /home/'")
script = "ls /home/user/"
os.system(script)
How do I use PHP to display the output?
Answer: Not with HTML, but using PHP first you can output to HTM... |
How to use windows authentication to connect to MS SQL server from windows workstation in another domain with Python
Question: I'm trying to connect to `SQL server 2000` installed on `Windows server 2003`
from `Windows Server 2008 R2` using `Python 3.4` and `pyodbc` module. Those
servers are in different AD domains. `W... |
Django migrations throw 1072 - key column 'car_make_id' doesn't exist in table
Question: Here's simplified task and setup (Django 1.8, MySQL, Python 2.7), I've got:
class Car(models.Model):
make = models.ForeignKey(CarMake)
class Bike(models.Model):
make = models.ForeignKey(BikeM... |
python turtle graphics window won't open
Question: I have little piece of code from a tutorial which should work fine but I don't
get the turtle graphics window to show (I'm on Windows 10 using python
2.7.10). The code looks like this
import turtle
def draw_square():
window = turtle.Scre... |
How do you remove a middle initial from a name in python?
Question: I'm trying to figure out something that seems like it should be simple. I'm
trying to remove the middle initial from names, but I'm not sure how to do it
without making a replace() for every letter of the alphabet. This is what I'm
looking for:
(Start... |
Python - Script that appends rows; checks for duplicates before writing
Question: I'm writing a script that has a for loop to extract a list of variables from
each 'data_i.csv' file in a folder, then appends that list as a new row in a
single 'output.csv' file.
My objective is to define the headers of the file once an... |
math.log(x) returns unexpected results in Python
Question: I am attempting to do some basic dB calculations using Python. If I use either
Excel or a scientific calculator:
20*log(0.1) = -20
in Python:
20*log(0.1) = -46.0517018599
to simplify further, Excel and Scientific calc:
... |
Problems with decoding bytes into string or ASCII in python 3
Question: I'm having a problem decoding received bytes with python 3. I'm controlling an
arduino via a serial connection and read it with the following code:
import serial
arduino = serial.Serial('/dev/ttyACM0', baudrate=9600, timeout=20)
... |
Unable to store terminal output of subprocess with python
Question: My code has two potential outcomes in the terminal: `Can't connect RFCOMM
socket: Permission denied` and `Can't connect RFCOMM socket: Host is down`. I
need to store either result as a string in a variable, but everything I've
tried has failed. This is... |
IPython scripting - Exit script with status code
Question: I am trying to use ipython to script git pre-commit hooks since it has a nice
syntax to run shell commands and converting the stdout result into a list of
strings (which makes for easy processing).
I need to return a status code != 0 from the ipython script so... |
How to install mysql-connector for python 3.5.1?
Question: I'm on python 3.5.1 and I am having trouble installing mysql connector:
install --allow-external mysql-connector-python-rf mysql-connector-python-rf
is not working, neither is the normal pip command for mysql-connector-python-
rf. I am gett... |
Building a generic XML parser in Python?
Question: I am a newbie and having 1 week experience writing python scripts.
I am trying to write a generic parser (Library for all my future jobs) which
parses any input XML without any prior knowledge of tags.
* Parse input XML.
* Get the values from the XML and Set the ... |
How to group words whose Levenshtein distance is more than 80 percent in Python
Question: Suppose I have a list:-
person_name = ['zakesh', 'oldman LLC', 'bikash', 'goldman LLC', 'zikash','rakesh']
I am trying to group the list in such a way so the [Levenshtein
distance](https://en.wikipedia.org/wik... |
how to write a matrix to a file in python with this format?
Question: I need to write a matrix to a file with this format `(i, j, a[i,j])` row by
row, but I don't know how to get it. I tried with: `np.savetxt(f, A,
fmt='%1d', newline='\n')`, but it write only matrix values and don't write i,
j!
Answer:
import nu... |
Python 2.7 : LookupError: unknown encoding: cp65001
Question: I have installed python 2(64 bit), on windows 8.1 (64 bit) and wanted to know
pip version and for that I fired `pip --version` but it is giving error.
C:\Users\ADMIN>pip --version
Traceback (most recent call last):
File "c:\dev\p... |
Python parse XML from online web service
Question: I have been trying to use python to parse an XML that I get from a webserver.
The link to the XML is <http://gagnaveita.vegagerdin.is/api/faerd2014_1>. It
does not matter which library I use I always end up with really weird results,
it doesn't parse and the file. Also... |
Python circular imports with inheritance
Question: I have a parent and child class, where a parent's method returns an instance
of the child. Both classes are in separate files `classA.py` and `classB.py`.
In order to avoid circular imports when I import `classA` I added the `classB`
import to the end of `classA.py` (a... |
How to dynamically modify CSS using Python?
Question: I'm creating a Flask-based web app. I need to modify the CSS of an element
dynamically.
To be more specific, I have a file that I want to read from Python. Based on
what I read from the file, I want to modify the CSS of an element. Just to
give you an idea,
... |
Matlab installation (LD_LIBRARY_PATH) messes up other library files
Question: I am trying to install Matlab on a Linux machine, but setting LD_LIBRARY_PATH
(as the installation requires) breaks other library files. I am not an Linux
expert, but I have tried several things and cannot get it working correctly. I
have eve... |
pyspark json not working
Question: I am trying to parse [json
data](http://%7B%20%20%20%22hash%22:%220000000000000000059134ebb840559241e8e2799f3ebdff56723efecfd6567a%22,%20%20%20%22branch%22:%22main%22,%20%20%20%22previous_block_hash%22:%220000000000000000010d1517398ca2c64b055aa00ce04bcc36a0fc66fc12e76a%22,%20%20%20%22... |
Efficient Vector Bit-Data "Rotation" / "Rearrangement" in Memory [e.g. in Python, Numpy]
Question: How does one efficiently convert from an 8 element long array of e.g. uint8s
into a its "rotated" counterpart, were e.g. the original 8bits of the first
element are spread across all vector elements as the MSB, and the se... |
How to fetch a file name automatically in to a data frame instead of manually specifying it
Question: I am trying to automate my spark code in Scala or python and here is what I am
trying to do
Format of files in s3 bucket is filename_2016_02_01.csv.gz
From s3 bucket the spark code should be able to pick the file nam... |
Python - check for multiple items in 2d array
Question: I have looked around but cannot find anybody asking what I'm trying to do:
Let me give you a bit of background:
I am making an game in python where the player moves around the grid searching
for treasure chests, and I am trying to randomly generate 10 chest loca... |
How to combine records based on date using python connected components?
Question: I have a list of records (person_id, start_date, end_date) as follows:
person_records = [['1', '08/01/2011', '08/31/2011'],
['1', '09/01/2011', '09/30/2011'],
['1', '11/01/2011', '1... |
audio over python tcp error
Question: I am writing a simple python tcp code to send over a wav file however I seem
to be getting stuck. can someone explain why my code is not working correctly?
Server Code
import socket, time
import scipy.io.wavfile
import numpy as np
def Main():
ho... |
Having trouble changing background color in Python
Question: I'm practicing coding in Python. Here is what I am testing and messing around
with.
import tkinter as tk
from tkinter import ttk
class gui_programming(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self,... |
Can A Python Program Open An Text File On The Web?
Question: I am making a program, and was wondering if a .txt file can be hosted on the
web and be accessed by the open() function. Does anyone know about this?
Answer: You can't use `open()`, but you could use the [`requests`](http://docs.python-
requests.org/en/mast... |
Value error while generating indexes using PCA in scikit-learn
Question: Using the following function i am trying to generate index from the data:
Function:
import numpy as np
from sklearn.decomposition import PCA
def pca_index(data,components=1,indx=1):
corrs = np.asarray(data.c... |
turtle module seems to lack turtle.demo()
Question: When I try to do the following in python 2.7.8 shell:
>>> import turtle
>>> turtle.demo()
I get the following error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
turtle.demo()
Attr... |
eliminate text after certain character in python pipeline- with slice?
Question: This is a short script I've written to refine and validate a large dataset
that I have.
# The purpose of this script is the refinement of the job data attained from the
# JSI as it is rendered by the `csv generator` cont... |
ConfigParser and Scrapy: NoSectionError
Question: I have a issue with my Scrapy crawler when I launch it.
I used ConfigParser in order to have a small config.ini to set my table name
which i create each time i launch the crawler to scrap. That a basic way to
scrap but i'm still noob with scrapy and python
I get the f... |
Wrapping a commandline program with pstream
Question: I want to be able to read and write to a program from C++. It seems like
pstream can do the job, but I find the documentation difficult to understand
and have not yet find an example.
I have setup the following minimum working example. This opens python, which
in t... |
How to randomly pick numbers from ranked groups in python, to create a list of specific length
Question: I am trying to create a sequence of length 6 which consists of numbers
randomly picked from ranked groups. _The first element of the sequence has to
be drawn from the first group, and the last element has to be draw... |
set up trac with wsgi
Question: I have followed the following steps
1. downlaod trac 1.0.9
2. install using `python2.7 ./setup.py install` . this is a altinstall of python on centos 6 64 bit
3. created repository on `trac-admin operationalintelligence initenv`
4. trying to set up apache but not working
I have... |
Python specific format output with itertools.product
Question: I am trying with a code as given below .
import itertools
f=[[0], [2], [3]]
e=[['x']if f[j][0]==0 else range(f[j][0]) for j in range(len(f))]
print(e)
List1_=[]
for i in itertools.product(e):
List1_.append(i)
pri... |
What is wrong here? (Attribute Error __len__)
Question:
import Tkinter
class buttton(Tkinter.Button):
def __init__(self,frame,action=None):
if action==None:
action=self.action
Tkinter.Button.__init__(self,frame,command=action)
self.pack(frame)
... |
unicode text to Japanese text for Rakuten Web service API
Question: Hi I'm using Rakuten Web service API to play around with it in Ipython
Notebook. I successfully loaded the product ranking data using this url
([https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927?format=json&applicationId=10743933561818... |
python sort itemgetter equivalent for N-dimensional nested lists
Question: To sort a nested 2D list (list2D) by the nth element of the second dimension
in python 2.7 I can use
import operator
sorted(list2D, key=operator.itemgetter(n))
How can I sort the second dimension of a 3D list (list3D) ba... |
Correct Regex for Acronyms In Python
Question: I want to find so called Acronyms in text is this the correct way of defining
the regex for it? My idea is that if something starts with capital and ends
with capital letter it is acronym. Is this correct?
import re
test_string = "Department of Something... |
Python: how to retrieve some values from the elements of a list?
Question: I have a list of elements like this:
`mylist=['event_100of1000', 'event_17of1000', 'event_1000of1000',...]`
How can I extract the "number" of the event only and produce another list, in
the likes of:
`extracted_list=['100','17','1000',...]`?
... |
ImportError: No module named eventlet
Question: I have installed eventlet library in python using : `pip install eventlet`.
But when I tried to import eventlet this error occured:
$python
Python 2.7.10 (default, Oct 23 2015, 18:05:06)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] o... |
Beautiful soup and bottlenose, how to parse correctly
Question: I am currently trying to extract strings from the response of a bottlenose
amazon api request. Without wanting to cause [Russian hackers to pwn to my
webapp](http://stackoverflow.com/questions/1732348/regex-match-open-tags-
except-xhtml-self-contained-tags... |
Trouble with raspberry pi and OpenCV
Question: I have a project in raspberry pi and I am using python. However I have a
problem with the OpenCV when I am trying to run this code:
`import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-fram... |
Can't figure out why numpy.log10 outputs nan?
Question: So I have an 500k array of floating values. When I am trying to:
np.log10(my_long_array)
270k numbers getting replaced to nan, and they are not that small. For
example:
In [1]: import numpy as np
In [2]: t = -0.05548889... |
Python script not able to read user input when run remotely
Question: I am trying to remotely execute a simple python script userinfo.py present in
remotehost.
Below is sourcecode of userinfo.py [ using Python 2.7.10 ]
#############
print "Userinfo :"
name=raw_input("Enter your name")
age=ra... |
Python unit test: testcase class with own constructor fails in standard library
Question: I have this plain vanilla unit test, which works as expected, as long I leave
out the constructor.
import sys
import unittest
class Instance_test(unittest.TestCase):
def __init__(self):
... |
Can't get Spark to work on IPython Notebook in Windows
Question: I have installed spark on a Windows 10 box, and the installation works fine
from the Pyspark console. But recently I have tried to configure Ipython
Notebook to work with the Spark installation. I have made the following
imports
os.environ[... |
PyQ5t: load Qt Designer into Python script (loadUiType): how to check error cause?
Question: I design GUI in Qt Designer, then I load UI-file in my Puthon3 script with the
loadUiType method:
class Main(QMainWindow, uic.loadUiType("adc_main_form.ui")[0]):
def __init__(self):
super(Main, self).... |
Correctly installing pyOpenSSL for Python (Windows)
Question: I'm trying to make an application that automatically updates a Google Plus
spreadsheet. In order to do this I had to set up `gspread`, which also
requires pyOpenSSL in order to work. Without it, it throws this error:
> CryptoUnavailableError: No crypto libr... |
ENML to plain text converter for Python
Question: Port enml library from javascript (enml.js)
ENML.PlainTextOfENML for evernote-sdk-js works good for me and I would like to
find a good port of this tool for Python.
I tried to use these library's, but got an errors:
<https://github.com/CarlLee/ENML_PY>
ImportEr... |
Weighted smoothing of a 1D array - Python
Question: I am quite new to Python and I have an array of some parameter detections,
some of the values were detected incorrectly and (like 4555555):
array = [1, 20, 55, 33, 4555555, 1]
And I want to somehow smooth it. Right now I'm doing that with a weight... |
NET-SNMP + Python Mac Address shows as \x00\
Question: Hey Im trying to get the MAC-address via ipNetToMediaPhysAddress which works
fine when using the netsnmp.snmpget command but when saving that into a
variable(tuple?) and printing it out via "print" the mac-address looks like
this.
('\x00\n\xb7\x9c\x93\x80',)
Code... |
How to access c++ object methods from inside vector with SWIG Python
Question: I have two C++ classes: Foo and Bar. The constructor for Foo looks like this:
Foo(std::vector<Bar *> * bars);
The constructor for Bar and one of its member functions are the following:
Bar(int data)
in... |
Parsing HTML in Python - Some pages work and some don't...?
Question: Using the following script:
from lxml import html
import requests
gameUrl = 'http://store.401games.ca/catalog/2415520/caylus'
page = requests.get(gameUrl)
tree = html.fromstring(page.content)
stock = tree.... |
Easy way to tell apart python multiprocessing's OS processes
Question: **Summary**
I'd like to use the Python multiprocessing module to run multiple jobs in
parallel on a Linux server. Further, I'd like to be able to look at the
running processes with `top` or `ps` and `kill` one of them but let the others
run.
Howev... |
My code failed to iterate on somesection of the code
Question: I have this python function code that suppose to balance up the number of
"bracket" in any parameter supply. Though, it work well with require problem
in the exercise but when the parameter contain 4 or more bracket the function
failed to balance it up. bel... |
GZip: Python - How to get the file name of a particular line using gzip.open
Question: I have a '.tgz' file, I'm reading the content of the '.tgz' file using
gzip.open. What is the fastest way to get the file name of a particular line?
with gzip.open('sample.tgz','r') as fin:
for line in fin:
... |
Raising exception in a generator, handle it elsewhere and vice versa in python
Question: I'm thinking in a direction more advanced as well as difficult to find
solutions this problem. Before coming to any decision, I thought of asking
expert advice to address this problem.
The enhanced generators have new methods .sen... |
Wagail one page with different content
Question: I am new to Wagtail and python, so could apprectiate some help with my
problem.
I have a web app (wagtail web site + rest api backend).
On my website I have 2 pages:
* HomePage with list of accessible objects (e.g. photos)
* PhotoPage with a detailed information o... |
Python email - 8bit MIME support
Question: I'm writing a simple MUA application, and I have a troubles with generating
message.
I want to my program automatically detect whether the SMTP server supports
`8bit MIME`, and if yes, then it'll generate a message, where the part with
plain text will be encoded on 8bits. In ... |
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/w9/1zsm5zp53jn8c0n0l4zrhzj40000gn/T/pip-build-mphahblv/http
Question: I have problem while trying to install package **http** using pip3:
$ pip3 install http
result is:
Collecting http
Using cac... |
Python - Creating an .ini or config file in the user's home directory
Question: This is probably a simple answer but I'm **really** new when it comes to
Python. I've been given existing code, and I'm trying to create a config file
for it, whereas previously it had everything hardcoded. I want to have a
`default` config... |
rename files with list of special characters in python
Question: What's an efficient way to remove a list of special characters from a
filename? I want to replace 'spaces' with '.' and '(', ')', '[',']' with '_'.
I can do it for one, but I'm not sure how to rename multiple characters.
import os
impor... |
Odoo - Python | File name too long, when processing images
Question: today I was making some code that will resize a few images that already been
uploaded. It is actually a def function and called when the button is pressed
on the Odoo web client.
Code:
@api.multi
def resize_image(self):
for r... |
ValueError: Found arrays with inconsistent numbers of samples [1,299]
Question: Here is data files
[here](https://d3c33hcgiwev3.cloudfront.net/_3e251a91db9262835c9e5855ae9e6573_perceptron-
test.csv?Expires=1454976000&Signature=Qn~RxsR1tlP2pruLzkiIaAVO988Q2RaY1A9DEOINYYSJGRtX7pssvFc-09rbyWLwGrzdaAg5wAf0dXWyA6DPaJ2cBjcKu... |
div tag not populating, using selenium python, inner HTML
Question: I'm trying to access what appears to be a hidden table within a div tag on the
following page:
[whoscored.com](https://www.whoscored.com/Matches/959574/LiveStatistics/England-
Premier-League-2015-2016-West-Bromwich-Albion-Stoke)
...under the link "Pa... |
Inconsistent results when concatenating parsed csv files
Question: I am puzzled with the following problem. I have a set of csv files, which I
parse iterativly. Before collecting the dataframes in a list, I apply some
function (as simple as `tmp_df*2`) to each of the `tmp_df`. It all worked
perfectly fine at first glan... |
convert python script to exe and run as windows service
Question: I just created an python script that solve me a problem i need but i want to
convert this script to exe file to run it in any windows machine without need
of install python on it I have search of how could i convert the py to exe and
run it and i have fo... |
Django upload and process file with no data retention
Question: Python: 2.7.11
Django: 1.9
I want to upload a csv file to Django and analyze it with a Python class. No
saving is allowed and the file is only needed to reach the class to be
analyzed. I'm using Dropzone.js for the form but I don't understand how I
shoul... |
How to pass params to a ML Pipeline.fit method?
Question: I am trying to build a clustering mechanism using
* Google Dataproc + Spark
* Google Bigquery
* Create a job using Spark ML KMeans+pipeline
As follows:
* * *
1. Create user level based feature table in bigquery
Example: How the feature table looks ... |
Passing custom arguments to a Blender Operator as if it were a function
Question: I created a python script in Blender which obtains information about an
object. Said information is then stored in a list of numpy arrays for later
use. Initially, I wanted to use that information to have the camera move in a
certain way,... |
migrating to mysql in django
Question: I want to migrate from sqlite3 to mysql in django. I used this command:
python manage.py dumpdata > datadump.json
after that I changed setting of my django server and configured it with my new
mysql database and then used following command:
pyth... |
Browser() in Python shows errors in IDLE
Question: I have some code here which is basically a bot that spams a specific google
form:
while True:
browser = Browser()
print("Form Filling Begun")
browser.visit('https://docs.google.com/forms/d/1Lyoox1FIpOP5nceVHqmdA3Exqf8PMCxaBgWIYQ67... |
Key echo in Python in separate thread doesn't display first key stroke
Question: I would try to post a minimal working example, but unfortunately this problem
just requires a lot of pieces so I have stripped it down best I can.
First of all, I'm using a simple script that simulates pressing keys through a
function cal... |
Python - Exclude contents of one file from another / removing duplicate lines amongst two files
Question: first off, i'm using python 2.7.9 ..... now, i'm trying to find the most
efficient way to compare the lines of one text file (file A) to the lines of
another text file (file B) and write all lines that are unique t... |
How to link html files together using Django 1.9?
Question: I am currently programming in the atom code editor and python 3.4.0 as well as
Django 1.9. I am new to django coding.
[](http://i.stack.imgur.com/z5o1S.... |
Change information in a CSV file using info from the first one in python
Question: I'm trying to edit a CSV file using informations from a first one. That
doesn't seem simple to me as I should filter multiple things. Let's explain my
problem.
I have two CSV files, let's say patch.csv and origin.csv. Output csv file
sh... |
"SSLError certificate verify failed" for every domain/url
Question: I broke the SSL setup of my machine. Every `request` call now ends in an
`certificate verify failed`.
I am not sure what caused this, but I moved some module, that I had installed
va `pip install -e .` and reinstalled it. After that I noticed that err... |
How does process join() work?
Question: I am trying to understand multiprocessing in Python, I wrote the following
program:
from multiprocessing import Process
numOfLoops = 10
#function for each process
def func():
a = float(0.0)
for i in xrange(0, numOfLoops):
... |
NameError: guesses not defined
Question: I'm just starting out on python and I'm wondering exactly why my variable
guesses is not defined. I feel as if it's a indentation issue but once I
change the indentation I usually come upon a syntax error any help
understanding this issue would be greatly appreciated.
... |
PyGTK in webbrowser?
Question: I use PyGTK quite a lot, and my code is hosted on
[github](https://github.com/ralphembree). I know that there are many websites
that can run Python code, but I was hoping that maybe there is a website that
can handle the new windows created in my code in the browser, so that people
could ... |
Use Python to search and pull data from Excel
Question:
import csv
subject = ['emergency*', 'new ticket*', 'problem with*']
from_to = ['chris*', 'timothy*', 'daniel*', 'david*', 'jason*']
a = open('D:\testfile.csv', 'w')
New to python. So, here's what I'd like to do.
1) Open an excel c... |
Python - sorting a list of tuples by an uneven list
Question: I have a deck of cards built by the following code:
import itertools
suits = "DCHS"
ranks = "23456789TJQKA"
cardDeck = list(set(itertools.product(ranks, suits)))
I want to sort the deck of card by ranks. Doing a sor... |
Import WeakMethod error in Django 1.9 with python 3.3
Question: I'm using django 1.9.1 with python 3.3. Getting following error when I'm
running runserver
File "/home/virtualenv/python3.3.5/lib/python3.3/site-packages/django/dispatch/__init__.py", line 9, in <module>
from django.dispatch.dispatcher i... |
In Python, can I define an instance method map() for the list class?
Question: I was hoping to define an instance method `map()` or `join()` for the list
class (for array). For example, for `map()`:
class list:
def map(self, fn):
result = []
for i in self:
... |
Integrating Behave or Lettuce with Python unittest
Question: I'm looking at BDD with Python. Verification of results is a drag, because the
results being verified are not printed on failure.
Compare Behave output:
AssertionError:
File "C:\Python27\lib\site-packages\behave\model.py", line 1456, in... |
Display an image with Python
Question: I tried to use IPython.display with the following code:
from IPython.display import display, Image
display(Image(filename='MyImage.png'))
I also tried to use matplotlib with the following code:
import matplotlib.pyplot as plt
import matp... |
Crossbar 0.12.1 : No module named django - wsgi error
Question: I get an error while i launch crossbar 0.12.1 that I did not have with the
version 0.11
[Controller 210] crossbar.error.invalid_configuration:
WSGI app module 'myproject.wsgi' import failed: No module named django -
Python search p... |
Understanding @property decorator and inheritance
Question: Python 3 here, just in case it's important.
I'm trying to properly understand how to implement inheritance when
`@property` is used, and I've already searched StackOverflow and read like 20
similar questions, to no avail because the problems they are trying t... |
Call program from subprocess.Popen in python: `OSError: .. No such file or directory`
Question: I run the following command from my bash script:
myProgram --name test1 --index 0
But now I want to run it from within a python script so I have tried the
following:
#!/usr/bin/python
... |
What's the advantage of putting nginx in front of uWSGI?
Question: I see a lot of people running their python app, with nginx, which then
communicates to nginx. uWSGI can run directly as a web server, and it looks
quite fast and scalable, so what's the purpose of putting nginx in front of
that?
Answer: [uWSGI documen... |
no module named fuzzywuzzy
Question: I installed fuzzywuzzy with pip for python3. When I do pip list I see
fuzzywuzzy (0.8.1)
However when I try to import is I get an error.
Python 3.4.0 (default, Jun 19 2015, 14:20:21)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits... |
osx install packages inside virtualenv
Question: I tried to start virtualenv WITHOUT sudo but unfortunately it cannot find
(Permission denied) /lib/python2.7/site-packages/easy_install.py. So I did:
sudo virtualenv name_env
The problem is that now pip is the global version (not inside pip): which p... |
random.sample in Python 3 (jupyter notebook)
Question: When using Canopy I can do
from scipy import *
import pylab as py
import random
aa = random.sample(arange(1,4,0.5),1)
whereas in the Jupyter notebook it complaints with the following:
--------------------------... |
Python mysql connector returns tuple
Question: I am connecting to mysql database via mysql connector and running a simple
query to pull a list of IDs. I need to loop over that list and pass them into
some other code. For some reason I am getting a list of tuples. Is this
expected behavior? If not, what am I doing wrong... |
Boto DynamoDb - JSONResponseError: 400 Bad Request - really weird behaviour
Question: I'm working with the Boto DynamoDb2 API and I'm experiencing something really
strange. First off, I'm using an IAM Role for authentication and the code I'm
about to show is being run on an EC2 instance with the attached Role. The Role... |
How to redirect C-level streams in Python in Windows?
Question: Eli Bendersky has explained thoroughly how to "[Redirecting all kinds of
stdout in Python](http://eli.thegreenplace.net/2015/redirecting-all-kinds-of-
stdout-in-python/)", and specifically Redirecting C-level streams, e.g. stdout
of a shared library (dll).... |
How to separate warnings from errors found in stderr when using Popen.communicate?
Question: I used Python's
[`subprocess.Popen`](https://docs.python.org/3/library/subprocess.html#subprocess.Popen)
to execute a command and capture its output:
p = Popen(cmd, stdout=PIPE, stderr=PIPE,shell=True)
stdout... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.