title stringlengths 10 172 | question_id int64 469 40.1M | question_body stringlengths 22 48.2k | question_score int64 -44 5.52k | question_date stringlengths 20 20 | answer_id int64 497 40.1M | answer_body stringlengths 18 33.9k | answer_score int64 -38 8.38k | answer_date stringlengths 20 20 | tags listlengths 1 5 |
|---|---|---|---|---|---|---|---|---|---|
Allowing user to configure cron | 1,136,168 | <p>I have this bash script on the server that runs every hour, via cron. I was perfectly happy, but now the user wants to be able to configure the frequency through the web interface.</p>
<p>I don't feel comfortable manipulating the cron configuration programmatically, but I'm not sure if the other options are any bet... | 3 | 2009-07-16T08:25:31Z | 1,136,245 | <p>What about <a href="http://webmin.com" rel="nofollow" title="Webmin">Webmin</a>? I have never used it myself but it seems you could configure the cron module and give permissions to the user who wants to configure the job.</p>
| 0 | 2009-07-16T08:43:30Z | [
"python",
"bash",
"cron"
] |
Allowing user to configure cron | 1,136,168 | <p>I have this bash script on the server that runs every hour, via cron. I was perfectly happy, but now the user wants to be able to configure the frequency through the web interface.</p>
<p>I don't feel comfortable manipulating the cron configuration programmatically, but I'm not sure if the other options are any bet... | 3 | 2009-07-16T08:25:31Z | 1,136,329 | <p>You could use a python scheduler library that does most of the work already:</p>
<ul>
<li><a href="http://www.kalab.com/freeware/pycron/pycron.htm" rel="nofollow">pycron</a></li>
<li><a href="http://code.google.com/p/scheduler-py/" rel="nofollow">scheduler-py</a></li>
</ul>
| 3 | 2009-07-16T09:04:18Z | [
"python",
"bash",
"cron"
] |
Allowing user to configure cron | 1,136,168 | <p>I have this bash script on the server that runs every hour, via cron. I was perfectly happy, but now the user wants to be able to configure the frequency through the web interface.</p>
<p>I don't feel comfortable manipulating the cron configuration programmatically, but I'm not sure if the other options are any bet... | 3 | 2009-07-16T08:25:31Z | 1,138,065 | <p>Well something I use is a main script started every minute by cron. this script check touched files. If the files are there the main cron script start a function/subscript. You just have to touch a defined file and "rm -f"ed it when done. It has the side benefits to be more concurrent proof if you want other way to ... | 0 | 2009-07-16T14:36:54Z | [
"python",
"bash",
"cron"
] |
Allowing user to configure cron | 1,136,168 | <p>I have this bash script on the server that runs every hour, via cron. I was perfectly happy, but now the user wants to be able to configure the frequency through the web interface.</p>
<p>I don't feel comfortable manipulating the cron configuration programmatically, but I'm not sure if the other options are any bet... | 3 | 2009-07-16T08:25:31Z | 1,151,998 | <p>I found a module that can manipulate the cron info for me. It's called <a href="http://pypi.python.org/pypi/python-crontab/0.9" rel="nofollow">python-crontab</a>, and it's available with <code>easy_install</code>. From the <a href="http://bazaar.launchpad.net/~doctormo/python-crontab/trunk/annotate/head:/crontab.py"... | 0 | 2009-07-20T06:44:40Z | [
"python",
"bash",
"cron"
] |
Inserting a Python datetime.datetime object into MySQL | 1,136,437 | <p>I have a date column in a MySQL table. I want to insert a <code>datetime.datetime()</code> object into this column. What should I be using in the execute statement?</p>
<p>I have tried:</p>
<pre><code>now = datetime.datetime(2009,5,5)
cursor.execute("INSERT INTO table
(name, id, datecolumn) VALUES (%s, %s
, %s)",... | 72 | 2009-07-16T09:29:48Z | 1,136,480 | <p>Try using <code>now.date()</code> to get a <code>Date</code> object rather than a <code>DateTime</code>.</p>
<p>If that doesn't work, then converting that to a string should work:</p>
<pre><code>now = datetime.datetime(2009,5,5)
str_now = now.date().isoformat()
cursor.execute('INSERT INTO table (name, id, datecolu... | 5 | 2009-07-16T09:39:15Z | [
"python",
"mysql",
"datetime"
] |
Inserting a Python datetime.datetime object into MySQL | 1,136,437 | <p>I have a date column in a MySQL table. I want to insert a <code>datetime.datetime()</code> object into this column. What should I be using in the execute statement?</p>
<p>I have tried:</p>
<pre><code>now = datetime.datetime(2009,5,5)
cursor.execute("INSERT INTO table
(name, id, datecolumn) VALUES (%s, %s
, %s)",... | 72 | 2009-07-16T09:29:48Z | 1,138,297 | <p>What database are you connecting to? I know Oracle can be picky about date formats and likes <a href="http://en.wikipedia.org/wiki/ISO_8601" rel="nofollow">ISO 8601</a> format.</p>
<p>**Note: Oops, I just read you are on MySQL. Just format the date and try it as a separate direct SQL call to test.</p>
<p>In P... | 1 | 2009-07-16T15:08:32Z | [
"python",
"mysql",
"datetime"
] |
Inserting a Python datetime.datetime object into MySQL | 1,136,437 | <p>I have a date column in a MySQL table. I want to insert a <code>datetime.datetime()</code> object into this column. What should I be using in the execute statement?</p>
<p>I have tried:</p>
<pre><code>now = datetime.datetime(2009,5,5)
cursor.execute("INSERT INTO table
(name, id, datecolumn) VALUES (%s, %s
, %s)",... | 72 | 2009-07-16T09:29:48Z | 4,508,923 | <p>For a time field, use:</p>
<pre><code>import time
time.strftime('%Y-%m-%d %H:%M:%S')
</code></pre>
<p>I think strftime also applies to datetime.</p>
| 105 | 2010-12-22T11:56:18Z | [
"python",
"mysql",
"datetime"
] |
Inserting a Python datetime.datetime object into MySQL | 1,136,437 | <p>I have a date column in a MySQL table. I want to insert a <code>datetime.datetime()</code> object into this column. What should I be using in the execute statement?</p>
<p>I have tried:</p>
<pre><code>now = datetime.datetime(2009,5,5)
cursor.execute("INSERT INTO table
(name, id, datecolumn) VALUES (%s, %s
, %s)",... | 72 | 2009-07-16T09:29:48Z | 12,191,497 | <p>You are most likely getting the TypeError because you need quotes around the datecolumn value.</p>
<p>Try:</p>
<pre><code>now = datetime.datetime(2009, 5, 5)
cursor.execute("INSERT INTO table (name, id, datecolumn) VALUES (%s, %s, '%s')",
("name", 4, now))
</code></pre>
<p>With regards to the form... | 28 | 2012-08-30T06:59:51Z | [
"python",
"mysql",
"datetime"
] |
how do I use the json google translate api? | 1,136,604 | <p>I am trying to use google translate from python with utf-8 text.
How do I call the json api? They have a document for embedding it in html but I can't find a proper API or wsdl anywhere.</p>
<p>Thanks
Raphael</p>
| 3 | 2009-07-16T10:03:38Z | 1,136,915 | <p>I think you are talking about the ajax api <a href="http://code.google.com/apis/ajaxlanguage/" rel="nofollow">http://code.google.com/apis/ajaxlanguage/</a>,
which has to be used from javascript, so I do not understand what do you mean by "google translate from python"</p>
<p>Alternatively if you need to use transl... | 0 | 2009-07-16T11:16:35Z | [
"python",
"json",
"api",
"google-translate"
] |
how do I use the json google translate api? | 1,136,604 | <p>I am trying to use google translate from python with utf-8 text.
How do I call the json api? They have a document for embedding it in html but I can't find a proper API or wsdl anywhere.</p>
<p>Thanks
Raphael</p>
| 3 | 2009-07-16T10:03:38Z | 1,137,820 | <p>Here is the code that finally works for me.
Using the website without the ajax api can get your ip banned, so this is better.</p>
<pre><code>#!/usr/bin/env python
from urllib2 import urlopen
from urllib import urlencode
import urllib2
import urllib
import simplejson
import sys
# The google translate API can be fou... | 7 | 2009-07-16T14:02:54Z | [
"python",
"json",
"api",
"google-translate"
] |
how do I use the json google translate api? | 1,136,604 | <p>I am trying to use google translate from python with utf-8 text.
How do I call the json api? They have a document for embedding it in html but I can't find a proper API or wsdl anywhere.</p>
<p>Thanks
Raphael</p>
| 3 | 2009-07-16T10:03:38Z | 2,518,499 | <p>Look what I have found : <a href="http://code.google.com/intl/ru/apis/ajaxlanguage/terms.html" rel="nofollow">http://code.google.com/intl/ru/apis/ajaxlanguage/terms.html</a></p>
<p>Here is the interesting part:</p>
<p>You will not, and will not permit your end users or other third parties to:
....
* submit any... | 1 | 2010-03-25T18:57:42Z | [
"python",
"json",
"api",
"google-translate"
] |
how do I use the json google translate api? | 1,136,604 | <p>I am trying to use google translate from python with utf-8 text.
How do I call the json api? They have a document for embedding it in html but I can't find a proper API or wsdl anywhere.</p>
<p>Thanks
Raphael</p>
| 3 | 2009-07-16T10:03:38Z | 5,846,907 | <p>Use xgoogle from Peteris Kramins (<a href="http://www.catonmat.net/blog/python-library-for-google-translate/" rel="nofollow">His blog</a>)</p>
<pre><code>>>> from xgoogle.translate import Translator
>>>
>>> translate = Translator().translate
>>>
>>> print translate("Mani... | 2 | 2011-05-01T06:37:20Z | [
"python",
"json",
"api",
"google-translate"
] |
When should I use varargs in designing a Python API? | 1,136,673 | <p>Is there a good rule of thumb as to when you should prefer varargs function signatures in your API over passing an iterable to a function? ("varargs" being short for "variadic" or "variable-number-of-arguments"; i.e. <code>*args</code>)</p>
<p>For example, <code>os.path.join</code> has a vararg signature:</p>
<pre... | 4 | 2009-07-16T10:20:20Z | 1,136,754 | <p>My rule of thumb is to use it when you might often switch between passing one and multiple parameters. Instead of having two functions (some GUI code for example):</p>
<pre><code>def enable_tab(tab_name)
def enable_tabs(tabs_list)
</code></pre>
<p>or even worse, having just one function</p>
<pre><code>def enable_... | 3 | 2009-07-16T10:37:13Z | [
"python",
"api",
"varargs"
] |
When should I use varargs in designing a Python API? | 1,136,673 | <p>Is there a good rule of thumb as to when you should prefer varargs function signatures in your API over passing an iterable to a function? ("varargs" being short for "variadic" or "variable-number-of-arguments"; i.e. <code>*args</code>)</p>
<p>For example, <code>os.path.join</code> has a vararg signature:</p>
<pre... | 4 | 2009-07-16T10:20:20Z | 1,136,791 | <p>You should use it when your parameter list is variable.</p>
<p>Yeah, I know the answer is kinda daft, but it's true. Maybe your question was a bit diffuse. :-)</p>
<p>Default arguments, like min() above is more useful when you either want to different behaviours (like min() above) or when you simply don't want to ... | 0 | 2009-07-16T10:46:28Z | [
"python",
"api",
"varargs"
] |
When should I use varargs in designing a Python API? | 1,136,673 | <p>Is there a good rule of thumb as to when you should prefer varargs function signatures in your API over passing an iterable to a function? ("varargs" being short for "variadic" or "variable-number-of-arguments"; i.e. <code>*args</code>)</p>
<p>For example, <code>os.path.join</code> has a vararg signature:</p>
<pre... | 4 | 2009-07-16T10:20:20Z | 1,136,798 | <p>Consider using varargs when you expect your users to specify the list of arguments as code at the callsite or having a single value is the common case. When you expect your users to get the arguments from somewhere else, don't use varargs. When in doubt, err on the side of not using varargs.</p>
<p>Using your examp... | 8 | 2009-07-16T10:48:23Z | [
"python",
"api",
"varargs"
] |
When should I use varargs in designing a Python API? | 1,136,673 | <p>Is there a good rule of thumb as to when you should prefer varargs function signatures in your API over passing an iterable to a function? ("varargs" being short for "variadic" or "variable-number-of-arguments"; i.e. <code>*args</code>)</p>
<p>For example, <code>os.path.join</code> has a vararg signature:</p>
<pre... | 4 | 2009-07-16T10:20:20Z | 1,136,801 | <p>They are completely different interfaces.<br />
In one case, you have one parameter, in the other you have many.</p>
<pre><code>any(1, 2, 3)
TypeError: any() takes exactly one argument (3 given)
os.path.join("1", "2", "3")
'1\\2\\3'
</code></pre>
<p>It really depends on <em>what</em> you want to emphasize: <code>... | 0 | 2009-07-16T10:48:48Z | [
"python",
"api",
"varargs"
] |
is it required to give path after installation MySQL db for Python 2.6 | 1,136,676 | <p>I am using Python 2.6.1, MySQL4.0 in Windows platform and I have successfully installed MySQLdb.</p>
<p>Do we need to set any path for my python code and MySQLdb to successful run my application? Without any setting paths (in my code I am importing MySQLdb) I am getting <strong>No module named MySQLdb</strong> erro... | 1 | 2009-07-16T10:20:42Z | 1,136,692 | <p>How did you install MySQLdb? This sounds like your MySQLdb module is not within your PYTHONPATH which indicates some inconsistancy between how you installed Python itself and how you installed MySQLdb.</p>
<p>Or did you perhaps install a MySQLdb binary that was not targeted for your version of Python? Modules are n... | 0 | 2009-07-16T10:23:48Z | [
"python",
"mysql"
] |
is it required to give path after installation MySQL db for Python 2.6 | 1,136,676 | <p>I am using Python 2.6.1, MySQL4.0 in Windows platform and I have successfully installed MySQLdb.</p>
<p>Do we need to set any path for my python code and MySQLdb to successful run my application? Without any setting paths (in my code I am importing MySQLdb) I am getting <strong>No module named MySQLdb</strong> erro... | 1 | 2009-07-16T10:20:42Z | 1,136,842 | <p>no, it is generally not required (not for good mannered modules like MySQLdb). </p>
<p>did you check my answer to your previous question
<a href="http://stackoverflow.com/questions/1135625/connecting-python-2-6-1-with-mysqldb">http://stackoverflow.com/questions/1135625/connecting-python-2-6-1-with-mysqldb</a></p>
| 0 | 2009-07-16T10:59:49Z | [
"python",
"mysql"
] |
What does python sys.intern do, and when should it be used? | 1,136,826 | <p>I came across <a href="http://stackoverflow.com/questions/327223/">this question</a> about memory management of dictionaries, which mentions the <strong>intern</strong> function. What exactly does it do, and when would it be used?</p>
<p>To give an example:</p>
<p>If I have a set called <strong>seen</strong>, that... | 27 | 2009-07-16T10:57:00Z | 1,136,841 | <p>It returns a canonical instance of the string.</p>
<p>Therefore if you have many string instances that are equal you save memory, and in addition you can also compare canonicalized strings by identity instead of equality which is faster.</p>
| 4 | 2009-07-16T10:59:36Z | [
"python",
"memory",
"memory-management",
"python-3.x"
] |
What does python sys.intern do, and when should it be used? | 1,136,826 | <p>I came across <a href="http://stackoverflow.com/questions/327223/">this question</a> about memory management of dictionaries, which mentions the <strong>intern</strong> function. What exactly does it do, and when would it be used?</p>
<p>To give an example:</p>
<p>If I have a set called <strong>seen</strong>, that... | 27 | 2009-07-16T10:57:00Z | 1,136,852 | <p><em>From the <a href="http://docs.python.org/3.2/library/sys.html?highlight=sys.intern#sys.intern">Python 3</a> documentation</em>:</p>
<pre><code>sys.intern(string)
</code></pre>
<blockquote>
<p>Enter string in the table of âinternedâ strings and return the
interned string â which is string itself or a ... | 35 | 2009-07-16T11:02:23Z | [
"python",
"memory",
"memory-management",
"python-3.x"
] |
What does python sys.intern do, and when should it be used? | 1,136,826 | <p>I came across <a href="http://stackoverflow.com/questions/327223/">this question</a> about memory management of dictionaries, which mentions the <strong>intern</strong> function. What exactly does it do, and when would it be used?</p>
<p>To give an example:</p>
<p>If I have a set called <strong>seen</strong>, that... | 27 | 2009-07-16T10:57:00Z | 1,136,872 | <p>They weren't talking about keyword <code>intern</code> because there is no such thing in Python. They were talking about <a href="http://docs.python.org/library/functions.html?highlight=intern#intern" rel="nofollow">non-essential built-in function <code>intern</code></a>. Which in py3k has been moved to <a href="htt... | 9 | 2009-07-16T11:06:19Z | [
"python",
"memory",
"memory-management",
"python-3.x"
] |
What does python sys.intern do, and when should it be used? | 1,136,826 | <p>I came across <a href="http://stackoverflow.com/questions/327223/">this question</a> about memory management of dictionaries, which mentions the <strong>intern</strong> function. What exactly does it do, and when would it be used?</p>
<p>To give an example:</p>
<p>If I have a set called <strong>seen</strong>, that... | 27 | 2009-07-16T10:57:00Z | 1,137,293 | <p>Essentially intern looks up (or stores if not present) the string in a collection of interned strings, so all interned instances will share the same identity. You trade the one-time cost of looking up this string for faster comparisons (the compare can return True after just checking for identity, rather than havin... | 15 | 2009-07-16T12:39:19Z | [
"python",
"memory",
"memory-management",
"python-3.x"
] |
What does python sys.intern do, and when should it be used? | 1,136,826 | <p>I came across <a href="http://stackoverflow.com/questions/327223/">this question</a> about memory management of dictionaries, which mentions the <strong>intern</strong> function. What exactly does it do, and when would it be used?</p>
<p>To give an example:</p>
<p>If I have a set called <strong>seen</strong>, that... | 27 | 2009-07-16T10:57:00Z | 18,105,231 | <p>This idea seems around us in several languages, including Python, Java etc.</p>
<p><a href="http://en.wikipedia.org/wiki/String_interning" rel="nofollow">String Interning</a></p>
| -2 | 2013-08-07T13:50:23Z | [
"python",
"memory",
"memory-management",
"python-3.x"
] |
What is the correct way to document a **kwargs parameter? | 1,137,161 | <p>I'm using <a href="http://sphinx.pocoo.org">sphinx</a> and the autodoc plugin to generate API documentation for my Python modules. Whilst I can see how to nicely document specific parameters, I cannot find an example of how to document a <code>**kwargs</code> parameter.</p>
<p>Does anyone have a good example of a ... | 32 | 2009-07-16T12:18:43Z | 1,137,623 | <p>I think <a href="http://docs.python.org/library/subprocess.html" rel="nofollow"><code>subprocess</code>-module's docs</a> is a good example. Give an exhaustive list of all parameters for a <a href="http://docs.python.org/2/library/subprocess.html#subprocess.Popen" rel="nofollow">top/parent class</a>. Then just refer... | 11 | 2009-07-16T13:32:54Z | [
"python",
"documentation",
"python-sphinx"
] |
What is the correct way to document a **kwargs parameter? | 1,137,161 | <p>I'm using <a href="http://sphinx.pocoo.org">sphinx</a> and the autodoc plugin to generate API documentation for my Python modules. Whilst I can see how to nicely document specific parameters, I cannot find an example of how to document a <code>**kwargs</code> parameter.</p>
<p>Does anyone have a good example of a ... | 32 | 2009-07-16T12:18:43Z | 16,420,859 | <p>If anyone else is looking for some valid syntax.. Here's an example docstring. This is just how I did it, I hope it's useful to you, but I can't claim that it's compliant with anything in particular.</p>
<pre><code>def bar(x=True, y=False):
"""
Just some silly bar function.
:Parameters:
- `x` (`b... | 5 | 2013-05-07T13:53:34Z | [
"python",
"documentation",
"python-sphinx"
] |
What is the correct way to document a **kwargs parameter? | 1,137,161 | <p>I'm using <a href="http://sphinx.pocoo.org">sphinx</a> and the autodoc plugin to generate API documentation for my Python modules. Whilst I can see how to nicely document specific parameters, I cannot find an example of how to document a <code>**kwargs</code> parameter.</p>
<p>Does anyone have a good example of a ... | 32 | 2009-07-16T12:18:43Z | 21,056,959 | <p>There is a <a href="http://pythonhosted.org/an_example_pypi_project/sphinx.html#full-code-exampl" rel="nofollow">doctstring example</a> for Sphinx in their documentation.
Specifically they show the following: </p>
<pre><code>ef public_fn_with_googley_docstring(name, state=None):
"""This function does something.
A... | 4 | 2014-01-11T00:30:49Z | [
"python",
"documentation",
"python-sphinx"
] |
What is the correct way to document a **kwargs parameter? | 1,137,161 | <p>I'm using <a href="http://sphinx.pocoo.org">sphinx</a> and the autodoc plugin to generate API documentation for my Python modules. Whilst I can see how to nicely document specific parameters, I cannot find an example of how to document a <code>**kwargs</code> parameter.</p>
<p>Does anyone have a good example of a ... | 32 | 2009-07-16T12:18:43Z | 27,724,915 | <p>After finding this question I settled on the following, which is valid Sphinx and works fairly well:</p>
<pre><code>def some_function(first, second="two", **kwargs):
r"""Fetches and returns this thing
:param first:
The first parameter
:type first: ``int``
:param second:
The second p... | 6 | 2014-12-31T18:25:47Z | [
"python",
"documentation",
"python-sphinx"
] |
What is the correct way to document a **kwargs parameter? | 1,137,161 | <p>I'm using <a href="http://sphinx.pocoo.org">sphinx</a> and the autodoc plugin to generate API documentation for my Python modules. Whilst I can see how to nicely document specific parameters, I cannot find an example of how to document a <code>**kwargs</code> parameter.</p>
<p>Does anyone have a good example of a ... | 32 | 2009-07-16T12:18:43Z | 32,273,299 | <p><strong>Google Style docstrings parsed by Sphinx</strong></p>
<p>Disclaimer: not tested.</p>
<p>From this cutout of the <a href="http://sphinx-doc.org/latest/ext/example_google.html#example-google" rel="nofollow">sphinx docstring example</a>, the <code>*args</code> and <code>**kwargs</code> are left <strong>unexpa... | 2 | 2015-08-28T14:22:05Z | [
"python",
"documentation",
"python-sphinx"
] |
Using python scipy.weave inline with ctype variables? | 1,137,852 | <p>I am trying to pass a ctype variable to inline c code using scipy.weave.inline. One would think this would be simple. Documentation is good when doing it with normal python object types, however, they have a lot more features than I need, and It makes more sense to me to use ctypes when working with C. I am unsure, ... | 4 | 2009-07-16T14:07:24Z | 1,336,093 | <p>scipy.weave does not know anything about ctypes. Inputs are restricted to most of the basic builtin types, numpy arrays, wxPython objects, VTK objects, and SWIG wrapped objects. You can add your own converter code, though. There is currently not much documentation on this, but you can look at the <a href="http://svn... | 4 | 2009-08-26T16:47:50Z | [
"python",
"scipy",
"inline-code"
] |
Recommended Python cryptographic module? | 1,137,874 | <p>I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module.</p>
<p>Are there choices I am missing? Is there a clear front-runner ... | 25 | 2009-07-16T14:09:39Z | 1,137,912 | <p>If you are in an environment which includes GnuPG and Python >= 2.4, then you could also consider a tool such as <a href="http://code.google.com/p/python-gnupg/">python-gnupg</a>. (Disclaimer: I'm the maintainer of this project.) It leaves the heavy lifting to <code>gpg</code> and provides a fairly straightforward A... | 12 | 2009-07-16T14:15:34Z | [
"python",
"cryptography"
] |
Recommended Python cryptographic module? | 1,137,874 | <p>I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module.</p>
<p>Are there choices I am missing? Is there a clear front-runner ... | 25 | 2009-07-16T14:09:39Z | 1,137,959 | <p>How about <a href="http://www.pycrypto.org/" rel="nofollow">PyCrypto</a> (formerly <a href="http://www.amk.ca/python/code/crypto.html" rel="nofollow">http://www.amk.ca/python/code/crypto.html</a>)??</p>
| 1 | 2009-07-16T14:21:45Z | [
"python",
"cryptography"
] |
Recommended Python cryptographic module? | 1,137,874 | <p>I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module.</p>
<p>Are there choices I am missing? Is there a clear front-runner ... | 25 | 2009-07-16T14:09:39Z | 1,138,183 | <p><a href="http://code.google.com/p/pycrypt/">pycrypt</a> is actually a simple AES encrypt/decrypt module built on top of <a href="http://www.pycrypto.org/">pycrypto</a> like other modules you mention -- note that the latter is transitioning to the pycrypto.org URL as it's changing maintainers, and stable versions and... | 7 | 2009-07-16T14:51:25Z | [
"python",
"cryptography"
] |
Recommended Python cryptographic module? | 1,137,874 | <p>I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module.</p>
<p>Are there choices I am missing? Is there a clear front-runner ... | 25 | 2009-07-16T14:09:39Z | 1,384,831 | <p>I've just done such a survey last week and adopted M2Crypto that seems to be the most advanced wrapper today above openssl (found it in several recommandation lists while googling). I also tried pycrypto but it miss certificates management and standard key file format management that M2Crypto has (with pycrypto you ... | 2 | 2009-09-06T04:00:23Z | [
"python",
"cryptography"
] |
Recommended Python cryptographic module? | 1,137,874 | <p>I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module.</p>
<p>Are there choices I am missing? Is there a clear front-runner ... | 25 | 2009-07-16T14:09:39Z | 18,034,210 | <p><a href="https://pypi.python.org/pypi/pycrypto" rel="nofollow">PyCrypto</a> is my choice atm (latest pypi update 2012-05-24) and the source code is hosted on GitHub: <a href="https://github.com/dlitz/pycrypto" rel="nofollow">https://github.com/dlitz/pycrypto</a>. It can run pure Python math or use <a href="http://gm... | 2 | 2013-08-03T15:06:46Z | [
"python",
"cryptography"
] |
Recommended Python cryptographic module? | 1,137,874 | <p>I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module.</p>
<p>Are there choices I am missing? Is there a clear front-runner ... | 25 | 2009-07-16T14:09:39Z | 22,033,391 | <p>A new cryptography library for Python has been in rapid development for a few months now. The 0.2.1 release just happened a few days ago. </p>
<p><a href="https://cryptography.io/en/latest/">https://cryptography.io/en/latest/</a></p>
<p>It is mainly a CFFI wrapper around existing C libraries such as OpenSSL. It is... | 12 | 2014-02-26T06:20:09Z | [
"python",
"cryptography"
] |
Recommended Python cryptographic module? | 1,137,874 | <p>I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module.</p>
<p>Are there choices I am missing? Is there a clear front-runner ... | 25 | 2009-07-16T14:09:39Z | 24,758,365 | <p>Another crypto library to consider is <a href="http://www.pycryptodome.org/" rel="nofollow">PyCryptodome</a>, a fork of PyCrypto with PyPy support and a few more primitives (SHA-3, Salsa20, scrypt, etc).</p>
| 5 | 2014-07-15T12:35:24Z | [
"python",
"cryptography"
] |
Recommended Python cryptographic module? | 1,137,874 | <p>I've been exploring what cryptographic modules are available to Python, and I've found 3: ezPyCrypt, yawPyCrypt and KeyCzar (which actually supports a few languages, but Python is included amongst them). The first two rely on the PyCrypto module.</p>
<p>Are there choices I am missing? Is there a clear front-runner ... | 25 | 2009-07-16T14:09:39Z | 25,865,136 | <p>Keyczar is cool, but it lacks OAEP|PKCS padding which is only avaliable in Java version.
<a href="https://code.google.com/p/keyczar/wiki/KeyczarTool" rel="nofollow">https://code.google.com/p/keyczar/wiki/KeyczarTool</a></p>
<p>Also, at the moment it lacks password based encryption which is avaliable in C++.
<a href... | 0 | 2014-09-16T09:25:52Z | [
"python",
"cryptography"
] |
Get first non-empty string from a list in python | 1,138,024 | <p>In Python I have a list of strings, some of which may be the empty string. What's the best way to get the first non-empty string?</p>
| 8 | 2009-07-16T14:30:41Z | 1,138,036 | <p>To remove all empty strings,</p>
<p><code>[s for s in list_of_strings if s]</code></p>
<p>To get the first non-empty string, simply create this list and get the first element, or use the lazy method as suggested by wuub.</p>
| 5 | 2009-07-16T14:33:08Z | [
"python",
"string",
"list"
] |
Get first non-empty string from a list in python | 1,138,024 | <p>In Python I have a list of strings, some of which may be the empty string. What's the best way to get the first non-empty string?</p>
| 8 | 2009-07-16T14:30:41Z | 1,138,042 | <pre><code>def get_nonempty(list_of_strings):
for s in list_of_strings:
if s:
return s
</code></pre>
| 3 | 2009-07-16T14:33:58Z | [
"python",
"string",
"list"
] |
Get first non-empty string from a list in python | 1,138,024 | <p>In Python I have a list of strings, some of which may be the empty string. What's the best way to get the first non-empty string?</p>
| 8 | 2009-07-16T14:30:41Z | 1,138,051 | <pre><code>next(s for s in list_of_string if s)
</code></pre>
<p>Edit: py3k proof version as advised by Stephan202 in comments, thanks. </p>
| 15 | 2009-07-16T14:35:12Z | [
"python",
"string",
"list"
] |
Get first non-empty string from a list in python | 1,138,024 | <p>In Python I have a list of strings, some of which may be the empty string. What's the best way to get the first non-empty string?</p>
| 8 | 2009-07-16T14:30:41Z | 1,138,151 | <p>to get the first non empty string in a list, you just have to loop over it and check if its not empty. that's all there is to it.</p>
<pre><code>arr = ['','',2,"one"]
for i in arr:
if i:
print i
break
</code></pre>
| 0 | 2009-07-16T14:47:29Z | [
"python",
"string",
"list"
] |
Get first non-empty string from a list in python | 1,138,024 | <p>In Python I have a list of strings, some of which may be the empty string. What's the best way to get the first non-empty string?</p>
| 8 | 2009-07-16T14:30:41Z | 1,138,260 | <p>Here's a short way:</p>
<pre><code>filter(None, list_of_strings)[0]
</code></pre>
<p>EDIT:</p>
<p>Here's a slightly longer way that is better:</p>
<pre><code>from itertools import ifilter
ifilter(None, list_of_strings).next()
</code></pre>
| 2 | 2009-07-16T15:00:57Z | [
"python",
"string",
"list"
] |
Get first non-empty string from a list in python | 1,138,024 | <p>In Python I have a list of strings, some of which may be the empty string. What's the best way to get the first non-empty string?</p>
| 8 | 2009-07-16T14:30:41Z | 1,138,534 | <p>Based on your question I'll have to assume a lot, but to "get" the first non-empty string:</p>
<pre><code>(i for i, s in enumerate(x) if s).next()
</code></pre>
<p>which returns its index in the list. The 'x' binding points to your list of strings.</p>
| 0 | 2009-07-16T15:46:56Z | [
"python",
"string",
"list"
] |
Django Template Error : Template u'base.html' cannot be extended | 1,138,106 | <p>I get this error when I run a django app (<a href="http://github.com/bartTC/django-paste/tree" rel="nofollow">dpaste</a>)</p>
<pre><code>Template error
In template c:\python\projects\mycms\dpaste\templates\dpaste\base.html, error at line 1
Template u'base.html' cannot be extended, because it doesn't exist
1 {%... | 0 | 2009-07-16T14:42:20Z | 1,138,130 | <p>Your base.html template cannot extend itself. The problem lies there. Remove that line and replace it with valid html or other Django template tags (or extend some other template).</p>
| 3 | 2009-07-16T14:44:46Z | [
"python",
"django",
"django-templates"
] |
Django Template Error : Template u'base.html' cannot be extended | 1,138,106 | <p>I get this error when I run a django app (<a href="http://github.com/bartTC/django-paste/tree" rel="nofollow">dpaste</a>)</p>
<pre><code>Template error
In template c:\python\projects\mycms\dpaste\templates\dpaste\base.html, error at line 1
Template u'base.html' cannot be extended, because it doesn't exist
1 {%... | 0 | 2009-07-16T14:42:20Z | 1,138,131 | <p>A template can't extend itself. </p>
| 1 | 2009-07-16T14:44:53Z | [
"python",
"django",
"django-templates"
] |
Django Template Error : Template u'base.html' cannot be extended | 1,138,106 | <p>I get this error when I run a django app (<a href="http://github.com/bartTC/django-paste/tree" rel="nofollow">dpaste</a>)</p>
<pre><code>Template error
In template c:\python\projects\mycms\dpaste\templates\dpaste\base.html, error at line 1
Template u'base.html' cannot be extended, because it doesn't exist
1 {%... | 0 | 2009-07-16T14:42:20Z | 2,491,667 | <p>If you meant to say that:</p>
<pre><code>{% extends "base.html" %}
</code></pre>
<p>is the only line in the including template, not the base template, then maybe your problem is that "base.html" is relative to the template root.</p>
<p>So if in settings you have:</p>
<pre><code>TEMPLATE_DIRS = ("/home/me/mysite/... | 0 | 2010-03-22T11:10:14Z | [
"python",
"django",
"django-templates"
] |
Execution of script using Popen fails | 1,138,111 | <p>I need to execute a script in the background through a service.</p>
<p>The service kicks off the script using Popen.</p>
<pre><code>p = Popen('/path/to/script/script.py', shell=True)
</code></pre>
<p>Why doesn't the following script work when I include the file writes in the for loop?</p>
<pre><code>#!/usr/bin/p... | 1 | 2009-07-16T14:42:42Z | 1,138,149 | <p>What error are you getting? It's hard to see the problem without the error. Is there anyway that the file is opened somewhere else?</p>
| 0 | 2009-07-16T14:47:07Z | [
"python",
"mod-python",
"popen"
] |
Execution of script using Popen fails | 1,138,111 | <p>I need to execute a script in the background through a service.</p>
<p>The service kicks off the script using Popen.</p>
<pre><code>p = Popen('/path/to/script/script.py', shell=True)
</code></pre>
<p>Why doesn't the following script work when I include the file writes in the for loop?</p>
<pre><code>#!/usr/bin/p... | 1 | 2009-07-16T14:42:42Z | 1,138,261 | <p>Here's your bug:</p>
<pre><code>for x in (1,2,3,4,5):
fd.write(x + '\n')
</code></pre>
<p>You cannot sum an int to a string. Use instead (e.g.)</p>
<pre><code>for x in (1,2,3,4,5):
fd.write('%s\n' % x)
</code></pre>
| 1 | 2009-07-16T15:00:59Z | [
"python",
"mod-python",
"popen"
] |
Python: Get Mount Point on Windows or Linux | 1,138,383 | <p>I need a function to determine if a directory is a mount point for a drive.
I found this code already which works well for linux:</p>
<pre><code>def getmount(path):
path = os.path.abspath(path)
while path != os.path.sep:
if os.path.ismount(path):
return path
path = os.path.abspath(os.path.join(pat... | 5 | 2009-07-16T15:20:01Z | 1,138,411 | <p>Windows didn't use to call them "mount points" [<strong>edit</strong>: it now does, see below!], and the two typical/traditional syntaxes you can find for them are either a drive letter, e.g. <code>Z:</code>, or else <code>\\hostname</code> (with two leading backslashes: escape carefully or use <code>r'...'</code> n... | 3 | 2009-07-16T15:25:10Z | [
"python",
"windows",
"linux",
"operating-system",
"mount"
] |
Python: Get Mount Point on Windows or Linux | 1,138,383 | <p>I need a function to determine if a directory is a mount point for a drive.
I found this code already which works well for linux:</p>
<pre><code>def getmount(path):
path = os.path.abspath(path)
while path != os.path.sep:
if os.path.ismount(path):
return path
path = os.path.abspath(os.path.join(pat... | 5 | 2009-07-16T15:20:01Z | 1,139,594 | <p>Do you want to find the mount point or just determine if it is a mountpoint?</p>
<p>Regardless, as commented above, it is possible in WinXP to map a logical drive to a folder.</p>
<p>See here for details: <a href="http://www.modzone.dk/forums/showthread.php?threadid=278" rel="nofollow">http://www.modzone.dk/forum... | 3 | 2009-07-16T18:56:57Z | [
"python",
"windows",
"linux",
"operating-system",
"mount"
] |
Python: Get Mount Point on Windows or Linux | 1,138,383 | <p>I need a function to determine if a directory is a mount point for a drive.
I found this code already which works well for linux:</p>
<pre><code>def getmount(path):
path = os.path.abspath(path)
while path != os.path.sep:
if os.path.ismount(path):
return path
path = os.path.abspath(os.path.join(pat... | 5 | 2009-07-16T15:20:01Z | 6,835,904 | <p>Here is some code to return the UNC path pointed to by a drive letter. I suppose there is a more slick way to do this, but I thought I'd contribute my small part.</p>
<pre><code>import sys,os,string,re,win32file
for ch in string.uppercase: # use all uppercase letters, one at a time
dl = ch + ":"
try:
... | 0 | 2011-07-26T20:04:24Z | [
"python",
"windows",
"linux",
"operating-system",
"mount"
] |
Add SMTP AUTH support to Python smtpd library... can't override the method? | 1,138,425 | <p>So, I wanted to extend the Python smtpd SMTPServer class so that it could handle SMTP AUTH connections. Seemed simple enough... </p>
<p>So, it looked like I could just start like this: </p>
<pre><code>def smtp_EHLO(self, arg):
print 'got in arg: ', arg
# do stuff here...
</code></pre>
<p>But for some reas... | 2 | 2009-07-16T15:27:55Z | 1,138,474 | <p>You need to extend <code>SMTPChannel</code> -- that's where the <code>smtp_</code>verb methods are implemented; your extension of <code>SMTPServer</code> just needs to return your own subclass of the channel.</p>
| 3 | 2009-07-16T15:35:15Z | [
"python",
"smtp",
"smtpd",
"smtp-auth"
] |
Regex in python | 1,138,747 | <p>I'm trying to use regular expression right now and I'm really confuse. I want to make some validation with this regular expression : </p>
<pre><code>^[A-Za-z0-9_.][A-Za-z0-9_ ]*
</code></pre>
<p>I want to make it so there is a limit of character (32) and I want to "match" all the string.</p>
<p>ex:</p>
<p>string... | 0 | 2009-07-16T16:23:43Z | 1,138,757 | <p>this?</p>
<pre><code>^[A-Za-z0-9_.][A-Za-z0-9_ ]{0,31}$
</code></pre>
| 2 | 2009-07-16T16:26:15Z | [
"python",
"regex",
"validation"
] |
Regex in python | 1,138,747 | <p>I'm trying to use regular expression right now and I'm really confuse. I want to make some validation with this regular expression : </p>
<pre><code>^[A-Za-z0-9_.][A-Za-z0-9_ ]*
</code></pre>
<p>I want to make it so there is a limit of character (32) and I want to "match" all the string.</p>
<p>ex:</p>
<p>string... | 0 | 2009-07-16T16:23:43Z | 1,138,765 | <p>From 0 to 32 chars: </p>
<blockquote>
<p>^[\w\d_.]{0,32}$ </p>
</blockquote>
| 0 | 2009-07-16T16:27:44Z | [
"python",
"regex",
"validation"
] |
Alternative XML parser for ElementTree to ease UTF-8 woes? | 1,139,090 | <p>I am parsing some XML with the elementtree.parse() function. It works, except for some utf-8 characters(single byte character above 128). I see that the default parser is XMLTreeBuilder which is based on expat.</p>
<p>Is there an alternative parser that I can use that may be less strict and allow utf-8 characters... | 9 | 2009-07-16T17:32:17Z | 1,139,156 | <p>Byte 0x92 is never valid as the <em>first byte</em> of a UTF-8 character. It can be valid as a subsequent byte, however. See <a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8" rel="nofollow">this UTF-8 guide</a> for a table of valid byte sequences.</p>
<p>Could you give us an idea of what bytes are surroun... | 1 | 2009-07-16T17:41:49Z | [
"python",
"xml",
"utf-8",
"elementtree"
] |
Alternative XML parser for ElementTree to ease UTF-8 woes? | 1,139,090 | <p>I am parsing some XML with the elementtree.parse() function. It works, except for some utf-8 characters(single byte character above 128). I see that the default parser is XMLTreeBuilder which is based on expat.</p>
<p>Is there an alternative parser that I can use that may be less strict and allow utf-8 characters... | 9 | 2009-07-16T17:32:17Z | 1,139,556 | <p>It looks like you have CP1252 text. If so, it should be specified at the top of the file, eg.:</p>
<pre><code><?xml version="1.0" encoding="CP1252" ?>
</code></pre>
<p>This does work with ElementTree.</p>
<p>If you're creating these files yourself, don't write them in this encoding. Save them as UTF-8 and... | 4 | 2009-07-16T18:49:48Z | [
"python",
"xml",
"utf-8",
"elementtree"
] |
Alternative XML parser for ElementTree to ease UTF-8 woes? | 1,139,090 | <p>I am parsing some XML with the elementtree.parse() function. It works, except for some utf-8 characters(single byte character above 128). I see that the default parser is XMLTreeBuilder which is based on expat.</p>
<p>Is there an alternative parser that I can use that may be less strict and allow utf-8 characters... | 9 | 2009-07-16T17:32:17Z | 1,139,580 | <p>Ah. That is "can´t", obviously, and indeed, 0x92 is an apostrophe in many Windows code pages. Your editor assumes instead that it's a Mac file. ;)</p>
<p>If it's a one-off, fixing the file is the right thing to do. But almost always when you need to import other peoples XML there is a lot of things that simply do ... | 1 | 2009-07-16T18:53:36Z | [
"python",
"xml",
"utf-8",
"elementtree"
] |
Alternative XML parser for ElementTree to ease UTF-8 woes? | 1,139,090 | <p>I am parsing some XML with the elementtree.parse() function. It works, except for some utf-8 characters(single byte character above 128). I see that the default parser is XMLTreeBuilder which is based on expat.</p>
<p>Is there an alternative parser that I can use that may be less strict and allow utf-8 characters... | 9 | 2009-07-16T17:32:17Z | 1,141,456 | <p>I'll start from the question: "Is there an alternative parser that I can use that may be less strict and allow utf-8 characters?"</p>
<p>All XML parsers will accept data encoded in UTF-8. In fact, UTF-8 is the default encoding.</p>
<p>An XML document may start with a declaration like this:</p>
<pre><code>`<?xm... | 14 | 2009-07-17T04:43:54Z | [
"python",
"xml",
"utf-8",
"elementtree"
] |
Google App engine template unicode decoding problem | 1,139,151 | <p>When trying to render a Django template file in Google App Engine</p>
<blockquote>
<p>from google.appengine.ext.webapp import template</p>
<p>templatepath = os.path.join(os.path.dirname(<strong>file</strong>), 'template.html')<br>
self.response.out.write (template.render( templatepath , template_values))</... | 2 | 2009-07-16T17:40:56Z | 1,139,534 | <p>Did you check in your text editor that the template is encoded in utf-8? </p>
| 1 | 2009-07-16T18:46:13Z | [
"python",
"django",
"google-app-engine",
"unicode"
] |
Google App engine template unicode decoding problem | 1,139,151 | <p>When trying to render a Django template file in Google App Engine</p>
<blockquote>
<p>from google.appengine.ext.webapp import template</p>
<p>templatepath = os.path.join(os.path.dirname(<strong>file</strong>), 'template.html')<br>
self.response.out.write (template.render( templatepath , template_values))</... | 2 | 2009-07-16T17:40:56Z | 1,140,751 | <p>Are you using Django 0.96 or Django 1.0? You can check by looking at your main.py and seeing if it contains the following: </p>
<pre>
from google.appengine.dist import use_library
use_library('django', '1.0')</pre>
<p>If you're using Django 1.0, both FILE_CHARSET and DEFAULT_CHARSET should default to 'utf-8'. If y... | 2 | 2009-07-16T23:02:34Z | [
"python",
"django",
"google-app-engine",
"unicode"
] |
Google App engine template unicode decoding problem | 1,139,151 | <p>When trying to render a Django template file in Google App Engine</p>
<blockquote>
<p>from google.appengine.ext.webapp import template</p>
<p>templatepath = os.path.join(os.path.dirname(<strong>file</strong>), 'template.html')<br>
self.response.out.write (template.render( templatepath , template_values))</... | 2 | 2009-07-16T17:40:56Z | 1,141,420 | <p>Well, turns out the rendered results returned by the template needs to be decoded first:</p>
<blockquote>
<p>self.response.out.write (template.render( templatepath , template_values).decode('utf-8') )</p>
</blockquote>
<p>A silly mistake, but thanks for everyone's answers anyway. :)</p>
| 6 | 2009-07-17T04:21:06Z | [
"python",
"django",
"google-app-engine",
"unicode"
] |
Python RSA Decryption Using OpenSSL Generated Keys | 1,139,622 | <p>Does anyone know the simplest way to import an OpenSSL RSA private/public key (using a passphrase) with a Python library and use it to decrypt a message.</p>
<p>I've taken a look at ezPyCrypto, but can't seem to get it to recognise an OpenSSL RSA key, I've tried importing a key with importKey as follows:</p>
<pre... | 4 | 2009-07-16T19:00:44Z | 1,139,731 | <p>The first error is telling you that <code>importKey</code> needs to be called on an <em>instance</em> of <code>key</code>.</p>
<pre><code>k = key()
k.importKey(myKey, passphrase='PASSPHRASE')
</code></pre>
<p>However, the documentation seems to suggest that this is a better way of doing what you want:</p>
<pre><c... | 6 | 2009-07-16T19:18:07Z | [
"python",
"openssl",
"rsa",
"encryption"
] |
Python RSA Decryption Using OpenSSL Generated Keys | 1,139,622 | <p>Does anyone know the simplest way to import an OpenSSL RSA private/public key (using a passphrase) with a Python library and use it to decrypt a message.</p>
<p>I've taken a look at ezPyCrypto, but can't seem to get it to recognise an OpenSSL RSA key, I've tried importing a key with importKey as follows:</p>
<pre... | 4 | 2009-07-16T19:00:44Z | 1,139,800 | <p>It is not clear what are you trying to achieve, but you could give M2Crypto a try. From my point of view it is the best OpenSSL wrapper available for Python.</p>
<p>Here is a sample RSA encryption/decription code:</p>
<pre><code>import M2Crypto as m2c
import textwrap
key = m2c.RSA.load_key('key.pem', lambda prompt... | 5 | 2009-07-16T19:33:14Z | [
"python",
"openssl",
"rsa",
"encryption"
] |
Python inheritance and calling parent class constructor | 1,139,828 | <p>This is what I'm trying to do in Python: </p>
<pre><code>class BaseClass:
def __init__(self):
print 'The base class constructor ran!'
self.__test = 42
class ChildClass(BaseClass):
def __init__(self):
print 'The child class constructor ran!'
BaseClass.__init__(self)
def... | 14 | 2009-07-16T19:37:13Z | 1,139,845 | <p>From python documentation:</p>
<blockquote>
<p>Private name mangling: When an identifier that textually occurs in a class definition <strong>begins with two or more underscore</strong> characters and does not end in two or more underscores, it is considered a <strong>private name</strong> of that class. Private n... | 20 | 2009-07-16T19:39:04Z | [
"python",
"oop"
] |
Python inheritance and calling parent class constructor | 1,139,828 | <p>This is what I'm trying to do in Python: </p>
<pre><code>class BaseClass:
def __init__(self):
print 'The base class constructor ran!'
self.__test = 42
class ChildClass(BaseClass):
def __init__(self):
print 'The child class constructor ran!'
BaseClass.__init__(self)
def... | 14 | 2009-07-16T19:37:13Z | 1,139,850 | <p>Double underscored variables can be considered "private". They are mangled with the class name, amongst other to protect multiple baseclasses from overriding eachothers members.</p>
<p>Use a single underscore if you want your attribute to be considered private by other developers.</p>
| 3 | 2009-07-16T19:41:17Z | [
"python",
"oop"
] |
Python inheritance and calling parent class constructor | 1,139,828 | <p>This is what I'm trying to do in Python: </p>
<pre><code>class BaseClass:
def __init__(self):
print 'The base class constructor ran!'
self.__test = 42
class ChildClass(BaseClass):
def __init__(self):
print 'The child class constructor ran!'
BaseClass.__init__(self)
def... | 14 | 2009-07-16T19:37:13Z | 1,139,970 | <p>You could use Python's introspection facilities to get you the information you are looking for.
A simple dir(test) will give you</p>
<pre><code>['_BaseClass__test', '__doc__', '__init__', '__module__', 'doSomething']
</code></pre>
<p>Note the '_BaseClass__test'. That's what you're looking for.</p>
<p>Check <a hre... | 5 | 2009-07-16T20:06:41Z | [
"python",
"oop"
] |
Python fails to execute firefox webbrowser from a root executed script with privileges drop | 1,139,835 | <p>I can't run firefox from a sudoed python script that drops privileges to normal user. If i write</p>
<pre>
$ sudo python
>>> import os
>>> import pwd, grp
>>> uid = pwd.getpwnam('norby')[2]
>>> gid = grp.getgrnam('norby')[2]
>>> os.setegid(gid)
>>> os.seteuid(uid)
>>> import webbrowser
>>> webbrowser.get('firefox')... | 0 | 2009-07-16T19:38:18Z | 1,140,199 | <p>This could be your environment. Changing the permissions will still leave environment variables like $HOME pointing at the root user's directory, which will be inaccessible. It may be worth trying altering these variables by changing <code>os.environ</code> before launching the browser. There may also be other va... | 1 | 2009-07-16T20:47:04Z | [
"python",
"browser",
"debian",
"uid"
] |
In Python, how do I obtain the current frame? | 1,140,194 | <p>In other languages I can obtain the current frame via a reflection api to determine what variables are local to the scope that I an currently in.</p>
<p>Is there a way to do this in Python?</p>
| 20 | 2009-07-16T20:45:55Z | 1,140,211 | <p>See the <a href="http://docs.python.org/library/functions.html" rel="nofollow">dir</a> function.</p>
<p>sorry - not actually relevant to the frame, but still useful!</p>
| -3 | 2009-07-16T20:48:51Z | [
"python"
] |
In Python, how do I obtain the current frame? | 1,140,194 | <p>In other languages I can obtain the current frame via a reflection api to determine what variables are local to the scope that I an currently in.</p>
<p>Is there a way to do this in Python?</p>
| 20 | 2009-07-16T20:45:55Z | 1,140,231 | <pre><code>import sys
sys._getframe(number)
</code></pre>
<p>The number being 0 for the current frame and 1 for the frame up and so on up.</p>
<p>The best introduction I have found to frames in python is <a href="http://farmdev.com/src/secrets/framehack/index.html">here</a></p>
<p>However, look at the inspect mo... | 28 | 2009-07-16T20:52:27Z | [
"python"
] |
In Python, how do I obtain the current frame? | 1,140,194 | <p>In other languages I can obtain the current frame via a reflection api to determine what variables are local to the scope that I an currently in.</p>
<p>Is there a way to do this in Python?</p>
| 20 | 2009-07-16T20:45:55Z | 1,140,513 | <p>I use these little guys for debugging and logging:</p>
<pre><code>import sys
def LINE( back = 0 ):
return sys._getframe( back + 1 ).f_lineno
def FILE( back = 0 ):
return sys._getframe( back + 1 ).f_code.co_filename
def FUNC( back = 0):
return sys._getframe( back + 1 ).f_code.co_name
def WHERE( back = 0 ... | 17 | 2009-07-16T21:46:50Z | [
"python"
] |
In Python, how do I obtain the current frame? | 1,140,194 | <p>In other languages I can obtain the current frame via a reflection api to determine what variables are local to the scope that I an currently in.</p>
<p>Is there a way to do this in Python?</p>
| 20 | 2009-07-16T20:45:55Z | 16,502,277 | <p>The best answer would be to use the <a href="http://docs.python.org/2/library/inspect.html#inspect.currentframe">inspect</a> module; not a private function in <code>sys</code>.</p>
<pre><code>import inspect
current_frame = inspect.currentframe()
</code></pre>
| 16 | 2013-05-11T22:23:43Z | [
"python"
] |
Using Python to Automate Creation/Manipulation of Excel Spreadsheets | 1,140,311 | <p>I have some data in CSV format that I want to pull into an Excel spreadsheet and then create some standard set of graphs for. Since the data is originally generated in a Python app, I was hoping to simply extend the app so that it could do all the post processing and I wouldn't have to do it by hand. Is there an eas... | 3 | 2009-07-16T20:51:51Z | 1,140,366 | <p>On Windows you could use the <a href="https://sourceforge.net/projects/pywin32/" rel="nofollow">pywin32</a> package to create an Excel COM Object and then manipulate it from a script. You need to have an installed Excel on that machine though. I haven't done this myself so I can't give you and details but I've seen ... | 1 | 2009-07-16T21:19:21Z | [
"python",
"excel"
] |
Using Python to Automate Creation/Manipulation of Excel Spreadsheets | 1,140,311 | <p>I have some data in CSV format that I want to pull into an Excel spreadsheet and then create some standard set of graphs for. Since the data is originally generated in a Python app, I was hoping to simply extend the app so that it could do all the post processing and I wouldn't have to do it by hand. Is there an eas... | 3 | 2009-07-16T20:51:51Z | 1,140,370 | <p><a href="http://pypi.python.org/pypi/xlutils" rel="nofollow">xlutils</a> (and the included packages <code>xlrd</code> and <code>xlwt</code>) should allow your Python program to handily do any creation, reading and manipulation of Excel files you might want!</p>
| 7 | 2009-07-16T21:19:42Z | [
"python",
"excel"
] |
Whatâs the best way to get an HTTP response code from a URL? | 1,140,661 | <p>Iâm looking for a quick way to get an HTTP response code from a URL (i.e. 200, 404, etc). Iâm not sure which library to use.</p>
| 38 | 2009-07-16T22:27:54Z | 1,140,675 | <p>You should use urllib2, like this:</p>
<pre><code>import urllib2
for url in ["http://entrian.com/", "http://entrian.com/does-not-exist/"]:
try:
connection = urllib2.urlopen(url)
print connection.getcode()
connection.close()
except urllib2.HTTPError, e:
print e.getcode()
# Pr... | 19 | 2009-07-16T22:31:33Z | [
"python"
] |
Whatâs the best way to get an HTTP response code from a URL? | 1,140,661 | <p>Iâm looking for a quick way to get an HTTP response code from a URL (i.e. 200, 404, etc). Iâm not sure which library to use.</p>
| 38 | 2009-07-16T22:27:54Z | 1,140,822 | <p>Here's a solution that uses <code>httplib</code> instead.</p>
<pre><code>import httplib
def get_status_code(host, path="/"):
""" This function retreives the status code of a website by requesting
HEAD data from the host. This means that it only requests the headers.
If the host cannot be reache... | 55 | 2009-07-16T23:30:43Z | [
"python"
] |
Whatâs the best way to get an HTTP response code from a URL? | 1,140,661 | <p>Iâm looking for a quick way to get an HTTP response code from a URL (i.e. 200, 404, etc). Iâm not sure which library to use.</p>
| 38 | 2009-07-16T22:27:54Z | 1,491,225 | <p>The <code>urllib2.HTTPError</code> exception does not contain a <code>getcode()</code> method. Use the <code>code</code> attribute instead.</p>
| 2 | 2009-09-29T08:19:50Z | [
"python"
] |
Whatâs the best way to get an HTTP response code from a URL? | 1,140,661 | <p>Iâm looking for a quick way to get an HTTP response code from a URL (i.e. 200, 404, etc). Iâm not sure which library to use.</p>
| 38 | 2009-07-16T22:27:54Z | 12,866,650 | <p>In future, for those that use python3 and later, here's another code to find response code.</p>
<pre><code>import urllib.request
def getResponseCode(url):
conn = urllib.request.urlopen(url)
return conn.getcode()
</code></pre>
| 2 | 2012-10-12T20:30:29Z | [
"python"
] |
Whatâs the best way to get an HTTP response code from a URL? | 1,140,661 | <p>Iâm looking for a quick way to get an HTTP response code from a URL (i.e. 200, 404, etc). Iâm not sure which library to use.</p>
| 38 | 2009-07-16T22:27:54Z | 13,641,613 | <p>Update using the wonderful <a href="http://docs.python-requests.org/en/latest/">requests library</a>. Note we are using the HEAD request, which should happen more quickly then a full GET or POST request. </p>
<pre><code>import requests
try:
r = requests.head("http://stackoverflow.com")
print(r.status_code)
... | 40 | 2012-11-30T08:40:39Z | [
"python"
] |
Whatâs the best way to get an HTTP response code from a URL? | 1,140,661 | <p>Iâm looking for a quick way to get an HTTP response code from a URL (i.e. 200, 404, etc). Iâm not sure which library to use.</p>
| 38 | 2009-07-16T22:27:54Z | 22,123,762 | <p>Here's an <code>httplib</code> solution that behaves like urllib2. You can just give it a URL and it just works. No need to mess about splitting up your URLs into hostname and path. This function already does that.</p>
<pre><code>import httplib
import socket
def get_link_status(url):
"""
Gets the HTTP stat... | -1 | 2014-03-02T04:14:55Z | [
"python"
] |
Add local variable to running generator | 1,140,665 | <p>Lately, I tried to set local variables from outside of a running generator. The generator code also should access these variables.</p>
<p>One trouble was, that when accessing the variables, it seamed that the interpreter was thinking it must be a global since the variable was not set in the local scope. But I don't... | 1 | 2009-07-16T22:28:34Z | 1,140,700 | <p>locals() always returns a read-only dict. You could create your own "locals" dictionary:</p>
<pre><code>def gen_func():
lcls = {}
for i in range(5):
yield (i, lcls)
print lcls
for (val, lcls) in gen_func():
lcls[val] = val
</code></pre>
<p>Any other mutable structure will also work.</... | 0 | 2009-07-16T22:38:18Z | [
"python",
"variables",
"generator",
"local"
] |
Add local variable to running generator | 1,140,665 | <p>Lately, I tried to set local variables from outside of a running generator. The generator code also should access these variables.</p>
<p>One trouble was, that when accessing the variables, it seamed that the interpreter was thinking it must be a global since the variable was not set in the local scope. But I don't... | 1 | 2009-07-16T22:28:34Z | 1,140,735 | <p>What you may be looking for, is the <a href="http://docs.python.org/reference/expressions.html#generator.send" rel="nofollow"><code>send</code></a> method, which allows a value to be <em>sent into</em> a generator. <a href="http://docs.python.org/reference/expressions.html#yield-expressions" rel="nofollow">The refer... | 4 | 2009-07-16T22:56:04Z | [
"python",
"variables",
"generator",
"local"
] |
Add local variable to running generator | 1,140,665 | <p>Lately, I tried to set local variables from outside of a running generator. The generator code also should access these variables.</p>
<p>One trouble was, that when accessing the variables, it seamed that the interpreter was thinking it must be a global since the variable was not set in the local scope. But I don't... | 1 | 2009-07-16T22:28:34Z | 1,140,891 | <p>If you want to have a coroutine or a generator that also acts as a sink, you should use the send method, as in <a href="http://stackoverflow.com/questions/1140665/add-local-variable-to-running-generator/1140735#1140735">Stephan202's answers</a>. If you want to change the runtime behavior by settings various attribut... | 1 | 2009-07-16T23:59:36Z | [
"python",
"variables",
"generator",
"local"
] |
xml.parsers.expat.ExpatError on parsing XML | 1,140,672 | <p>I am trying to parse XML with Python but not getting very far. I think it's due to wrong XML tree this API returns.</p>
<p>So this is what is returned by the GET request:</p>
<pre><code><codigo>3</codigo><valor></valor><operador>Dummy</operador>
</code></pre>
<p>The GET request... | 6 | 2009-07-16T22:30:28Z | 1,140,708 | <p>An XML document consists of <em>one</em> top level document element, and then multiple subelements. Your XML fragment contains multiple top level elements, which is not permitted by the XML standard.</p>
<p>Try returning something like:</p>
<pre><code><result><codigo>3</codigo><valor></v... | 2 | 2009-07-16T22:40:22Z | [
"python",
"xml"
] |
xml.parsers.expat.ExpatError on parsing XML | 1,140,672 | <p>I am trying to parse XML with Python but not getting very far. I think it's due to wrong XML tree this API returns.</p>
<p>So this is what is returned by the GET request:</p>
<pre><code><codigo>3</codigo><valor></valor><operador>Dummy</operador>
</code></pre>
<p>The GET request... | 6 | 2009-07-16T22:30:28Z | 1,140,753 | <p>The main problem here is that the XML code being returned by that service doesn't include a root node, which is invalid. I fixed this by simply wrapping the output in a <code><root></code> node.</p>
<pre><code>import urllib
from xml.etree import ElementTree
url = 'http://69.36.9.147:8090/clientes/SMS_API_OUT... | 12 | 2009-07-16T23:03:34Z | [
"python",
"xml"
] |
How can I get the string result of a python method from the XML-RPC client in Java | 1,140,752 | <p>I wrote:</p>
<pre><code>Object result = (Object)client.execute("method",params);
</code></pre>
<p>in java client.</p>
<p>Actually, the result should be printed in string format. But I can only output the address of "Object result", how can I get the content?</p>
<p>And I have tried String result = (String)client... | 0 | 2009-07-16T23:03:19Z | 1,140,895 | <p>I'm hesitant to post this because it seems rather obvious - forgive me if you've tried this, but how about:</p>
<pre><code>String result = (String)client.execute("method",params);
</code></pre>
| 0 | 2009-07-16T23:59:54Z | [
"java",
"python",
"xml-rpc"
] |
How can I get the string result of a python method from the XML-RPC client in Java | 1,140,752 | <p>I wrote:</p>
<pre><code>Object result = (Object)client.execute("method",params);
</code></pre>
<p>in java client.</p>
<p>Actually, the result should be printed in string format. But I can only output the address of "Object result", how can I get the content?</p>
<p>And I have tried String result = (String)client... | 0 | 2009-07-16T23:03:19Z | 1,141,346 | <p>so maybe the object returned is not a string... are you sure that you're returning a string in your python application? I seriously doubt it.</p>
| 0 | 2009-07-17T03:37:59Z | [
"java",
"python",
"xml-rpc"
] |
Parsing Meaning from Text | 1,140,908 | <p>I realize this is a broad topic, but I'm looking for a good primer on parsing meaning from text, ideally in Python. As an example of what I'm looking to do, if a user makes a blog post like:</p>
<p>"Manny Ramirez makes his return for the Dodgers today against the Houston Astros",</p>
<p>what's a light-weight/ easy... | 9 | 2009-07-17T00:05:09Z | 1,140,917 | <p>You need to look at the <a href="http://www.nltk.org/">Natural Language Toolkit</a>, which is for exactly this sort of thing.</p>
<p>This section of the manual looks very relevant: <a href="http://nltk.googlecode.com/svn/trunk/doc/book/ch05.html">Categorizing and Tagging Words</a> - here's an extract:</p>
<pre><co... | 8 | 2009-07-17T00:07:54Z | [
"python",
"parsing",
"nlp",
"lexical-analysis"
] |
Parsing Meaning from Text | 1,140,908 | <p>I realize this is a broad topic, but I'm looking for a good primer on parsing meaning from text, ideally in Python. As an example of what I'm looking to do, if a user makes a blog post like:</p>
<p>"Manny Ramirez makes his return for the Dodgers today against the Houston Astros",</p>
<p>what's a light-weight/ easy... | 9 | 2009-07-17T00:05:09Z | 1,140,928 | <p>This is a really really complicated topic. Generally, this sort of stuff falls under the rubric of Natural Language Processing, and tends to be tricky at best. The difficulty of this sort of stuff is precisely why there still is no completely automated system for handling customer service and the like.</p>
<p>Gen... | 1 | 2009-07-17T00:10:30Z | [
"python",
"parsing",
"nlp",
"lexical-analysis"
] |
Parsing Meaning from Text | 1,140,908 | <p>I realize this is a broad topic, but I'm looking for a good primer on parsing meaning from text, ideally in Python. As an example of what I'm looking to do, if a user makes a blog post like:</p>
<p>"Manny Ramirez makes his return for the Dodgers today against the Houston Astros",</p>
<p>what's a light-weight/ easy... | 9 | 2009-07-17T00:05:09Z | 1,140,930 | <p>What you want is called NP (noun phrase) chunking, or extraction.</p>
<p><a href="http://nlp.stanford.edu/links/statnlp.html" rel="nofollow">Some links here</a></p>
<p>As pointed out, this is very problem domain specific stuff. The more you can narrow it down, the more effective it will be. And you're going to hav... | 3 | 2009-07-17T00:11:58Z | [
"python",
"parsing",
"nlp",
"lexical-analysis"
] |
Parsing Meaning from Text | 1,140,908 | <p>I realize this is a broad topic, but I'm looking for a good primer on parsing meaning from text, ideally in Python. As an example of what I'm looking to do, if a user makes a blog post like:</p>
<p>"Manny Ramirez makes his return for the Dodgers today against the Houston Astros",</p>
<p>what's a light-weight/ easy... | 9 | 2009-07-17T00:05:09Z | 1,140,931 | <p>Here is the book I stumbled upon recently: <a href="http://rads.stackoverflow.com/amzn/click/0596516495" rel="nofollow">Natural Language Processing with Python</a> </p>
| 4 | 2009-07-17T00:12:15Z | [
"python",
"parsing",
"nlp",
"lexical-analysis"
] |
Parsing Meaning from Text | 1,140,908 | <p>I realize this is a broad topic, but I'm looking for a good primer on parsing meaning from text, ideally in Python. As an example of what I'm looking to do, if a user makes a blog post like:</p>
<p>"Manny Ramirez makes his return for the Dodgers today against the Houston Astros",</p>
<p>what's a light-weight/ easy... | 9 | 2009-07-17T00:05:09Z | 1,140,938 | <p>Natural Language Processing (NLP) is the name for parsing, well, natural language. Many algorithms and heuristics exist, and it's an active field of research. Whatever algorithm you will code, it will need to be trained on a corpus. Just like a human: we learn a language by reading text written by other people (and/... | 7 | 2009-07-17T00:15:09Z | [
"python",
"parsing",
"nlp",
"lexical-analysis"
] |
Parsing Meaning from Text | 1,140,908 | <p>I realize this is a broad topic, but I'm looking for a good primer on parsing meaning from text, ideally in Python. As an example of what I'm looking to do, if a user makes a blog post like:</p>
<p>"Manny Ramirez makes his return for the Dodgers today against the Houston Astros",</p>
<p>what's a light-weight/ easy... | 9 | 2009-07-17T00:05:09Z | 1,141,386 | <p>Use the <a href="http://www.nltk.org/" rel="nofollow">NLTK</a>, in particular <a href="http://www.nltk.org/book/ch07.html" rel="nofollow">chapter 7 on Information Extraction.</a></p>
<p>You say you want to extract meaning, and there are modules for semantic analysis, but I think IE is all you need--and honestly one... | 8 | 2009-07-17T03:58:18Z | [
"python",
"parsing",
"nlp",
"lexical-analysis"
] |
Parsing Meaning from Text | 1,140,908 | <p>I realize this is a broad topic, but I'm looking for a good primer on parsing meaning from text, ideally in Python. As an example of what I'm looking to do, if a user makes a blog post like:</p>
<p>"Manny Ramirez makes his return for the Dodgers today against the Houston Astros",</p>
<p>what's a light-weight/ easy... | 9 | 2009-07-17T00:05:09Z | 34,146,248 | <p>Regular expressions can help in some scenario. Here is a detailed example: <a href="http://twainscanning.com/whats-the-most-mentioned-scanner-on-cnet-forum/" rel="nofollow">Whatâs the Most Mentioned Scanner on CNET Forum</a>, which used a regular expression to find all mentioned scanners in CNET forum posts. </p>
... | -1 | 2015-12-08T01:04:45Z | [
"python",
"parsing",
"nlp",
"lexical-analysis"
] |
What's a quick one-liner to remove empty lines from a python string? | 1,140,958 | <p>I have some code in a python string that contains extraneous empty lines. I would like to remove all empty lines from the string. What's the most pythonic way to do this?</p>
<p>Note: I'm not looking for a general code re-formatter, just a quick one or two-liner. </p>
<p>Thanks!</p>
| 29 | 2009-07-17T00:21:12Z | 1,140,966 | <p>How about:</p>
<pre><code>text = os.linesep.join([s for s in text.splitlines() if s])
</code></pre>
<p>where <code>text</code> is the string with the possible extraneous lines?</p>
| 52 | 2009-07-17T00:25:15Z | [
"python",
"string",
"line-endings"
] |
What's a quick one-liner to remove empty lines from a python string? | 1,140,958 | <p>I have some code in a python string that contains extraneous empty lines. I would like to remove all empty lines from the string. What's the most pythonic way to do this?</p>
<p>Note: I'm not looking for a general code re-formatter, just a quick one or two-liner. </p>
<p>Thanks!</p>
| 29 | 2009-07-17T00:21:12Z | 1,140,967 | <pre><code>"\n".join([s for s in code.split("\n") if s])
</code></pre>
<p>Edit2:</p>
<pre><code>text = "".join([s for s in code.splitlines(True) if s.strip("\r\n")])
</code></pre>
<p>I think that's my final version. It should work well even with code mixing line endings. I don't think that line with spaces should be... | 10 | 2009-07-17T00:25:18Z | [
"python",
"string",
"line-endings"
] |
What's a quick one-liner to remove empty lines from a python string? | 1,140,958 | <p>I have some code in a python string that contains extraneous empty lines. I would like to remove all empty lines from the string. What's the most pythonic way to do this?</p>
<p>Note: I'm not looking for a general code re-formatter, just a quick one or two-liner. </p>
<p>Thanks!</p>
| 29 | 2009-07-17T00:21:12Z | 1,141,067 | <p>This one will remove lines of spaces too.</p>
<p><code>re.replace(u'(?imu)^\s*\n', u'', code)</code></p>
| 3 | 2009-07-17T01:15:55Z | [
"python",
"string",
"line-endings"
] |
What's a quick one-liner to remove empty lines from a python string? | 1,140,958 | <p>I have some code in a python string that contains extraneous empty lines. I would like to remove all empty lines from the string. What's the most pythonic way to do this?</p>
<p>Note: I'm not looking for a general code re-formatter, just a quick one or two-liner. </p>
<p>Thanks!</p>
| 29 | 2009-07-17T00:21:12Z | 1,141,893 | <pre><code>filter(None, code.splitlines())
filter(str.strip, code.splitlines())
</code></pre>
<p>are equivalent to</p>
<pre><code>[s for s in code.splitlines() if s]
[s for s in code.splitlines() if s.strip()]
</code></pre>
<p>and might be useful for readability</p>
| 10 | 2009-07-17T07:46:23Z | [
"python",
"string",
"line-endings"
] |
What's a quick one-liner to remove empty lines from a python string? | 1,140,958 | <p>I have some code in a python string that contains extraneous empty lines. I would like to remove all empty lines from the string. What's the most pythonic way to do this?</p>
<p>Note: I'm not looking for a general code re-formatter, just a quick one or two-liner. </p>
<p>Thanks!</p>
| 29 | 2009-07-17T00:21:12Z | 1,142,968 | <p>And now for something completely different:</p>
<pre><code>Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> import string, re
>>> tidy = lambda s: string.join(filter(string.strip, re.split(r'[\r\n]+', s)), '\n'... | 0 | 2009-07-17T12:24:59Z | [
"python",
"string",
"line-endings"
] |
What's a quick one-liner to remove empty lines from a python string? | 1,140,958 | <p>I have some code in a python string that contains extraneous empty lines. I would like to remove all empty lines from the string. What's the most pythonic way to do this?</p>
<p>Note: I'm not looking for a general code re-formatter, just a quick one or two-liner. </p>
<p>Thanks!</p>
| 29 | 2009-07-17T00:21:12Z | 24,172,715 | <p><strong>LESSON ON REMOVING NEWLINES and EMPTY LINES WITH SPACES</strong></p>
<p>"t" is the variable with the text. You will see an "s" variable, its a temporary variable that only exists during the evaluation of the main set of parenthesis (forgot the name of these lil python things)</p>
<p>First lets set the "t" ... | 6 | 2014-06-11T21:16:55Z | [
"python",
"string",
"line-endings"
] |
Traversing a Python object tree | 1,141,039 | <p>I'm trying to implement dynamic reloading objects in Python, that reflect code changes live.</p>
<p>Modules reloading is working, but I have to recreate every instance of the modules' classes for changes to become effective.</p>
<p>The problem is that objects data (objects <code>__dict__</code> content) is lost du... | 1 | 2009-07-17T00:59:26Z | 1,141,199 | <p>See <a href="http://code.activestate.com/recipes/160164/" rel="nofollow">this recipe</a> in the Python Cookbook (or maybe even better its version in the "printed" one, which I believe you can actually read for free with google book search, or for sure on O'Reilly's "Safari" site using a free 1-week trial subscriptio... | 1 | 2009-07-17T02:24:12Z | [
"python",
"reload",
"traversal"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.