text stringlengths 226 34.5k |
|---|
Debugging modifications of sys.path
Question: Some library seems to modify my `sys.path`, although I don't want ìt to be
changed.
How can I find the python code line which alters `sys.path`?
**Related**
* [Where does sys.path get replaced?](http://stackoverflow.com/questions/33212466/where-does-sys-path-get-replac... |
Why widgets declared later appear first?
Question: I am using Python's `tkinter` library to create a small GUI. The code of the
app is as follows :
import tkinter as tk
from tkinter import ttk
APP_TITLE = "HiDE"
class Application(tk.Frame):
"""This class establishes an entity for... |
Python: Finding text, transforming it, replacing it
Question: Can't seem to articulate this problem well enough to look this up. I'm looking
to use regular expressions to identify certain strings of text, transform
them, and then replace that string with the transformed text.
For instance: "Some random stock symbol: M... |
Python - My class raise ValueError, but it is not handled by except
Question: My Sample Code:
from tkinter import *
class first:
def __init__(self):
self.top = Tk()
...
def test(self):
try:
self.value = self.dict[key]
... |
python functions call in javascript autocomplete
Question: this is my views.py
from flask import Flask
app = Flask(__name__)
@app.route('/autocomplete')
*def get_contacts():*
cat_list = []
cat_list = contact.objects.all()
return dumps(cat_list)
... |
What is the best way to unconvert sanitized data?
Question: I have a very large set of data (one of stackoverflow's data dumps) which is
completely in raw and sanitized form.
For example: </p>
Is there an already established way to convert the above and similar back to
their original form fo... |
eBay LMS uploadFile - Cannot specify file with valid format
Question: I am attempting to use the eBay Large Merchant Services API to upload calls in
bulk. This API and documentation are notoriously bad (I found a blog post that
explains it and rails against it [here](http://medium.com/on-coding/dont-
write-your-api-thi... |
Python plot legend is not draggble. gives an error
Question: I have data and I am trying for produce the plot. It does produce plot but
legend is not draggable. It gives me an error mentioned below.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import ast
............. |
learning GUI with python (PyQt4) showmessage on statusbar
Question: I am learning python.I am new to it.
<http://zetcode.com/gui/pyqt4/firstprograms/>
Right now, I am trying to make calculator for exercise. I changed a bit of
sample program. But I got error.
Traceback (most recent call last):
Fil... |
Capturing raw packets into an output file through python script
Question: The script that i created receives raw tcp packets and capturing them in a
file. But the problem is it is not capturing into a file and throwing me an
error message: 'str' object has no attribute 'write'. Can someone tell me what
I am doing wrong... |
Python Requests - getting list of usable methods/URIs?
Question: I need to check how to make integration with one system, but there is no
documentation. The only thing I got, is an URL and user/password and that it
uses restful.
Is there a way to simply get list of methods/URIs with needed parameters that
can be used ... |
Python: How can I load a created class from a function?
Question: I'm quite new at this language and I've been facing the following trouble:
I have defined a class and I want to create multiple objects of that class
using a function, but this doesn't seem to work
class age:
def __init__ (self):
... |
Sparql query JSON error from BNCF endpoint
Question: I'm trying to retrieve results from the BNCF at [this
endpoint](http://digitale.bncf.firenze.sbn.it/openrdf-
workbench/repositories/NS_03_2014/query).
My query (with "ab" as example) is:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT D... |
Celery: how to separate different environments with different workers?
Question: I need to route all tasks of a certain django site instance to a certain
queue. My setup is as following:
* several webservers running a Django project (1.7)
* one server running celery workers (3.1.7)
* Three environments: producti... |
blinker does not work in Python 2.6
Question:
import blinker
from blinker import signal
class Ticket():
@classmethod
def update(cls):
pass
ticket_created = signal('CREATED')
ticket_created.connect(Ticket.update)
This snippet of code works well on Python 2.7. ... |
Reading txt files in python
Question: I'm currently following "Learn Python the Hard Way". However, when I use the
.read() command on my .txt files it outputs the text in a very weird way, with
extra spaces, and a square at the start:

The console is Win... |
How do I import a local module in a Mako template?
Question: Suppose we have a local python module in the same directory as a mako
template: `./my_template.mako ./my_module/module.py`
How do I import that module into a Mako template that is supposed to be
rendered from the command line using mako-render? The following... |
Python: parse xml file built up with dicts
Question: [Python 3.4][Windows 7]
If there is any easy way to get a whole .xml file like a .txt as one string,
that would be enough, but to describe the problem precisely:
This is the first time for me to deal with a .xml file. I have a .xml file
containing mainly dictionari... |
Relative imports and package structure in eclipse?
Question: I'm having trouble with relative imports, but I think its because i'm not
understanding package structure completely.
For example, here is my package structure.
neo_autorig/ Source folder, Top level
__init__.... |
Beautiful Soup 4 confusion
Question: I'm working on a little python program to get into web scraping:
from bs4 import BeautifulSoup
import requests
hero = raw_input("Enter Hero Name: ")
url = "http://www.dotahut.com/heroes/" + hero.lower().replace(' ', '_')
#to double check... |
Rolling window polynomial fit in pandas
Question: I am trying to compute coefficients from a _n_ -degree polynomial applied to a
_t_ -day window of a time series. However, I receive an exception `TypeError:
only length-1 arrays can be converted to Python scalars`.
My versions are:
* Python 2.7.8
* pandas version ... |
Accessing netflix api from python's urllib2 results in 500 error
Question: I'm currently trying to fix a Kodi plugin called NetfliXBMC.
It uses this url to get information on specific movies:
http://www.netflix.com/JSON/BOB?movieid=<SOMEID>
While trying to build a minimal case to ask this question... |
get hex from color name matplotlib
Question: I know this list of colors that matplotlib support:
<https://pythonhosted.org/ete2/reference/reference_svgcolors.html>
Is there a programmatic way to convert this names to hex ?
I would like a function that receive the color name and return the hex value
of this color.
T... |
Python BeautifulSoup City Scraping Complications
Question: I am attempting to scrape the countries and cities off craigslist and i am so
close.
The problem i am having is that the cities skip and go to the next box.
The output i am trying to achieve is:
COUNTRY | STATE | CITY
US: ... |
Extracting from HTML with beautifulsoup
Question: I try to extract lotto numbers from
<https://www.lotto.de/de/ergebnisse/lotto-6aus49/archiv.html> (I know there is
an easier way, but it's rather for learning).

Tried with Python, beautifu... |
importing and renaming multiple objects in maya with python
Question: I am trying to import multiple object files in maya using python and use the
file name as object name in maya. I have managed to import the objects, but I
have only been able to use the file name as a namespace and not as a object
name.
... |
How to make modules from exec("import xxx") in a Python function available?
Question: I have written myself a simple function that sieves through my Python folder
and look for where a possible module is. What I want to do is simple. I pass a
string of module import and the function will find the folder of the module,
c... |
OSError: cannot open shared object file: No such file or directory even though file is in the folder
Question: I've been fighting with this for quite some time now. I'm trying to install
Yaafe for audio feature extraction. I follow instructions here:
<https://github.com/Yaafe/Yaafe>
Everything installs up nicely, but ... |
Creating a Treeview with Checkboxes
Question: I am trying to build an application based on the following usage example ([How
to create a tree view with checkboxes in
Python](http://stackoverflow.com/questions/5104330/how-to-create-a-tree-view-
with-checkboxes-in-python)).
This example builds a `Treeview` with checkbox... |
Using PySide custom widgets in Qt Designer
Question: PyQt has a plugin system for adding python widgets to Qt Designer so that they
can be drag'n'dropped into the `.ui` files for other widgets.
<http://pyqt.sourceforge.net/Docs/PyQt4/designer.html#writing-qt-designer-
plugins>
How could this be done for PySide widget... |
How to convert an urlopen into a string in python
Question: Most certainly my question is not asked properly . Anyway, I am looking for a
way to convert some data I ve extracted from the web to a list or a string
(string would be better tho).
At the moment, this is what I wrote :
import urllib as web
... |
Is a list a variable?
Question: I am new to python and i was just reading up about lists. I have been trying
to find out if a list is a variable
e.g. Hello = []
This is because I read that you assign a variable by using the '=' sign. Or,
am I just assigning the empty list a name in the example abo... |
How do i load a specific column of information from a table into an array in Python?
Question: So, i'm supposed to load information from the SORCE database using a url with
variables for the begin and end date of information and then create an array
for the wavelength.
i'm saving the data using:
url ... |
Django Lint throwing error
Question: I installed Python Lint for static analysis of Python code
pylint --version:
No config file found, using default configuration
pylint 1.4.1,
astroid 1.3.4, common 0.63.2
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2]
I am current... |
Not able to import views in djano, but it works in django shell
Question: I have the following simple urls.py:
from django.conf.urls import patterns, include, url
from base import views
urlpatterns = patterns('',
url(r'^test$', 'views.test', name='test'),
)
And the followin... |
Regex for matching this string
Question: With python ( regex module ), I am triying to substitute 'x' for each letter
'c' in those strings occurring in a text and:
1. delimited by 'a', at the left, and 'b' at the right, and
2. with no more 'a's and 'b's in them.
Example:
`cuacducucibcl` -> `cuaxduxuxibcl`
How ... |
How to update my same csv file and use it for matching in python?
Question: There 2 csv files.My first task is to match the contents of both the files
with a specified keyword and create a new file with the keyword contents and
named as keyword.csv.It is working fine. Problem part:I want to use the
remaining.csv again ... |
Matplotlib Import Error : _backend_gdk.so:undefined symbol: PyArray_SetBaseObject
Question: I was trying to run the following code in OpenCV python.
#!/usr/bin/env python
import numpy as np
import time
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib import pyplot as pl... |
Python: random function from locals() with defined prefix
Question: I'm working on a textbased adventure and now want to run a random function.
All adventure function are "adv" followed by a 3 digit number.
If I run go() I get back :
IndexError: Cannot choose from an empty sequence
This is becaus... |
Python Pandas, is there a way to split a date_range into equally sized intervals?
Question: Im currently working on a project in Python (Pandas module). What I want to do
is split a date_range into equally sized intervals.
import pandas as pd
startdate='2014-08-08'
enddate='2014-08-11'
n=3
... |
quick sort list of tuple with python
Question: I am trying to do this in its operation algorithm quicksort to sort though the
elements of a list of tuples. Or if I have a list of this type [(0,1), (1,1),
(2,1), (3,3), (4,2), (5,1), (6,4 )] I want to sort it in function of the
second element of each tuple and obtain [(6... |
How to set the default encoding in a buildout script, or during virtualenv creation?
Question: I have a Plone project which is created by a `buildout` script and needs a
default encoding of `utf-8`. This is usually done in the `sitecustomize.py`
file of the Python installation. Since there is a `virtualenv`, I'd like t... |
Handling specific Python error within Bash call?
Question: I am using the `line_profiler`, which allows you to drop `@profile` decorators
anywhere in a python codebase and returns line output.
However, if you try to execute python code that contains one such `@profile`
decorator without loading this `line_profiler` mo... |
Running TextBlob in Python3
Question: I installed textblob using pip as given
[here](http://textblob.readthedocs.org/en/dev/install.html).
Now, when I try to import this in python3.4 in terminal then it says
ImportError: No module named 'textblob'
Whereas, in python2.7 it imports happily. I have t... |
matplotlib quiver 3d error
Question: I am running the quiver3d example given in the following tutorial
<http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html>
I am running python 'Python 2.7.6' on mac Yosemite with matplotlib 1.4.2
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compati... |
Tallying the outcome of a coin flip
Question: I have written a little piece of code for modelling the outcome of a coin
flip, and would like to find a better way of presenting the results than a
list of consecutive coin flips. I'm one month into learning Python as part of
my physics degree, if that helps provide some c... |
ImportError: No module named fixedpickle when running PyDsTool on Windows 7
Question: I have downloaded PyDsTool for Windows. And I believe I have pointed python in
the correct location. But I get the following error
from PyDSTool import *
Traceback (most recent call last):
File "<ipython-... |
Why does the AWS CLI pip package installation install a six package it can't use?
Question: Whenever I update my AWS CLI with
pip install -U awscli
it downgrades several packages (`colorama`, `dill`, `rsa`, and `websocket-
client`) and upgrades `six` to a version (1.9.0) that it can't use. After
up... |
Python classes with __hash__ support (depending on the instance)
Question: I have a mutable class in Python which I would like to be able to "freeze", at
that point its immutable, therefor can have a `__hash__` function.
My concern is, will having the `__hash__` function present will make Python
behave strangely becau... |
Remove duplicate lines from a string in python
Question: I have a string in python, and would like to remove duplicate lines (i.e. when
the text between \n is the same, then remove the second (third, fourth)
occurrence, but preserve the order of the string. for example
line1 \n line2 \n line3 \n line2 \n... |
Function attributes in Python
Question: I asked this question as continuation of [Limit function execution in
Python](http://stackoverflow.com/questions/28507359/limit-function-execution-
in-python)
I found a way to do it without threads etc. Just simple checking from time to
time.
Here is my decorator:
... |
Handle large output - Python
Question: I am using the python `boto` library to access files in a `S3` bucket. i have
all the output sorted out and works fine. however I dont want to display all
the files on the terminal at once. Say if a person has 800 files and 300
folders in their bucket, displaying all of them at on... |
how to set font for ipython matplotlib/pylab?
Question: I set my font for matplotlib to be a ttf through `~/.matplotlib/matplotlibrc`.
When I run:
` $ python myplot.py `
it uses the correct font. but if I do:
$ ipython --pylab Python 2.7.8 |Anaconda 2.1.0 (x86_64)| (default, Aug 21
2014, 15:21:46) Type "copyright", ... |
where Py_FileSystemDefaultEncoding is set in python source code
Question: i am curious about how python source code set the value of
Py_FileSystemDefaultEncoding. And i have receive a strange thing.
Since python
[doc](https://docs.python.org/2/library/sys.html#sys.getfilesystemencoding)
about sys.getfilesystemencoding... |
Change color of figures with PyOpenGL
Question: I have to do a basic program in Python using the library Opengl...when
somebody press the key 'r', the figure change to red, when somebody pressed
key 'g' change green and when somebody pressed 'b' change blue. I don't know
why the color doesn't change, but i know the pro... |
OpenShift repo not included in path
Question: I started a Django 1.7 OpenShift instance. When I have python print all of the
paths from `sys.path` I do not see `OPENSHIFT_REPO_DIR`
(`/var/lib/openshift/xxxxx/app-root/runtime/repo`).
When I use `https://github.com/jfmatth/openshift-django17` to create a project
I do se... |
How do I import pcap or pyshark on python
Question: I want to write the Ethernet packets capture while using python. I googling
and found that I should using Pcap library or PyShark but I try to import
pcap, it said that can not found module name Pcap, so I try to using PyShark
instance but it show like this on Python ... |
Pygame text not going away
Question: So I have been working on a game and for some odd reason down in the level1
function I thought if I had a while loop with leveltext1 = false then I could
write the text onto the screen, and then wait 2 seconds and then make
level1text = true and it would go away. I guess it didnt...... |
axes.fmt_xdata in matplotlib not being called
Question: I'm trying to format my X axis dates in a Django application where I'm
returning the graph in memory in a response object. I followed the same
example that I already use in an ipython notebook, and do this:
def pretty_date(date):
log.info("H... |
lxml.etree.XML ValueError for Unicode string
Question: I'm transforming [an
xml](https://gist.github.com/guinslym/5ce47460a31fe4c4046b#file-original_xml-
xml) document with
[xslt](https://gist.github.com/guinslym/5ce47460a31fe4c4046b#file-test_xslt-
xslt). While doing it with python3 I had this following error. But I d... |
How to save a changed item to an external file? (Python 3)
Question: I'm fairly new to python, but I'm making a script and I want one of the
functions to update a variable from another file. It works, but when I exit
the script and reload it, the changes aren't there anymore. For example (this
isn't my script):
... |
Fail Load Data Fixtures Django - integer out of range
Question: I'm developing app using Django and Postgre.
Basically, I create new model on my app.
from django.db import models
from manager.models.state import State
from django.contrib.auth.models import User
class Address (models.Mod... |
Making my own web crawler in python which shows main idea of the page rank
Question: I'm trying to make web crawler which shows basic idea of page rank. And code
for me seems fine for me but gives me back errors e.x.
`Traceback (most recent call last):
File "C:/Users/Janis/Desktop/WebCrawler/Web_cr... |
Problems with Python Wand and paths to JXR imagery when attempting to convert JXR imagery to JPG format?
Question: I need to be able to convert JPEG-XR images to JPG format, and have gotten
this working through ImageMagick itself. However, I need to be able to do this
from a python application, and have been looking at... |
Determine ROT encoding
Question: I want to determine which type of ROT encoding is used and based off that, do
the correct decode.
Also, I have found the following code which will indeed decode rot13 "sbbone"
to "foobart" correctly:
import codecs
codecs.decode('sbbone', 'rot_13')
The thing is ... |
Attempting to read data from multiple files to multiple arrays
Question: I would like to be able to read data from multiple files in one folder to
multiple arrays and then perform analysis on these arrays such as plot graphs
etc. I am currently having trouble reading the data from these files into
multiple arrays.
My ... |
Python: Printing letters one by one in Command Prompt
Question: Recently I've picked up Python 3.4 programming and I read this other question
regarding how to [print slowly in python, (Simulate
typing)](http://stackoverflow.com/questions/4099422/print-slowly-in-python-
simulate-typing), and used a similar def in my cod... |
Python and RabbitMQ - Best way to listen to consume events from multiple channels?
Question: I have two, separate RabbitMQ instances. I'm trying to find the best way to
listen to events from both.
For example, I can consume events on one with the following:
credentials = pika.PlainCredentials(user, pass... |
How to kill subprocess python in windows
Question: How would I go about killing a process on Windows?
I am starting the process with
self.p = Process(target=self.GameInitialize, args=(testProcess,))
self.p.start()
I have tried
self.p.kill()
self.p.terminate()
os.... |
How to compare cell_values with xlrd and calculate the difference between them in Python 3.4
Question: It's kind of long story, sorry. So as ive been teaching myself python I've
been wondering how I could apply what im learning to my everyday life or work
so im not just doing random exercises and tutorials. I figured i... |
List all installed packages in Ubuntu using python
Question: I am using python 2.7. How do I get a list of all installed packages in python
on Ubuntu
Answer: You need to import `subprocess` module.
>>> import subprocess
>>> subprocess.call('dpkg -l', shell=True)
|
file accessing in python
Question: i searched for the answer couldn't get it.
i have the following code,
filePointer = open(r'c:\temp\logFile.txt', 'w')
filePointer.write(str( datetime.datetime.now()) + 'entered into table \n' )
but before i enter the above line into file, i want to check if i... |
I can't connect to FDB database from Python
Question: I'm triyng to connect to Firebird DB from Python. I'm using FDB module.
import fdb
con = fdb.connect(host='10.7.0.115',database=r'C:\ProgramData\Entensys\UserGate6\USERGATE.FDB', user='SYSDBA', password='masterkey',charset='UTF8' )
c... |
python and error I"ndentationError"
Question: I have a sequence as follows:
>gnl|GNOMON|230560472.m Model predicted by Gnomon on Homo sapiens unplaced genomic scaffold, alternate assembly HuRef DEGEN_1103279082069, whole genome shotgun sequence (NW_001841731.1)
GCCGGCGTTTGACCGCGCTTGGGTGGCCTGGGACCCTGT... |
Check if file line sttime is older than 2 days - Python
Question: I have a series of entries in a text file like this:
20150217_00:47:32 - AAAAAA
20150217_00:47:32 - BBBBBB
20150217_00:47:32 - CCCCCC
I want to make a function that will periodically read each line in the file
and do somethin... |
index.wsgi not finding virtualenv in root
Question: I am trying to install a django site on an Apache VPS, following this
[tutorial](http://thecodeship.com/deployment/deploy-django-apache-virtualenv-
and-mod_wsgi/)
my index.wsgi should activate a virtualenv in the root, it looks like this:
import os
... |
How to run processes in the background and override standard streams
Question: I want to write a python script which should create a process **in the
background** , redirect its **stdin** , **stdout** and **stderr** for
communication with that process (this executable is my program) to a
**separate** virtual streams.
... |
Python: Remove the certain string from list if string includes certain keyword
Question: I am trying to exclude certain strings in the list of strings if the string
includes certain words.
For example, if there is a word, "cinnamon" or "fruit" or "eat", in the
string, I hope to exclude it from the list of strings.
... |
Python stopwatch example - starting all class instances at the same time?
Question: In this example how can I start all 4 stop watches at the same time?
This example code is over 12 years old but it is the best stopwatch example I
have been able to find via Google. You can see that I have 4 instances of the
class in u... |
Working with dates in Access using pyodbc giving "Too few parameters" error
Question: I am using Python with a pyodbc import.
I am using Microsoft Office 2013 64bit.
I am attempting to query an accdb database to select distinct dates within a
range and assign them to a cursor so I can then append them to a list.
My ... |
Problems saving cookies when making HTTP requests using Python
Question: I‘m trying to make a web-spider using python but I've got some problems when I
tried to login the web site Pixiv.My code is as below:
import sys
import urllib
import urllib2
import cookielib
url="https://www.sec... |
Write numpy array to wave file in buffers using wave (not scipy.io.wavfile) module
Question: This caused me a day's worth of headache, but since I've figured it out I
wanted to post it somewhere in case it's helpful.
I am using python's wave module to write data to a wave file. I'm NOT using
scipy.io.wavfile because t... |
random number and tkinter not working
Question: i'm new to python as i've only used it for 4 months, im trying to program a
tkinter window in which a label displays a random number ever second i have
this so far:
from tkinter import *
from random import *
testy = "0"
root = Tk()
lbl = Lab... |
Not understanding the row-key in Python API of Hbase
Question: I have a hbase table (`customers`) in the following form:
hbase(main):004:0> scan 'customers'
ROW COLUMN+CELL ... |
Walk through each column in a numpy matrix efficiently in Python
Question: I have a very big two-dimensions array in Python, using `numpy` library. I
want to walk through each column efficiently and check each time if elements
are different from 0 to count their number in every column.
Suppose I have the following mat... |
Saving a Python dictionary in external file?
Question: I'm working on a code that is essentially a super basic AI system (basically a
simple Python version of Cleverbot).
As part of the code, I've got a starting dictionary with a couple keys that
have lists as the values. As the file runs, the dictionary is modified -... |
How to make python setuptools find top level modules
Question: I have a package with a structure that would (simplified) look like:
mypackage/
__init__.py
setup.py
module1.py
module2.py
mysubpackage/
__init__.py
mysubmodule1.py
m... |
Python: Remove the certain string from list if string includes certain keyword v.2
Question: I am trying to make a code to exclude certain keywords in the string from the
list of strings. This morning with help from stackoverflow, I could add the
code that can exclude certain strings which include the certain keywords.... |
Python global empty in class
Question: I tried to get array parameters values in another class , where and why i
wrong here ?
> My second python file => myModule.py :
parameters = ([])
class MyFirstClass():
def __init__(self, params):
global parameters
parameters... |
urllib not taking context as a parameter
Question: I'm trying to add the sssl.SSlContext to a urlopen method but keep getting the
error:
TypeError: urlopen() got an unexpected keyword argument 'context'
I'm using python 3 and urllib. This has a context parameter defined -
<https://docs.python.org/2... |
How can I plot an axis on MatPlotLib in terms of text, not numbers, taken from a CSV file?
Question: I have a .csv file that looks something like this (small sample, disregard the
periods):
Year | Month | Carrier | Elapsed Time
1987 | 10.......|UN.......|15
1987 | 11.......|AM.......|17... |
django <-> node.js fast communication
Question: I tried `requests` but it seems slow because of the tcp connection takes long
(I don't know how to keep the socket open)
I'm now trying `zerorpc` and it has notion of `persistent connection`.
Django <-> node.js communication works fine for the first message but it fail... |
Dictionary for finding orientation of the words
Question: I am looking for a dictionary that finds the
orientation(positive/negative/neutral) of the words as part of analyzing the
sentiment of the phrase. Preferably a source that can be imported into python
code
Answer: You seem to be looking for something like
[Opin... |
Generate an OAuth2 token in a view
Question: Let's say I have an AngularJS application that consumes the REST API of a
Django application.
The Django application has got a built-in OAuth2 provider that can be called
to retrieve an access token and use the protected endpoints of the API. This
provider is using `django-... |
Can I take a screenshot on a windows machine that is running without a monitor?
Question: I have a bank of virtual machines (running windows) that I remote into. As
such, none of these machines have a monitor attached, they are only accessed
by Remote Desktop.
I want to get a screenshot of an application that is runni... |
Prefer BytesIO or bytes for internal interface in Python?
Question: I'm trying to decide on the best internal interface to use in my code,
specifically around how to handle file contents. Really, the file contents are
just binary data, so bytes is sufficient to represent them.
I'm storing files in different remote loc... |
Numpy Not Allowing Use of Python 'Sum' Function?
Question: I just installed Pylab and Matplotlib to create a graph that is all working
fine. Then I went to open another python file for my program and noticed an
error:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\numpy\... |
Write image to webpage with python 3
Question: I have currently got this code set up:
import time
import http.server
import socketserver
import mimetypes
import os
HOST_NAME = 'localhost'
PORT = 8000
def load(self):
wi... |
importing package and modules from another directory in python
Question: I have a bunch of python scripts in the path
/home/yotam/Applications/pyFoo
one of them is `__init__.py` which, to my understanding, turns the `pyFoo`
folder into a package. The folder also has a `src` subfolder, which stores ... |
Save results in the files with same name as input files
Question: I am working on a python code which is as follows:
import os
count = 0
for doc in os.listdir('/home/krupa/Krupa/Mirellas_Image_Annotation_Data/Test/Html_Files/Texts'):
if doc.endswith(".txt"):
with open(doc, 'r') a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.