text
stringlengths
226
34.5k
Google App Engine Guestbook application gives error Question: I upload the Google App Engine application which is at the url developers.google.com/appengine/docs/python/memcache/usingmemcache#Memcache When I run the application on Google App Engine Launcher, it runs but the website shows: (First error is there us no P...
Mutable objects in python and constants Question: I have a class which contains data as attributes and which has a method to return a tuple containing these attributes: class myclass(object): def __init__(self,a,b,c): self.a = a self.b = b self.c = c ...
parsing MySQL database with python MySQLdb to extract hashtags Question: I have tweets scraped in MySQL database and I manage to connect to it and query for column that contains tweets' text. Now what I want to do is parse this and extract hashtags into a csv file. So far, I have this code that is working until the la...
Importing module from relative path Question: I'm looking for some advice on a python issue I am having. I am a novice at python. I believe that I am relying on my programming experience from other languages to make this work and I have finally come to a stand-still. Here is the scenario, I am importing a module that r...
Pass a file as a parameter in two Python Scripts Question: New Python'er has a question _"hand raised"_. I have two Python Scripts and a XML file. "mysecondpython.py" needs to call "myfirstpython.py" with a parameter of "data.xml" so that it can write something in, which then returns a file. From command-line, I shou...
Matplotlib + Ubuntu + GTK3 no plot shown Question: I can see the GUI but not the plot. No errors, even the mouse coordinates are okay, but no plot using import matplotlib.pyplot as plt plt.plot([1,2,3,4]) plt.ylabel('some numbers') plt.show() Then $ python -c 'import matp...
parsing JSON which contains "objects" Question: I'm getting data from an application that returns what seems to be an JSON, but with some "objects". For instance: {"rgEvtData":[new VisData(0,0,1,0,1,0,0,0,0,-1),new VisData(0,1,1,1,1,0,0,0,0,-1),new VisData(0,2,1,2,1,0,0,0,0,-1),new VisData(0,3,2,0,1,0,0,...
randomly choose from list using random.randint in python Question: How to use `random.randint()` to select random names given in a list in python. I want to print 5 names from that list. Actually i know how to use `random.randint()` for numbers. but i don't know how to select random names from a given list. we are no...
Python: Get Twitter Trends in tweepy, and parse JSON Question: _Ok, so please note this is my first post_ So, I am trying to use Python to get Twitter Trends, I am using python 2.7 and Tweepy. I would like something like this (which works): #!/usr/bin/python # -*- coding: utf-8 -*- import tweep...
Calculating mean of sample in monte carlo simulation Question: I did a Monte Carlo simulation of n samples. For each sample i, I need to calculate the value Xi so probably, the results that I will obtain is: > X = [X1, X2, ..., Xn] (Here Xi can be a matrix or number). Now I want to calculate the mean of theses sampl...
Drawing tangent plot in Python (matplotlib) Question: Today I decided to write simple program in Python, just to practice before exam. Firstly, I wanted to draw sin and cos plot, which wasn't so hard. But then, I decided to challenge myself and draw tangent plot. import pylab as p x= p.arange(-1...
Python-social, Django-nonrel, and GAE fighting over files, python-tk Question: I'm trying to host a Django app on Google App Engine, so I'm using [Django nonrel](https://github.com/django-nonrel/django) and following [these instructions](http://www.allbuttonspressed.com/projects/djangoappengine). Now, trying to get [Py...
Validating SAML signature in python Question: I need to implement authentication in python from a 3rd party by using SAML2. I have looked into [pysaml2](https://pypi.python.org/pypi/pysaml2/1.1.0) and found that to be quite confusing, and decided to give [M2Crypto](https://pypi.python.org/pypi/M2Crypto) a chance after ...
How to remove trailing `\r` in shell? Question: I have a file that looks like this: 1 0.1951 0.1766 0.1943 0.1488 0.1594 0.2486 0.2044 0.2013 0.1859 0.1559 0.1761 0.1666 0.1737 0.1595 0.1940 1 0.2398 0.1894 0.1532 0.1749 0.2397 1 0.1654 0.1622 0.1940 ...
How to generate HTML color diff from git using python Question: So I figured out creating HTML git diff i can embed in email but don't know why is it all being spit in one line ? here is how I did it!! import sys import subprocess import os from ansi2html.converter import Ansi2HTMLConve...
Calculate the greatest distance between any two strings in a group, using Python Question: My question is how to calculate greatest distance between any two strings that correspond to a certain group. Each line in my file starts with a 'group number' followed by a long string. I want to know, for each group, what the g...
Python - step through list -TypeError: 'int' object is not iterable Question: Trying to learn python, I am trying to do: list0=['A','B']; list1=['C','D']; z=0 while z < 2: for q in list(z): print q z += 1 I would like it to print A B C ...
Error while installing Fabric on OSX using recommended pip. Xcode is latest version Question: I just tried to install Fabric on my Mac, and I was thrown this error after using `pip install fabric` Installing collected packages: fabric, paramiko, pycrypto, ecdsa Cleaning up... Exception: Trace...
Flask - run function every hour Question: I have a Flask web hosting with no access to `cron` command. How can I execute some Python function every hour? Answer: You could make use of [`APScheduler`](http://pythonhosted.org/APScheduler/) in your Flask application and run your jobs via its interface: im...
Python. Is it possible to print without using the print function? Question: I wondered whether it is possible to print (for example a string) in python without the print command. This can be done by a command or by some trick. For example, in C there are printf and puts. Can someone show me a way to print or to deny ...
Left factoring using Python Question: Is there any predefined function in Python to identify the common prefixes on the right side of a production rule? For example, I need to turn this sort of data structure: ['abc', 'ab', 'd', 'dc'] into a dictionary of prefix-to-corresponding suffixes pairs. So...
reading data from stackoverflow rest api Question: Playing around with the raspberry pi and python. so bear with me :) When trying to decode the response data from the stackoverflow api I keep on receiving the error `utf-8 codec can't decode byte 0x8b in position 1: invalid start byte` Here is the entire code that I ...
Virtualenv doesn't install pip Question: I have installed `python3` via homebrew, updated `pip` & `setuptools`, installed `virtualenv` via `pip`. Now I'm trying to create a virtual env. Unfortunately, I can't get it to add pip to the virtualenv. Basically: $ ls -lha venv/bin/ total 80 drwxr-xr-x ...
Python - alternating lists Question: I have two lists in python: l = [1,1,1,1,1,1] b = ['-', 2, 2, 2, '-', 2] In the end, I'd like to have a list like this: result = [1, 1, 2, 1, 2, 1, 2, 1, 1, 2] Algorithm: If there is a '-' in b, do nothing, else append element from b after element in l at ...
Python alternative to fscanf C code Question: I have some C code that works well: #include<stdio.h> #include<stdlib.h> int main() { FILE *fp; struct emp { char name[40]; int age; float bs; }; struct emp e; fp=...
Examples given in the Python BeautifulSoup 4 Documentation Question: I am learning the BeautifulSoup 4 Documentation, and want to exercise the examples given. I am trying the examples however it’s not successful. An example below. Seems I am not putting it in a right way, and problem lies in the ‘url’. Could some kin...
Bottle Displays Old Template? Question: I made a first draft of a template, called `batch.tpl`. I have updated it, however, the old template still displays. I have shut off the controller script and turned it back on multiple times. I have removed everything from the template except for the following: `cat views/batch...
Writing and reading variables in a file in Python Question: I am new to the Python language and I am scratching my head on how to make my code create a file where it can define variables and then later read the variables so they are useable in my code. How would I do this? Thanks, Chandler. Answer: [You can use the ...
Python dicerolling program skipping the roll Question: I have been trying to create a program that will simulate a dice roll, with the option to choose between a 4, 6, or 12 sided die. At the moment the problem I am having is that the program skips the rolling entirely no matter what option I choose and immediately ask...
Sending string via socket (python) Question: I have two scripts, Server.py and Client.py. I have two objectives in mind: 1. To be able to send data again and again to server from client. 2. To be able to send data from Server to client. here is my Server.py : import socket serversocket =...
LoginUser API access from Python Question: Is there a way to call the following method from Python? <http://msdn.microsoft.com/en- us/library/windows/desktop/aa378184(v=vs.85).aspx> Any help would be greatly appreciated. Answer: You may use [ctypes](http://docs.python.org/2/library/ctypes.html). This example seems ...
Wrap derived template class with Boost::python Question: I have a derived class from a template class : template<typename X, typename Y> class BaseFunction { static void export_BaseFunction() { ????? }; }; class Function : public BaseFunction<pair<doubl...
Using 'exec' function to run script in the interpreter shell Question: I try to run a script in Python3 by exec() function. I'm studying Python with the book 'Learning Python', O'Reilly 5th Edition. In the "CHAPTER 2 How Python Runs Programs" there is a method to like this: >>> exec(open('script1.py').r...
Is there a way to implement **kwargs behavior when calling a Python script from the command line Question: Say I have a function as follows: def foo(**kwargs): print kwargs And then call the function like this, I get this handy little dict of all `kwargs`. >>> foo(a = 5, b = ...
Django NoReverseMatch Question: I'm making a simple login app in django 1.6 (and python 2.7) and I get an error at the beggining that is not letting me continue. This is the site's url.py from django.conf.urls import patterns, include, url from django.contrib import admin import login a...
Passing values to array indexes in Python Question: Is there any way to assign values to keys in array in Python? Example in PHP: $inputArr = array( 'vertex'=>values[0], 'visited'=>values[1], 'letter' => $values[2] ) T...
UWSGI timer and cron decorators running duplicate jobs Question: I have been trying to make the uwsgi python spooler work properly for quite some time. I have a setup in which I run a django application with two worker processes. I have tried setting a cron spooler (and a timer spooler) to run a task every ten minutes,...
Cython with python 3.3 Question: I have been using python 3.3 This is an old problem as I searched, and this is what I did: helloworld.pyx print("Hello world!") Then, in ipython, I did: import pyximport; pyximport.install() import helloworld It says: > ImportError: Build...
Why can't node handle this regex but python can? Question: I have a large text file that I am extracting URLs from. If I run: import re with open ('file.in', 'r') as fh: for match in re.findall(r'http://matchthis\.com', fh.read()): print match it runs in a second or so use...
Unable to import PIL.Image for qrcode Question: I run into this weird error, I need to use `qrcode` with `pillow`, so I did `pip install pillow qrcode` (after initiating the virtual environment). Then, the following thing happens >>> from PIL import Image >>> Image <module 'PIL.Image' from '/vagr...
Django + Boto + Python 3 Question: How can I store my Django uploaded files on S3 using Python 3 on EC2 Amazon Linux? If I can't, how can I share uploaded files between 2 EC2 instances if I'm using ELB? I tried to use the django-storages-py3 + boto#py3kport but it doesn't work, when I'm trying to upload files I get an...
How to get the field value and assign to the variable in python Question: I am using **openerp 6**.My `form` contains one `text box` and I need to get that value and assign it to a variable so to perform calculations and to return a result to store in a new `textbox`... Answer: I have give .py file here. This will ca...
shapely and geos break in distance method Question: I'm having problems using the distance method in shapely (I suspect incompatibility with the geos package). The following code: from shapely.geometry import Point print Point(0,0).distance(Point(1,1)) creates the following error: ...
Python- How to check if program gets aborted by user while running? Question: If I am running a python program on linux terminal and i abort it manually by pressing ctrl+c, how can i make my program do something when this event occurs. something like: if sys.exit(): print "you chose to end the p...
Struggling to append a relative path to my sys.path Question: So there are a lot of pretty similar questions but none of the answers seems to satisfy what I'm looking for. Essentially I am running a python script using an absolute directory in the command line. Within this file itself, I want to import a module/file...
subprocess.Popen("ssh host@remote cmd") failed Question: I'm new to python subprocess. When I want to use python subprocess.Popen.communicate to accomplish interact passwd with shell cmd "net ads join -U administrator", it's output didn't redirect into PIPE, but in stdout.My code is under: import subproc...
Splitting string and removing whitespace Python Question: I would like to split a String by comma `','` and remove whitespace from the beginning and end of each split. For example, if I have the string: `"QVOD, Baidu Player"` I would like to split and strip to: `['QVOD', 'Baidu Player']` Is there an elegant way of...
Changing Microsoft Query in Excel with Python (pywin32) or VBA Question: I need to create reports for the financial year of the individual sales of each customer (around 500) from 1-Apr 2014 to 31-Mar 2015. Last year when I did this I went in to each report from the previous year and simply changed the date in the quer...
python list generation/saving bug Question: I am trying to make program that prints all the possible combinations for `a` to `zzz`. I tried to add a save state feature, and it works fine but there is this bug. Let's say I interrupted the program when it printed something like `e`. When I execute the program again, it ...
Make python process stop/wait/sleep for 0.2 seconds [Works] Question: Title says it all, is it possible to make python sleep for less than a second? WORKS: import time print ("foo") time.sleep(0.2) #talking about the value of the time print ("bar") If not, then is there any other way? T...
python scientific notation with forced leading zero Question: I want to have Python2.7 print out floating point numbers in scientific notation, forced to start with 0. For instance, assume a=1234567890e12 print '{:22.16E}'.format(a) 1.2345678900000000E+21 However, I want a print output that...
Making Python 2.7 code run with Python 2.6 Question: I have this simply python function that can extract a zip file (platform independent) def unzip(source, target): with zipfile.ZipFile(source , "r") as z: z.extractall(target) print "Extracted : " + source + " to: " + target...
adding lines to a file in it doesnt exist in python Question: so what i am doing is first reading the /var/log/secure file for ipaddresses that i want to block and saving that list to a file. then i am trying read that file and determine if the address is outside of the US, and if it is, then i want to block the addres...
how to turn a sorted list into tab delimited values in Python? Question: I have a sorted list that looks like this [('100','abc'),('99','bca')]. I want to turn this into something like this into a text file. abc 100<br> bca 99 I have tried this import csv writer = c...
Does nitrous.io support the endpoint library? Question: Developing a python project on the platform and attempting [appengine endpoints](https://developers.google.com/appengine/docs/python/endpoints/getstarted/backend/write_api). `import endpoints` throws `google.appengine.api.yaml_errors.EventError: the library "endp...
Installing LightBlue (BlueTooth) for Python Question: I'm trying to import lightblue for Python. I have a brand new Mac (so 10.9 I believe), I have Xcode installed, and I am running... Python 2.7.6 :: Anaconda 1.8.0 (x86_64) I downloaded lightblue-0.4.tar.gz to my desktop and then ran ...
Count how many matrices have full rank for all submatrices Question: I would like to count how many m by n matrices whose elements are 1 or -1 have the property that all its `floor(m/2)+1 by n` submatrices have full rank. My current method is naive and slow and is in the following python/numpy code. It simply iterates ...
Celery import error Question: I am hitting an import error in starting celery. This is confusing, because this was working a few days ago, and git shows nothing changed. I think celery's heuristics for import directories are colliding with my split-out setting structure, and maybe my path/env is different than it was w...
Bottle framework: how to return datetime in JSON response Question: When I try to return JSON containing `datetime` value, I'm getting File "/usr/lib/python2.7/json/encoder.py", line 178, in default raise TypeError(repr(o) + " is not JSON serializable") TypeError: datetime.datetime(2014, 2,...
How to take sum and average of indexed values in a list? Question: List B is expanded at index positions where list A has adjacent matching values using [groupby](http://docs.python.org/2/library/itertools.html) A = [476, 1440, 3060, 3060, 500,500] B = [0,4,10,15] so resultant list is: ...
creating surface data for axes3d Question: Okay, apologies for this question but I'm pulling my hair out here. I have a data structure loaded in python in the form: [(1,0,#),(1,1,#),(1,2,#),(1,3,#),(2,0,#),(2,1,#) ... (26,3,#)] with # being a different number each time that I wish to represent on ...
Find the most recent file on a http server (python) Question: I have a site: <http://planet.osm.ch/replication/hour/000/006/> and I need to get the most recent file listed on the server. How can I accomplish this through python 2.6.x and using only the standard library. Thank you Edit: When I mean the most recent, I...
How to share a string amongst multiple processes using Managers() in Python? Question: I need to read strings written by multiprocessing.Process instances from the main process. I already use Managers and queues to pass arguments to processes, so using the Managers seems obvious, [but Managers do not support strings](h...
python error when added a function to a class Question: i just added this function to my class def getTotalPopulation(): print 'there are {0} people in the world'.format(Person.population) when i call it, i got this error: Traceback (most recent call last): File "<i...
How to find set of most frequently occurring word-pairs in a file using python? Question: I have a data set as follows: "485","AlterNet","Statistics","Estimation","Narnia","Two and half men" "717","I like Sheen", "Narnia", "Statistics", "Estimation" "633","MachineLearning","AI","I like Cars, but ...
Strategies for searching through strings in python? Question: What are efficient ways to search for substrings in strings? \- Are there specific functions built in python we can use? \- Can we convert them to lists then access elements in the list? \- Can we use for loops to search through individual elements? \- Is th...
Can not start boa-constructor successfully Question: When I start boa-constructor from the command line by starting the script "Boa.py", I got the message says " D:\Python27\Lib\site-packages\boa-constructor>python Boa.py Starting Boa Constructor v0.6.1 importing wxPython reading user prefere...
Requiring help in figuring out indent error in python code Question: I get an indentation error when trying to run the code below. I am trying to print out the URLs of a set of html pages recursively. import urllib2 from BeautifulSoup import * from urlparse import urljoin # Create a list of w...
How to delete an image file from GridFS by file metadata? Question: I have an image with the following metadata: > db.fs.files.find().pretty() { "_id" : ObjectId("4576874577342672346"), "chunkSize" : 262144, "user_name" : "my name", "filename" : "image.jpg", "l...
Type error when calling sdlttf.TTF_OpenFont() with the pysdl2 Python bindings Question: I have all dependencies correctly installed (SDL2, SDL2_TTF, pysdl2). I've tried to provide just the filename for the font and I've tried to hard code the full path. The font is in the same directory as the python file. ...
Modifying Active Directory Passwords via ldapmodify Question: I'm investigating the scripting of various LDAP operations. However, I've hit a bit of a speed bump with Active Directory user creation. The following LDIF fails when I load it in via the `ldapmodify` command: dn: CN=Frank,CN=Users,DC=domain,...
variable in try clause not accessible in finally clause - python Question: I am new to python, so sorry if this question is dumb, but can someone tell me what's going on here. When I run the following code with no errors in the mdb.connect() call, the code runs fine. But when I purposely insert an error (for example,...
Keyword values for error_kw in Python bar plots Question: I want to adjust error bar properties in a bar plot. Apparently this is to be done by using keyword arguments (i.e. in error_kw). e.g. from pylab import * fig = figure() ax = fig.add_subplot(111) ax.plot( left=0, width=1, he...
How do I right click on a windows tray icon and clicking on item on context menu in Python? Question: I need to right click on a Windows Notification Tray icon, and select (left clicking) one of the items on the resulting context menu. I have tried to use [pywinauto](http://pywinauto.googlecode.com/), and while runnin...
Python - create next file Question: I am writing a small script. The script creates `.txt` files. I do not want to replace existing files. So what I want python to do is to check if the file already exists. If it does not it can proceed. If the file does exists I would like python to increment the name and than check a...
15 Python scripts into one executable? Question: Ive been tinkering around all day with solutions from here and here: [How would I combine multiple .py files into one .exe with Py2Exe](http://stackoverflow.com/questions/7950335/how-would-i-combine- multiple-py-files-into-one-exe-with-py2exe) [Packaging multiple scrip...
Bitcoinrpc connection to remote server Question: Hey I was wondering if anyone knew how to connect to a bitcoin wallet located on another server with bitcoinrpc I am running a web program made in django and using a python library called bitcoinrpc to make connections. When testing locally, I can use bitcoinrpc.connec...
SKLearn - Principal Component Analysis leads to horrible results in knn predictions Question: by adding PCA to the algorithm, I'm working to improve %96.5 SKlearn kNN prediction score for kaggle digit recognition tutorial, yet new kNN predictions based on PCA output are horrible like 23%. below is the full code and i ...
Tracking CPU time of Python process and children Question: Is there an easy way to track the CPU time of not only a Process but of any child processes launched by it? I tried sub-classing `multiprocessing.Process` to time an arbitrary function, like: import time from multiprocessing import Process ...
Split .TIF file using PIL Question: I took a look at the [Split multi-page tiff with python](http://stackoverflow.com/questions/9627652/split-multi-page-tiff-with- python) file for Splitting a .TIFF File, however to be honest, I didn't fully understand the answers, and I'm hoping for a little clarification. I am attem...
Python Kerberos-1.1.1.tar.gz Install Failure on Windows Question: I run Python on windows based environments (2003, win 7, 2008 r2, etc) both 32 and 64-bit flavors. I've recently had to authenticate to various corporate, internally facing web-sites using both NTLM and Kerberos authentication schemes. I was successful ...
How python custom class differ from any other in-built object like list? Question: I m not sure my question title is correct but : My problem is : When I created a new class called **classA** and i did **deepcopy** to another name called **classB** and did **equality and identity test** : Here is my first snippet: C...
Stuck at os.rename can't quite figure out how to tie it in with the rest of my script Question: I am new to programming and python and this is my first program I decided to try and tackle. This loops through my files in the directory that I run it from and takes out the string of text I don't want and leaves me with t...
connect to telnet in python with a quizz as login? Question: I need to connect to a remote server via telnet. To authenticate to the server I have to answer like a 100 questions. So I tried to automate this task in python using telnetlib but the prompt halts without returning any message. here is what I did ...
Sending an HTML rich email using python Question: I am trying to send HTML rich email, so far the code is working but the colour formatting i had in html message content is not showing when I check in my mailbox i sent to. So far here is the code : from email.MIMEMultipart import MIMEMultipart from ...
HTTP Server Python: how to test it in local? Question: I have 2 networks on my computer (Wifi network for internet, and local network based on wired cable) with specific mask and IP (this configuration works). I have a Python HTTP server (on my computer) for the local network: or simply >>> python serv...
Why running a same script in different location cause errors? Question: I try to run a script that's using third party module (completely install by `pip install module`) in Ubuntu 13.10. This script located in NTFS partition. import foo API_KEY = "xxx" api = foo.FOO(APIKEY) and it's r...
Python couldn't insert row to MySQL Question: I'm trying to accomplish following query: sql = "INSERT INTO adr_citydistricts (CityDistrict, CityDistrictRU) VALUES (% (ua) s,% (ru) s);" data = {'ua': 'ukrainian', 'ru': 'russian'} cursor.execute (sql, data) After executing this query, there i...
convert list into random list within list python Question: Let us imagine that in python we have list of numbers, like this: [1, 3, 4, 5, 6, 7, 8, 9] What is the simplest possible way to convert this list of numbers into a random series of lists within lists? Like this: [[1, 2, 3], ...
multiprocessing.Queue deadlocks after "reader" process death Question: I've been playing with multiprocessing package and noticed that queue can be deadlocked for reading when: 1. The "reader" process is using [get](http://docs.python.org/2/library/multiprocessing.html#multiprocessing.Queue.get) with _timeout_ > 0: ...
how to work with time.strftime in django 1.6 Question: I am one of the new user in django 1.6 but one thing very bad I have noticed in this version of django is that time.strftime("%H:%M:%S") does not working and giving a wrong time in my view . Is there any alternating approach for getting a right time in django view ...
Python findAll not working on beautifulsoup 3 Question: I am trying to parse a html file and write the results to a csv file. The html file is: <table BORDER='1' CELLSPACING='0' CELLPADDING='0'> <tr> <td><small>15</small></td > <td><small><small>Cat</small></small></td> </tr> ...
Python 2.6 ImportError: No module named argparse Question: I'm trying to run git-cola from Red Hat Enterprise Linux Server release 6.5 and receive: Traceback (most recent call last): File "....../bin/git-cola", line 24, in <module> from argparse import ArgumentParser ImportError: No module na...
How do I import a text file with no separators in python, using numpy? Question: How do I import a file with no separators? I have a file named `text.txt` which contains 2 lines of text: > 00000000011100000000000000000000 > 00000000011111110000000000000000 When I use > f = open("text.txt") > data = np.loadtxt...
No module named _graphviz Question: I installed graphviz and pygraphviz, when I open a cmd and type python import _graphviz _graphviz can be imported, but when I run a C++ program which will invoke a .py file, there is a line in this .py file which is import pygraphviz as pgv ...
feature_importances_ showing up as NoneType in ExtraTreesClassifier :TypeError: 'NoneType' object is not iterable Question: I am trying to select important features (or at least understand which features explain more variabilty) for a given dataset. Towards this I use both ExtraTreesClassifier and GradientBoostingRegre...
path.py not recognized in eclipse Question: I installed the path package: easy_install path.py running ipython I can validly run: from path import path Eclipse (after restart) does not recognize this (unresolved import "path"). It also will not auto-complete class members and f...
Using Flask-Mail asynchronously results in "RuntimeError: working outside of application context" Question: I am trying to send some mail asynchronously (based on the code in [The Flask Mega-Tutorial, Part XI: Email Support](http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xi- email-support)). However, ...
Is there an NSCoding-like facility in Python? Question: As an iOS developer recently experimenting with Python, I'm curious to know if there's something like `NSCoding` that would allow me to implement a method or a pair of methods which would define how my objects can be automatically saved to disk, much like `NSCodin...
Searching for equivalent of FileNotFoundError in Python 2 Question: I created a class named Options. It works fine but not not with Python 2. And I want it to work on both Python 2 and 3. The problem is identified: FileNotFoundError doesn t exist in Python 2. But if I use IOError it doesn t work in Python 3 Changed in...