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
list
Converting from mod_python to mod_wsgi
644,767
<p>My website is written in Python and currently runs under mod_python with Apache. Lately I've had to put in a few ugly hacks that make me think it might be worth converting the site to mod_wsgi. But I've gotten used to using some of mod_python's utility classes, especially <code>FieldStorage</code> and <code>Session<...
11
2009-03-13T21:56:15Z
644,774
<p>Look at <a href="http://werkzeug.pocoo.org/">Werkzeug</a>. You may have to do some rewriting. You will probably be pleased with the results of imposing the WSGI world-view on your application.</p>
9
2009-03-13T22:00:40Z
[ "python", "mod-wsgi", "mod-python" ]
Converting from mod_python to mod_wsgi
644,767
<p>My website is written in Python and currently runs under mod_python with Apache. Lately I've had to put in a few ugly hacks that make me think it might be worth converting the site to mod_wsgi. But I've gotten used to using some of mod_python's utility classes, especially <code>FieldStorage</code> and <code>Session<...
11
2009-03-13T21:56:15Z
846,529
<p>Please look at <a href="http://aaron.oirt.rutgers.edu/myapp/docs/W.intro" rel="nofollow"> whiff</a> -- it provides built in functionality for manipulating field data and sessions among others to wsgi based applications.</p>
1
2009-05-11T02:29:55Z
[ "python", "mod-wsgi", "mod-python" ]
Converting from mod_python to mod_wsgi
644,767
<p>My website is written in Python and currently runs under mod_python with Apache. Lately I've had to put in a few ugly hacks that make me think it might be worth converting the site to mod_wsgi. But I've gotten used to using some of mod_python's utility classes, especially <code>FieldStorage</code> and <code>Session<...
11
2009-03-13T21:56:15Z
1,037,884
<p>You can use FieldStorage in 'cgi' module and the 'Cookie' module. There is no equivalent to Session in Python standard libraries. For WSGI applications you can use <a href="http://beaker.groovie.org/" rel="nofollow">Beaker</a> for sessions.</p>
2
2009-06-24T11:54:13Z
[ "python", "mod-wsgi", "mod-python" ]
Matplotlib's GUI doesn't allow typing in save box?
644,812
<p>I've been using matplotlib in python for some time now and I've finally gotten around to asking this question about an issue on my mac. When a plot shows up (after the <code>plot()</code> command, <code>draw()</code>, or <code>show()</code>), I have all the functionality I could want; I can move, zoom, etc. that I d...
4
2009-03-13T22:18:35Z
1,863,860
<p>Just installed matplotlib 0.99.1 on Python 2.6.2 on Snow Leopard and ran the following code:</p> <pre><code>from pylab import * plot([1,2,3]) show() </code></pre> <p>Then, I fiddled around with the plot for a while and clicked the save button. The save dialog box popped up normally and allowed me to save (and type...
1
2009-12-08T00:47:12Z
[ "python", "matplotlib" ]
Python: How to run unittest.main() for all source files in a subdirectory?
644,821
<p>I am developing a Python module with several source files, each with its own test class derived from <a href="http://docs.python.org/library/unittest.html">unittest</a> right in the source. Consider the directory structure:</p> <pre><code>dirFoo\ test.py dirBar\ __init__.py Foo.py B...
41
2009-03-13T22:20:31Z
644,844
<p>I knew there was an obvious solution:</p> <pre><code>dirFoo\ __init__.py test.py dirBar\ Foo.py Bar.py </code></pre> <p>Contents of dirFoo/test.py</p> <pre><code>from dirBar import * import unittest if __name__ == "__main__": unittest.main() </code></pre> <p>Run the tests:</p> ...
18
2009-03-13T22:29:58Z
[ "python", "unit-testing" ]
Python: How to run unittest.main() for all source files in a subdirectory?
644,821
<p>I am developing a Python module with several source files, each with its own test class derived from <a href="http://docs.python.org/library/unittest.html">unittest</a> right in the source. Consider the directory structure:</p> <pre><code>dirFoo\ test.py dirBar\ __init__.py Foo.py B...
41
2009-03-13T22:20:31Z
644,987
<p>You should try <a href="http://nose.readthedocs.io/en/latest/" rel="nofollow">nose</a>. It's a library to help create tests and it integrates with <code>unittest</code> or <code>doctest</code>. All you need to do is run <code>nosetests</code> and it'll find all your unittests for you.</p> <pre><code>% nosetests # f...
15
2009-03-13T23:35:04Z
[ "python", "unit-testing" ]
Python: How to run unittest.main() for all source files in a subdirectory?
644,821
<p>I am developing a Python module with several source files, each with its own test class derived from <a href="http://docs.python.org/library/unittest.html">unittest</a> right in the source. Consider the directory structure:</p> <pre><code>dirFoo\ test.py dirBar\ __init__.py Foo.py B...
41
2009-03-13T22:20:31Z
645,485
<p>I came up with a snippet that may do what you want. It walks a path that you provide looking for Python packages/modules and accumulates a set of test suites from those modules, which it then executes all at once.</p> <p>The nice thing about this is that it will work on all packages nested under the directory you s...
2
2009-03-14T06:01:05Z
[ "python", "unit-testing" ]
Python: How to run unittest.main() for all source files in a subdirectory?
644,821
<p>I am developing a Python module with several source files, each with its own test class derived from <a href="http://docs.python.org/library/unittest.html">unittest</a> right in the source. Consider the directory structure:</p> <pre><code>dirFoo\ test.py dirBar\ __init__.py Foo.py B...
41
2009-03-13T22:20:31Z
9,407,536
<p>As of Python 2.7, test discovery is automated in the unittest package. From the <a href="http://docs.python.org/library/unittest.html">docs</a>:</p> <blockquote> <p>Unittest supports simple test discovery. In order to be compatible with test discovery, all of the test files must be modules or packages importa...
43
2012-02-23T05:12:03Z
[ "python", "unit-testing" ]
Python: How to run unittest.main() for all source files in a subdirectory?
644,821
<p>I am developing a Python module with several source files, each with its own test class derived from <a href="http://docs.python.org/library/unittest.html">unittest</a> right in the source. Consider the directory structure:</p> <pre><code>dirFoo\ test.py dirBar\ __init__.py Foo.py B...
41
2009-03-13T22:20:31Z
13,533,236
<p>Here is my test discovery code that seems to do the job. I wanted to make sure I can extend the tests easily without having to list them in any of the involved files, but also avoid writing all tests in one single Übertest file. </p> <p>So the structure is </p> <pre><code>myTests.py testDir\ __init__.py t...
18
2012-11-23T17:02:19Z
[ "python", "unit-testing" ]
Python: How to run unittest.main() for all source files in a subdirectory?
644,821
<p>I am developing a Python module with several source files, each with its own test class derived from <a href="http://docs.python.org/library/unittest.html">unittest</a> right in the source. Consider the directory structure:</p> <pre><code>dirFoo\ test.py dirBar\ __init__.py Foo.py B...
41
2009-03-13T22:20:31Z
27,630,375
<p>In case it happens to help anyone, here is the approach I arrived at for solving this problem. I had the use case where I have the following directory structure:</p> <pre><code>mypackage/ tests/ test_category_1/ tests_1a.py tests_1b.py ... test_category_2/ ...
0
2014-12-24T01:36:41Z
[ "python", "unit-testing" ]
What is the quickest way to HTTP GET in Python?
645,312
<p>What is the quickest way to HTTP GET in Python if I know the Content will be a string? I am searching the docs for a quick one-liner like:</p> <pre><code>contents = url.get("http://example.com/foo/bar") </code></pre> <p>But all I can find using Google are <code>httplib</code> and <code>urllib</code> - and I am una...
267
2009-03-14T03:44:22Z
645,318
<p>Python 2.x:</p> <pre><code>import urllib2 urllib2.urlopen("http://example.com/foo/bar").read() </code></pre> <p>Python 3.x:</p> <pre><code>import urllib.request urllib.request.urlopen("http://example.com/foo/bar").read() </code></pre> <p>Documentation for <a href="https://docs.python.org/3.5/library/urllib.reque...
386
2009-03-14T03:48:24Z
[ "python", "http", "networking" ]
What is the quickest way to HTTP GET in Python?
645,312
<p>What is the quickest way to HTTP GET in Python if I know the Content will be a string? I am searching the docs for a quick one-liner like:</p> <pre><code>contents = url.get("http://example.com/foo/bar") </code></pre> <p>But all I can find using Google are <code>httplib</code> and <code>urllib</code> - and I am una...
267
2009-03-14T03:44:22Z
646,159
<p>Have a look at <a href="http://code.google.com/p/httplib2/">httplib2</a>, which - next to a lot of very useful features - provides exactly what you want.</p> <pre><code>import httplib2 resp, content = httplib2.Http().request("http://example.com/foo/bar") </code></pre> <p>Where content would be the response body (...
13
2009-03-14T16:13:13Z
[ "python", "http", "networking" ]
What is the quickest way to HTTP GET in Python?
645,312
<p>What is the quickest way to HTTP GET in Python if I know the Content will be a string? I am searching the docs for a quick one-liner like:</p> <pre><code>contents = url.get("http://example.com/foo/bar") </code></pre> <p>But all I can find using Google are <code>httplib</code> and <code>urllib</code> - and I am una...
267
2009-03-14T03:44:22Z
646,213
<p>If you want solution with httplib2 to be oneliner consider instatntinating anonymous Http object</p> <pre><code>import httplib2 resp, content = httplib2.Http().request("http://example.com/foo/bar") </code></pre>
27
2009-03-14T16:40:06Z
[ "python", "http", "networking" ]
What is the quickest way to HTTP GET in Python?
645,312
<p>What is the quickest way to HTTP GET in Python if I know the Content will be a string? I am searching the docs for a quick one-liner like:</p> <pre><code>contents = url.get("http://example.com/foo/bar") </code></pre> <p>But all I can find using Google are <code>httplib</code> and <code>urllib</code> - and I am una...
267
2009-03-14T03:44:22Z
646,229
<p>Here is a wget script in Python:</p> <pre><code># From python cookbook, 2nd edition, page 487 import sys, urllib def reporthook(a, b, c): print "% 3.1f%% of %d bytes\r" % (min(100, float(a * b) / c * 100), c), for url in sys.argv[1:]: i = url.rfind("/") file = url[i+1:] print url, "-&gt;", file ...
5
2009-03-14T16:47:32Z
[ "python", "http", "networking" ]
What is the quickest way to HTTP GET in Python?
645,312
<p>What is the quickest way to HTTP GET in Python if I know the Content will be a string? I am searching the docs for a quick one-liner like:</p> <pre><code>contents = url.get("http://example.com/foo/bar") </code></pre> <p>But all I can find using Google are <code>httplib</code> and <code>urllib</code> - and I am una...
267
2009-03-14T03:44:22Z
2,003,547
<p>theller's solution for wget is really useful, however, i found it does not print out the progress throughout the downloading process. It's perfect if you add one line after the print statement in reporthook.</p> <pre><code>import sys, urllib def reporthook(a, b, c): print "% 3.1f%% of %d bytes\r" % (min(100, f...
6
2010-01-05T01:21:33Z
[ "python", "http", "networking" ]
What is the quickest way to HTTP GET in Python?
645,312
<p>What is the quickest way to HTTP GET in Python if I know the Content will be a string? I am searching the docs for a quick one-liner like:</p> <pre><code>contents = url.get("http://example.com/foo/bar") </code></pre> <p>But all I can find using Google are <code>httplib</code> and <code>urllib</code> - and I am una...
267
2009-03-14T03:44:22Z
15,869,929
<p>You could use a library called <a href="http://docs.python-requests.org/en/latest/">requests</a>.</p> <pre><code>import requests r = requests.get("http://example.com/foo/bar") </code></pre> <p>This is quite easy. Then you can do like this:</p> <pre><code>&gt;&gt;&gt; print r.status_code &gt;&gt;&gt; print r.heade...
153
2013-04-08T01:30:40Z
[ "python", "http", "networking" ]
What is the quickest way to HTTP GET in Python?
645,312
<p>What is the quickest way to HTTP GET in Python if I know the Content will be a string? I am searching the docs for a quick one-liner like:</p> <pre><code>contents = url.get("http://example.com/foo/bar") </code></pre> <p>But all I can find using Google are <code>httplib</code> and <code>urllib</code> - and I am una...
267
2009-03-14T03:44:22Z
23,813,181
<p>If you are working with HTTP APIs specifically, there are also more convenient choices such as <a href="https://github.com/kimmobrunfeldt/nap" rel="nofollow">Nap</a>.</p> <p>For example, here's how to get gists from Github since <em>May 1st 2014</em>:</p> <pre><code>from nap.url import Url api = Url('https://api.g...
2
2014-05-22T17:08:22Z
[ "python", "http", "networking" ]
What is the quickest way to HTTP GET in Python?
645,312
<p>What is the quickest way to HTTP GET in Python if I know the Content will be a string? I am searching the docs for a quick one-liner like:</p> <pre><code>contents = url.get("http://example.com/foo/bar") </code></pre> <p>But all I can find using Google are <code>httplib</code> and <code>urllib</code> - and I am una...
267
2009-03-14T03:44:22Z
31,029,124
<p>Excellent solutions Xuan, Theller.</p> <p>For it to work with python 3 make the following changes</p> <pre><code>import sys, urllib.request def reporthook(a, b, c): print ("% 3.1f%% of %d bytes\r" % (min(100, float(a * b) / c * 100), c)) sys.stdout.flush() for url in sys.argv[1:]: i = url.rfind("/") ...
1
2015-06-24T14:18:05Z
[ "python", "http", "networking" ]
Discussion of multiple inheritance vs Composition for a project (+other things)
645,493
<p>I am writing a python platform for the simulation of distributed sensor swarms. The idea being that the end user can write a custom Node consisting of the SensorNode behaviour (communication, logging, etc) as well as implementing a number of different sensors.</p> <p>The example below briefly demonstrates the conce...
13
2009-03-14T06:04:55Z
645,597
<p><code>super</code> calls the next class in the mro-list. This works even if you leave out the <code>__init__</code> form some class.</p> <pre><code>class A(object): def __init__(self): super(A,self).__init__() print "Hello from A!" class B(A): def __init__(self): super(B,self).__init__() print ...
1
2009-03-14T07:44:16Z
[ "python", "constructor", "oop", "multiple-inheritance" ]
Discussion of multiple inheritance vs Composition for a project (+other things)
645,493
<p>I am writing a python platform for the simulation of distributed sensor swarms. The idea being that the end user can write a custom Node consisting of the SensorNode behaviour (communication, logging, etc) as well as implementing a number of different sensors.</p> <p>The example below briefly demonstrates the conce...
13
2009-03-14T06:04:55Z
645,672
<p>Here's a partial solution:</p> <pre><code>class NodeMeta(type): def __init__(cls, name, bases, d): setattr(cls, '__inherits__', bases) class Node(object): __metaclass__ = NodeMeta def __init__(self): for cls in self.__inherits__: cls.cls_init(self) class Sensor(Node): def cls_init...
1
2009-03-14T09:14:50Z
[ "python", "constructor", "oop", "multiple-inheritance" ]
Discussion of multiple inheritance vs Composition for a project (+other things)
645,493
<p>I am writing a python platform for the simulation of distributed sensor swarms. The idea being that the end user can write a custom Node consisting of the SensorNode behaviour (communication, logging, etc) as well as implementing a number of different sensors.</p> <p>The example below briefly demonstrates the conce...
13
2009-03-14T06:04:55Z
645,819
<p>The sensor architecture can be solved by using composition if you want to stick to your original map-of-data design. You seem to be new to Python so I'll try to keep idioms to a minimum.</p> <pre><code>class IRSensor: def read(self): return {'ir_amplitude': 12} class UltrasonicSensor: def read(self): retur...
9
2009-03-14T12:11:31Z
[ "python", "constructor", "oop", "multiple-inheritance" ]
Changing prompt working directory via Python script
645,864
<p>Is it possible to change the Windows command prompt working directory via Python script?</p> <p>e.g.</p> <pre><code>&gt;&gt; cd &gt;&gt; c:\windows\system32 &gt;&gt; make_decision_change_dir.py &gt;&gt; cd &gt;&gt; c:\windows </code></pre> <p>I have tried a few things which don't work:</p> <pre><code>import os o...
3
2009-03-14T12:45:32Z
645,874
<p>I'm not clear what you want to do here. Do you want a python script which you can run from a Windows command prompt which will change the working directory of the Windows command session?</p> <p>If so, I'm 99.9% sure that's impossible. As you said yourself the <code>python.exe</code> process is a separate process...
3
2009-03-14T12:52:06Z
[ "python", "windows", "scripting" ]
Changing prompt working directory via Python script
645,864
<p>Is it possible to change the Windows command prompt working directory via Python script?</p> <p>e.g.</p> <pre><code>&gt;&gt; cd &gt;&gt; c:\windows\system32 &gt;&gt; make_decision_change_dir.py &gt;&gt; cd &gt;&gt; c:\windows </code></pre> <p>I have tried a few things which don't work:</p> <pre><code>import os o...
3
2009-03-14T12:45:32Z
645,881
<p>The <a href="http://docs.python.org/library/subprocess.html#subprocess.Popen" rel="nofollow"><code>subprocess.Popen()</code> doc page</a> says a child process will be created for the sub-process, so any working directory changes will be local to that subprocess.</p> <blockquote> <p>If cwd is not None, the <strong...
0
2009-03-14T13:02:21Z
[ "python", "windows", "scripting" ]
Changing prompt working directory via Python script
645,864
<p>Is it possible to change the Windows command prompt working directory via Python script?</p> <p>e.g.</p> <pre><code>&gt;&gt; cd &gt;&gt; c:\windows\system32 &gt;&gt; make_decision_change_dir.py &gt;&gt; cd &gt;&gt; c:\windows </code></pre> <p>I have tried a few things which don't work:</p> <pre><code>import os o...
3
2009-03-14T12:45:32Z
645,967
<p>One common solution is a two-part script.</p> <p>Part 1 is Python, which creates a temporary .BAT file that contains the appropriate CD command.</p> <p>Part 2 is the temporary .BAT file.</p> <p>fancycd.bat</p> <pre><code>python figurethepath.py &gt;temp.bat temp.bat </code></pre>
1
2009-03-14T14:09:16Z
[ "python", "windows", "scripting" ]
Changing prompt working directory via Python script
645,864
<p>Is it possible to change the Windows command prompt working directory via Python script?</p> <p>e.g.</p> <pre><code>&gt;&gt; cd &gt;&gt; c:\windows\system32 &gt;&gt; make_decision_change_dir.py &gt;&gt; cd &gt;&gt; c:\windows </code></pre> <p>I have tried a few things which don't work:</p> <pre><code>import os o...
3
2009-03-14T12:45:32Z
646,103
<p>I have a Python script to make moving around a file tree easier: <a href="http://nedbatchelder.com/code/utilities/xdir%5Fpy.html" rel="nofollow">xdir.py</a></p> <p>Briefly, I have an xdir.py file, which writes Windows commands to stdout:</p> <pre><code># Obviously, this should be more interesting.. import sys prin...
2
2009-03-14T15:33:59Z
[ "python", "windows", "scripting" ]
Changing prompt working directory via Python script
645,864
<p>Is it possible to change the Windows command prompt working directory via Python script?</p> <p>e.g.</p> <pre><code>&gt;&gt; cd &gt;&gt; c:\windows\system32 &gt;&gt; make_decision_change_dir.py &gt;&gt; cd &gt;&gt; c:\windows </code></pre> <p>I have tried a few things which don't work:</p> <pre><code>import os o...
3
2009-03-14T12:45:32Z
647,744
<p>As people mentioned, child processes (i.e. your program) can't change the current working directory of a parent process (i.e. the terminal). This is why you need the two steps that everybody is describing. In most shells there's a way to make a macro or function to perform this two-step functionality.</p> <p>For ex...
1
2009-03-15T12:33:24Z
[ "python", "windows", "scripting" ]
Is there a way to build a C-like DLL from a Python module?
645,892
<p>I have a Python module with nothing but regular global functions. I need to call it from another business-domain scripting environment that can only call out to C DLLs. Is there anyway to build my Python modules so that to other code it can be called like a standard C function that's exported from a DLL? This is for...
7
2009-03-14T13:11:49Z
645,905
<p>Take a look at <a href="http://www.codeproject.com/KB/cpp/embedpython%5F1.aspx">this</a> Codeproject article. One way would be wrap your python functions in a C dll and expose this to the callee.</p> <p>COM is a binary protocol to solve this issue. But you will have to wrap this python dll in a COM wrapper. And add...
6
2009-03-14T13:24:45Z
[ "python" ]
Is there a way to build a C-like DLL from a Python module?
645,892
<p>I have a Python module with nothing but regular global functions. I need to call it from another business-domain scripting environment that can only call out to C DLLs. Is there anyway to build my Python modules so that to other code it can be called like a standard C function that's exported from a DLL? This is for...
7
2009-03-14T13:11:49Z
645,924
<p>The standard solution is to embed the Python interpreter (which is already a C DLL) in your application.</p> <p><a href="https://docs.python.org/extending/windows.html#using-dlls-in-practice" rel="nofollow">https://docs.python.org/extending/windows.html#using-dlls-in-practice</a></p> <p><a href="http://docs.python...
3
2009-03-14T13:41:54Z
[ "python" ]
Is there a way to build a C-like DLL from a Python module?
645,892
<p>I have a Python module with nothing but regular global functions. I need to call it from another business-domain scripting environment that can only call out to C DLLs. Is there anyway to build my Python modules so that to other code it can be called like a standard C function that's exported from a DLL? This is for...
7
2009-03-14T13:11:49Z
645,935
<p>Py2exe can generate COM dlls from python code, by compiling and embedding python code + interpreter. It does not, AFAIK, support regular DLLs yet. For that, see dirkgently's answer about embedding python yourself.</p>
2
2009-03-14T13:49:25Z
[ "python" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
645,958
<p>You're not the only person having problems with Python 2.6 and MySQL (<a href="http://blog.contriving.net/2009/03/04/using-python-26-mysql-on-windows-is-nearly-impossible/" rel="nofollow">http://blog.contriving.net/2009/03/04/using-python-26-mysql-on-windows-is-nearly-impossible/</a>). Here's an explanation how it s...
2
2009-03-14T14:04:00Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
645,961
<p>There are <a href="http://sourceforge.net/project/showfiles.php?group%5Fid=22307&amp;package%5Fid=15775" rel="nofollow">Windows binaries for MySQL-Python (2.4 &amp; 2.5) available on Sourceforge</a>. Have you tried those?</p>
2
2009-03-14T14:05:12Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
647,469
<p>I found a location were one person had successfully built mysql for python2.6, sharing the link, <a href="http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe" rel="nofollow">http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe</a></p> <p>...you might see a warning while import MyS...
7
2009-03-15T08:11:23Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
749,854
<p>You might want to also consider making use of <a href="http://cygwin.org" rel="nofollow">Cygwin</a>, it has mysql python libraries in the repository. </p>
0
2009-04-15T00:25:59Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
817,760
<p>As Python newbie learning the Python ecosystem I've just completed this.</p> <ol> <li><p>Install setuptools <a href="http://stackoverflow.com/questions/309412/how-to-setup-setuptools-for-python-2-6-on-windows">instructions</a></p></li> <li><p>Install MySQL 5.1. Download the 97.6MB MSI from <a href="http://dev.mysql...
14
2009-05-03T19:13:31Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
847,577
<p><a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python">Download page for python-mysqldb</a>. The page includes binaries for 32 and 64 bit versions of for Python 2.5, 2.6 and 2.7. </p> <p>There's also <a href="http://sourceforge.net/forum/message.php?msg_id=5808948">discussion on getting rid of the deprec...
124
2009-05-11T10:43:27Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
3,242,143
<p>This may read like your grandpa givin advice, but all answers here did not mention the best way: go nd install <a href="http://www.activestate.com/activepython/downloads">ActivePython</a> instead of python.org windows binaries. I was really wondering for a long time why Python development on windows was such a pita ...
30
2010-07-13T22:44:36Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
4,304,554
<p>What about <a href="http://code.google.com/p/pymysql/">pymysql</a>? It's pure Python, and I've used it on Windows with considerable success, bypassing the difficulties of compiling and installing mysql-python.</p>
5
2010-11-29T14:13:38Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
5,294,670
<p>Because I am running python in a (pylons/pyramid) virtualenv, I could not run the binary installers (helpfully) linked to previously. </p> <p>I had problems following the steps with Willie's answer, but I determined that the problem is (probably) that I am running windows 7 x64 install, which puts the registry key ...
1
2011-03-14T04:15:55Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
6,727,250
<p>You can try to use the myPySQL, its realy easy to use it, no compilation for windows, and even if you need to compilate it for any reason, you only need python and visual C installed, don't need mysql installed.</p> <p><a href="http://code.google.com/p/mypysql/" rel="nofollow">http://code.google.com/p/mypysql/</a><...
2
2011-07-17T22:37:27Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
7,729,931
<p>You can also use <a href="http://code.google.com/p/pyodbc/" rel="nofollow">pyodbc</a> with the <a href="http://dev.mysql.com/downloads/connector/odbc/" rel="nofollow">MySQL Connector/ODBC</a> to use MySQL on Windows. <a href="http://www.unixodbc.org/" rel="nofollow">Unixodbc</a> is also available to make the code c...
0
2011-10-11T17:20:14Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
9,385,307
<p>upvoted itsadok's answer because it led me to the installation for python 2.7 as well, which is located here: <a href="http://www.codegood.com/archives/129" rel="nofollow">http://www.codegood.com/archives/129</a></p>
0
2012-02-21T21:17:50Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
11,784,789
<p>If you are looking for Python 3.2 this seems the best solution I found so far </p> <ul> <li>for Python 2.4 - 3.2 <a href="https://github.com/petehunt/PyMySQL" rel="nofollow">PyMySQL</a> </li> <li>for Python 2.3 - 2.6 <a href="http://sourceforge.net/projects/mysql-python" rel="nofollow">MySQL for Python</a> </li> </...
1
2012-08-02T19:53:09Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
12,160,302
<p>Got sick of the installation troubles with MySQLdb and tried <a href="http://www.pymysql.org/" rel="nofollow">pymysql</a> instead.</p> <p>Easy setup;</p> <pre><code>git clone https://github.com/petehunt/PyMySQL.git python setup.py install </code></pre> <p>And APIs are pretty much the same.</p>
0
2012-08-28T13:27:27Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
30,490,323
<p>The precompiled binaries on <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python" rel="nofollow">http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python</a> is just worked for me.</p> <ol> <li>Open <code>MySQL_python-1.2.5-cp27-none-win_amd64.whl</code> file with zip extractor program.</li> <li>Copy the...
2
2015-05-27T18:24:37Z
[ "python", "mysql", "windows" ]
Integrating MySQL with Python in Windows
645,943
<p>I am finding it difficult to use MySQL with Python in my windows system.</p> <p>I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn'...
94
2009-03-14T13:53:28Z
30,493,219
<p>On Python 3.4 I've installed mysqlclient from <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/" rel="nofollow">http://www.lfd.uci.edu/~gohlke/pythonlibs/</a> with pip install mysqlclient and it's working.</p>
2
2015-05-27T21:11:21Z
[ "python", "mysql", "windows" ]
Python PIL: how to write PNG image to string
646,286
<p>I have generated an image using <a href="http://www.pythonware.com/products/pil/">PIL</a>. How can I save it to a string in memory? The <code>Image.save()</code> method requires a file.</p> <p>I'd like to have several such images stored in dictionary.</p>
64
2009-03-14T17:15:17Z
646,297
<p>You can probably use the <a href="http://docs.python.org/library/stringio.html">StringIO</a> class to get a wrapper around strings that behaves like a file. The StringIO object provides the same interface as a file, but saves the contents just in memory:</p> <pre><code>import StringIO output = StringIO.StringIO() ...
129
2009-03-14T17:21:04Z
[ "python", "python-imaging-library" ]
Python PIL: how to write PNG image to string
646,286
<p>I have generated an image using <a href="http://www.pythonware.com/products/pil/">PIL</a>. How can I save it to a string in memory? The <code>Image.save()</code> method requires a file.</p> <p>I'd like to have several such images stored in dictionary.</p>
64
2009-03-14T17:15:17Z
646,336
<p>When you say "I'd like to have number of such images stored in dictionary", it's not clear if this is an in-memory structure or not.</p> <p>You don't need to do any of this to meek an image in memory. Just keep the <code>image</code> object in your dictionary.</p> <p>If you're going to write your dictionary to a ...
6
2009-03-14T17:36:43Z
[ "python", "python-imaging-library" ]
Python PIL: how to write PNG image to string
646,286
<p>I have generated an image using <a href="http://www.pythonware.com/products/pil/">PIL</a>. How can I save it to a string in memory? The <code>Image.save()</code> method requires a file.</p> <p>I'd like to have several such images stored in dictionary.</p>
64
2009-03-14T17:15:17Z
646,339
<p>save() can take a file-like object as well as a path, so you can use an in-memory buffer like a StringIO:</p> <pre><code>buf= StringIO.StringIO() im.save(buf, format= 'JPEG') jpeg= buf.getvalue() </code></pre>
12
2009-03-14T17:39:25Z
[ "python", "python-imaging-library" ]
Python PIL: how to write PNG image to string
646,286
<p>I have generated an image using <a href="http://www.pythonware.com/products/pil/">PIL</a>. How can I save it to a string in memory? The <code>Image.save()</code> method requires a file.</p> <p>I'd like to have several such images stored in dictionary.</p>
64
2009-03-14T17:15:17Z
5,504,072
<p>sth's solution didn't work for me<br> because in ...</p> <blockquote> <p>Imaging/PIL/Image.pyc line 1423 -> raise KeyError(ext) # unknown extension</p> </blockquote> <p>It was trying to detect the format from the extension in the filename , which doesn't exist in StringIO case </p> <p>You can bypass the fo...
16
2011-03-31T17:46:26Z
[ "python", "python-imaging-library" ]
Python PIL: how to write PNG image to string
646,286
<p>I have generated an image using <a href="http://www.pythonware.com/products/pil/">PIL</a>. How can I save it to a string in memory? The <code>Image.save()</code> method requires a file.</p> <p>I'd like to have several such images stored in dictionary.</p>
64
2009-03-14T17:15:17Z
29,971,514
<p>For Python3 it is required to use BytesIO: <a href="http://fadeit.dk/blog/post/python3-flask-pil-in-memory-image">http://fadeit.dk/blog/post/python3-flask-pil-in-memory-image</a></p>
8
2015-04-30T15:16:32Z
[ "python", "python-imaging-library" ]
What is an elegant way to find versions of packages on a pypi package index?
646,515
<p>Currently I'm using a very ugly approach based on a regex for finding links and taking them apart.</p> <p>I'm unhappy with the code, so I'm asking for nicer solutions, preferably using only the stdlib.</p> <h3>Edit</h3> <p>The task at hand has 2 parts:</p> <ol> <li>Find all distributions that match a certain cri...
4
2009-03-14T19:07:17Z
646,524
<p>In a buildout which access pypi i pin versions like this:</p> <p>Products.PloneFormGen==1.2.5</p> <p>Here it searches for version 1.2.5 an uses this..</p> <p>Dont know if it is this what u looking for...</p>
-1
2009-03-14T19:15:17Z
[ "python", "package", "search", "pypi" ]
What is an elegant way to find versions of packages on a pypi package index?
646,515
<p>Currently I'm using a very ugly approach based on a regex for finding links and taking them apart.</p> <p>I'm unhappy with the code, so I'm asking for nicer solutions, preferably using only the stdlib.</p> <h3>Edit</h3> <p>The task at hand has 2 parts:</p> <ol> <li>Find all distributions that match a certain cri...
4
2009-03-14T19:07:17Z
647,784
<p>There is an XML-RPC interface. See the <a href="http://wiki.python.org/moin/PyPiXmlRpc?action=show&amp;redirect=CheeseShopXmlRpc" rel="nofollow">Python.org wiki page on Cheese Shop (old name for PyPi) API</a>. </p> <p>Excerpt from that wiki:</p> <pre><code>&gt;&gt;&gt; import xmlrpclib &gt;&gt;&gt; server = xmlrpc...
2
2009-03-15T13:02:06Z
[ "python", "package", "search", "pypi" ]
What is an elegant way to find versions of packages on a pypi package index?
646,515
<p>Currently I'm using a very ugly approach based on a regex for finding links and taking them apart.</p> <p>I'm unhappy with the code, so I'm asking for nicer solutions, preferably using only the stdlib.</p> <h3>Edit</h3> <p>The task at hand has 2 parts:</p> <ol> <li>Find all distributions that match a certain cri...
4
2009-03-14T19:07:17Z
7,714,844
<p>We are going to release distutils2 to PyPI in the short-term future. It contains a distutils2.pypi module which lets you search PyPI from Python code and a pysetup program which is a command-line script to do the same thing (among others). The doc is still a work in progress, but there are some examples and an API...
1
2011-10-10T15:08:34Z
[ "python", "package", "search", "pypi" ]
What is an elegant way to find versions of packages on a pypi package index?
646,515
<p>Currently I'm using a very ugly approach based on a regex for finding links and taking them apart.</p> <p>I'm unhappy with the code, so I'm asking for nicer solutions, preferably using only the stdlib.</p> <h3>Edit</h3> <p>The task at hand has 2 parts:</p> <ol> <li>Find all distributions that match a certain cri...
4
2009-03-14T19:07:17Z
13,274,944
<p>its unfortunate, but due to the lack of xmlrpc on other indexes i need to keep my solution</p>
0
2012-11-07T17:27:20Z
[ "python", "package", "search", "pypi" ]
Python: How to detect debug interpreter
646,518
<p>How can I detect in my python script if its being run by the debug interpreter (ie python_d.exe rather than python.exe)? I need to change the paths to some dlls that I pass to an extension.</p> <p>eg Id like to do something like this at the start of my python script:</p> <pre><code>#get paths to graphics dlls if d...
11
2009-03-14T19:10:14Z
646,544
<p>An easy way, if you don't mind relying on the file name:</p> <pre><code>if sys.executable.endswith("_d.exe"): print "running on debug interpreter" </code></pre> <p>You can read more about the <code>sys</code> module and its various facilities <a href="http://docs.python.org/library/sys.html" rel="nofollow">here<...
2
2009-03-14T19:24:01Z
[ "python", "debugging" ]
Python: How to detect debug interpreter
646,518
<p>How can I detect in my python script if its being run by the debug interpreter (ie python_d.exe rather than python.exe)? I need to change the paths to some dlls that I pass to an extension.</p> <p>eg Id like to do something like this at the start of my python script:</p> <pre><code>#get paths to graphics dlls if d...
11
2009-03-14T19:10:14Z
646,658
<p>Better, because it also works when you are running an embedded Python interpreter is to check the return value of</p> <pre><code>imp.get_suffixes() </code></pre> <p>For a debug build it contains a tuple starting with '_d.pyd':</p> <pre><code># debug build: [('_d.pyd', 'rb', 3), ('.py', 'U', 1), ('.pyw', 'U', 1), ...
3
2009-03-14T20:25:31Z
[ "python", "debugging" ]
Python: How to detect debug interpreter
646,518
<p>How can I detect in my python script if its being run by the debug interpreter (ie python_d.exe rather than python.exe)? I need to change the paths to some dlls that I pass to an extension.</p> <p>eg Id like to do something like this at the start of my python script:</p> <pre><code>#get paths to graphics dlls if d...
11
2009-03-14T19:10:14Z
647,312
<p><a href="http://bugs.python.org/file2086/build.py.diff">Distutils use <code>sys.gettotalrefcount</code> to detect a debug python build</a>:</p> <pre><code># ... if hasattr(sys, 'gettotalrefcount'): plat_specifier += '-pydebug' </code></pre> <ul> <li>this method doesn't rely on an executable name '<code>*_d.exe<...
12
2009-03-15T04:39:26Z
[ "python", "debugging" ]
In what way would you present an algorithm to detect collisions between diffrent objects?
646,539
<p>While working on a really only-for-fun project I encountered some problem.</p> <p>There is a 2D world populated with Round Balls, Pointy Triangles and Skinny Lines (and other wildlife too, maybe). They all are subclasses of WorldCreatures. They can move inside this world. When they meet each other, a Collision happ...
3
2009-03-14T19:21:13Z
646,548
<p>Use a <a href="http://en.wikipedia.org/wiki/Quadtree" rel="nofollow">quadtree</a>. They're used to eliminate large regions that you know are outside a collision radius, plus they let you quickly search for the closest point.</p> <p>As far as actual collision detection goes, since you're only using convex objects, ...
5
2009-03-14T19:24:59Z
[ "python", "collision-detection" ]
In what way would you present an algorithm to detect collisions between diffrent objects?
646,539
<p>While working on a really only-for-fun project I encountered some problem.</p> <p>There is a 2D world populated with Round Balls, Pointy Triangles and Skinny Lines (and other wildlife too, maybe). They all are subclasses of WorldCreatures. They can move inside this world. When they meet each other, a Collision happ...
3
2009-03-14T19:21:13Z
646,558
<p>The answer to this depends on a number of factors, such as how many objects there are, how many are moving vs. non-moving, how fast they move, etc. I think that the right place to start is by getting the core collision detection and behavior code correct while ignoring the optimizations you might do to prune collis...
1
2009-03-14T19:30:03Z
[ "python", "collision-detection" ]
In what way would you present an algorithm to detect collisions between diffrent objects?
646,539
<p>While working on a really only-for-fun project I encountered some problem.</p> <p>There is a 2D world populated with Round Balls, Pointy Triangles and Skinny Lines (and other wildlife too, maybe). They all are subclasses of WorldCreatures. They can move inside this world. When they meet each other, a Collision happ...
3
2009-03-14T19:21:13Z
646,580
<p>I think <a href="http://en.wikipedia.org/wiki/Hough%5Ftransform" rel="nofollow"><strong>Hough Transform</strong></a> should help somehow.</p>
0
2009-03-14T19:46:19Z
[ "python", "collision-detection" ]
In what way would you present an algorithm to detect collisions between diffrent objects?
646,539
<p>While working on a really only-for-fun project I encountered some problem.</p> <p>There is a 2D world populated with Round Balls, Pointy Triangles and Skinny Lines (and other wildlife too, maybe). They all are subclasses of WorldCreatures. They can move inside this world. When they meet each other, a Collision happ...
3
2009-03-14T19:21:13Z
818,157
<p>Python. Kinda strange beast for me 8)</p> <p>I have c++ experience creating games -- so I talk from this point of view.</p> <p>First of all (you can skip this if you have low number of objects) you need broad-phase collision detection. Already mentioned quadtree is just one possible implementation. Broad-phase is ...
1
2009-05-03T22:18:52Z
[ "python", "collision-detection" ]
How to get last items of a list in Python?
646,644
<p>I need the last 9 numbers of a list and I'm sure there is a way to do it with slicing, but I can't seem to get it. I can get the first 9 like this:</p> <pre><code>num_list[0:9] </code></pre> <p>Any help would be great.</p>
85
2009-03-14T20:19:44Z
646,646
<p>a negative index will count from the end of the list, so:</p> <pre><code>num_list[-9:] </code></pre>
43
2009-03-14T20:21:07Z
[ "python", "list", "slice" ]
How to get last items of a list in Python?
646,644
<p>I need the last 9 numbers of a list and I'm sure there is a way to do it with slicing, but I can't seem to get it. I can get the first 9 like this:</p> <pre><code>num_list[0:9] </code></pre> <p>Any help would be great.</p>
85
2009-03-14T20:19:44Z
646,654
<p>You can use negative integers with the slicing operator for that. Here's an example using the python CLI interpreter:</p> <pre><code>&gt;&gt;&gt; a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] &gt;&gt;&gt; a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] &gt;&gt;&gt; a[-9:] [4, 5, 6, 7, 8, 9, 10, 11, 12] </code></pre> <p>th...
180
2009-03-14T20:22:54Z
[ "python", "list", "slice" ]
How to get last items of a list in Python?
646,644
<p>I need the last 9 numbers of a list and I'm sure there is a way to do it with slicing, but I can't seem to get it. I can get the first 9 like this:</p> <pre><code>num_list[0:9] </code></pre> <p>Any help would be great.</p>
85
2009-03-14T20:19:44Z
647,299
<p>The last 9 elements can be read from left to right using numlist[-9:], or from right to left using numlist[:-10:-1], as you want.</p> <pre><code>&gt;&gt;&gt; a=range(17) &gt;&gt;&gt; print a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] &gt;&gt;&gt; print a[-9:] [8, 9, 10, 11, 12, 13, 14, 15, 16] &gt;&...
24
2009-03-15T04:27:16Z
[ "python", "list", "slice" ]
How to get last items of a list in Python?
646,644
<p>I need the last 9 numbers of a list and I'm sure there is a way to do it with slicing, but I can't seem to get it. I can get the first 9 like this:</p> <pre><code>num_list[0:9] </code></pre> <p>Any help would be great.</p>
85
2009-03-14T20:19:44Z
24,620,740
<h1>Slicing</h1> <p>Python slicing is an incredibly fast operation, and it's a handy way to quickly access parts of your data. </p> <p>Slice notation to get the last nine elements from a list (or any other sequence that supports it, like a string) would look like this:</p> <pre><code>num_list[-9:] </code></pre> <p>...
12
2014-07-07T22:10:41Z
[ "python", "list", "slice" ]
PIR sensors + Arduino + Python + email alerts
646,903
<p>We are working on a project for school, and we have 2 <a href="http://en.wikipedia.org/wiki/Passive_infrared_sensor" rel="nofollow">PIR</a> motion sensors running off an Arduino microcontroller. We are able to view the output of the serial port in both the Ardunio IDE and Python <a href="http://en.wikipedia.org/wiki...
5
2009-03-14T23:08:52Z
646,967
<p>I'm not sure exactly which part of this process you're having trouble with, but here's a sketch of a solution:</p> <p>You can use the <a href="http://pyserial.wiki.sourceforge.net/pySerial" rel="nofollow">pyserial</a> library to communicate with the Arduino from python when the Arduino is plugged into the computer ...
1
2009-03-14T23:56:53Z
[ "python", "email", "arduino" ]
PIR sensors + Arduino + Python + email alerts
646,903
<p>We are working on a project for school, and we have 2 <a href="http://en.wikipedia.org/wiki/Passive_infrared_sensor" rel="nofollow">PIR</a> motion sensors running off an Arduino microcontroller. We are able to view the output of the serial port in both the Ardunio IDE and Python <a href="http://en.wikipedia.org/wiki...
5
2009-03-14T23:08:52Z
646,971
<p>From what I can tell the board has a standard RS-232 port. You can make a listener Python script that accepts a signal from the board when the event occurs then fire off a method that sends the email. If you want a nicely designed piece look into Twisted, which has packages for serial port comm and mail. Otherwise c...
0
2009-03-15T00:00:18Z
[ "python", "email", "arduino" ]
PIR sensors + Arduino + Python + email alerts
646,903
<p>We are working on a project for school, and we have 2 <a href="http://en.wikipedia.org/wiki/Passive_infrared_sensor" rel="nofollow">PIR</a> motion sensors running off an Arduino microcontroller. We are able to view the output of the serial port in both the Ardunio IDE and Python <a href="http://en.wikipedia.org/wiki...
5
2009-03-14T23:08:52Z
648,132
<p>You need to use the serial library in your Arduino sketch. See section <code>Communication/Serial</code> on this page:</p> <p><a href="http://arduino.cc/en/Reference/HomePage" rel="nofollow">http://arduino.cc/en/Reference/HomePage</a></p> <p>There are examples for the serial library in folder <code>4.Communication...
0
2009-03-15T16:57:20Z
[ "python", "email", "arduino" ]
PIR sensors + Arduino + Python + email alerts
646,903
<p>We are working on a project for school, and we have 2 <a href="http://en.wikipedia.org/wiki/Passive_infrared_sensor" rel="nofollow">PIR</a> motion sensors running off an Arduino microcontroller. We are able to view the output of the serial port in both the Ardunio IDE and Python <a href="http://en.wikipedia.org/wiki...
5
2009-03-14T23:08:52Z
648,184
<p>From the question, I think you already know how to read from the serial port.</p> <p>So I'd suggest something like this</p> <pre><code>import time,smtplib beginTime = time.time() + 86400 # stay one day ahead for now while True: if serial port has values : # ie. motion detected beginTime = time.time() if t...
0
2009-03-15T17:26:07Z
[ "python", "email", "arduino" ]
PIR sensors + Arduino + Python + email alerts
646,903
<p>We are working on a project for school, and we have 2 <a href="http://en.wikipedia.org/wiki/Passive_infrared_sensor" rel="nofollow">PIR</a> motion sensors running off an Arduino microcontroller. We are able to view the output of the serial port in both the Ardunio IDE and Python <a href="http://en.wikipedia.org/wiki...
5
2009-03-14T23:08:52Z
11,761,445
<pre><code>ser.readline() if ser.readline() = "motion" </code></pre> <p>This code reads a line from the serial port twice and discards the first one.</p> <p>You also need a double-equals for comparison, and the line will (I assume...) have carriage-return characters on the end of it.</p> <p>You might want to tr...
1
2012-08-01T14:27:35Z
[ "python", "email", "arduino" ]
How to tell whether a file is executable on Windows in Python?
646,955
<p>I'm writing <a href="http://gist.github.com/79233"><code>grepath</code></a> utility that finds executables in <code>%PATH%</code> that match a pattern. I need to define whether given filename in the path is executable (emphasis is on command line scripts).</p> <p>Based on <a href="http://timgolden.me.uk/python/win3...
7
2009-03-14T23:48:40Z
646,965
<p>A windows <a href="http://en.wikipedia.org/wiki/Portable%5FExecutable" rel="nofollow">PE</a> always starts with the characters "MZ". This includes however also any kind of DLLs which are not necessarily executables.<br /> To check for this however you'll have to open the file and read the header so that's probably n...
2
2009-03-14T23:55:21Z
[ "c++", "python", "windows", "winapi" ]
How to tell whether a file is executable on Windows in Python?
646,955
<p>I'm writing <a href="http://gist.github.com/79233"><code>grepath</code></a> utility that finds executables in <code>%PATH%</code> that match a pattern. I need to define whether given filename in the path is executable (emphasis is on command line scripts).</p> <p>Based on <a href="http://timgolden.me.uk/python/win3...
7
2009-03-14T23:48:40Z
646,968
<p>shoosh beat me to it :)</p> <p>If I remember correctly, you should try to read the first 2 characters in the file. If you get back "MZ", you have an exe.</p> <pre><code> hnd = open(file,"rb") if hnd.read(2) == "MZ": print "exe" </code></pre>
3
2009-03-14T23:56:53Z
[ "c++", "python", "windows", "winapi" ]
How to tell whether a file is executable on Windows in Python?
646,955
<p>I'm writing <a href="http://gist.github.com/79233"><code>grepath</code></a> utility that finds executables in <code>%PATH%</code> that match a pattern. I need to define whether given filename in the path is executable (emphasis is on command line scripts).</p> <p>Based on <a href="http://timgolden.me.uk/python/win3...
7
2009-03-14T23:48:40Z
647,441
<p>Parse the PE format.</p> <p><a href="http://code.google.com/p/pefile/" rel="nofollow">http://code.google.com/p/pefile/</a></p> <p>This is probably the best solution you will get other than using python to actually try to run the program.</p> <p>Edit: I see you also want files that have associations. This will req...
0
2009-03-15T07:25:12Z
[ "c++", "python", "windows", "winapi" ]
How to tell whether a file is executable on Windows in Python?
646,955
<p>I'm writing <a href="http://gist.github.com/79233"><code>grepath</code></a> utility that finds executables in <code>%PATH%</code> that match a pattern. I need to define whether given filename in the path is executable (emphasis is on command line scripts).</p> <p>Based on <a href="http://timgolden.me.uk/python/win3...
7
2009-03-14T23:48:40Z
647,466
<p>Your question can't be answered. Windows can't tell the difference between a file which is associated with a scripting language vs. some other arbitrary program. As Windows is concerned, a .PY file is simply a document which is opened by python.exe.</p>
-1
2009-03-15T08:00:04Z
[ "c++", "python", "windows", "winapi" ]
How to tell whether a file is executable on Windows in Python?
646,955
<p>I'm writing <a href="http://gist.github.com/79233"><code>grepath</code></a> utility that finds executables in <code>%PATH%</code> that match a pattern. I need to define whether given filename in the path is executable (emphasis is on command line scripts).</p> <p>Based on <a href="http://timgolden.me.uk/python/win3...
7
2009-03-14T23:48:40Z
1,738,701
<p>I think, that this should be sufficient:</p> <ol> <li>check file extension in PATHEXT - whether file is directly executable</li> <li>using cmd.exe command "assoc .ext" you can see whether file is associated with some executable (some executable will be launched when you launch this file). You can parse capture outp...
3
2009-11-15T20:25:05Z
[ "c++", "python", "windows", "winapi" ]
How to tell whether a file is executable on Windows in Python?
646,955
<p>I'm writing <a href="http://gist.github.com/79233"><code>grepath</code></a> utility that finds executables in <code>%PATH%</code> that match a pattern. I need to define whether given filename in the path is executable (emphasis is on command line scripts).</p> <p>Based on <a href="http://timgolden.me.uk/python/win3...
7
2009-03-14T23:48:40Z
1,738,907
<p>Here's the <a href="http://gist.github.com/79233/" rel="nofollow">grepath.py</a> that I've linked in my question:</p> <pre><code>#!/usr/bin/env python """Find executables in %PATH% that match PATTERN. """ #XXX: remove --use-pathext option import fnmatch, itertools, os, re, sys, warnings from optparse import Optio...
1
2009-11-15T21:29:10Z
[ "c++", "python", "windows", "winapi" ]
Workflow for configuring apache on a webfaction account via ssh and ftp. (django/python)
647,005
<p>I'm new at this, however, when it comes to configuring mod_python/apache or wsgi/apache I suffer.</p> <p>I've been able to use the python debugger tool.. <code>pdb.set_trace()</code> to success, especially when using the django development server, i.e. it out puts to the terminal all of the server activity, includi...
0
2009-03-15T00:22:06Z
647,094
<p>How to use pdb with mod_wsgi is documented on the mod_wsgi site. See:</p> <p><a href="http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Interactive_Debugger" rel="nofollow">http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Python_Interactive_Debugger</a></p> <p>Other debugging techniques are...
1
2009-03-15T01:46:27Z
[ "python", "django", "apache", "mod-python" ]
Need a simple "Hello World" example using the Webkit library in Python
647,041
<p>Does anyone know of a simple "Hello World" example for using the Webkit library in Python? I have a GTK window, and inside I want to put Webkit.</p> <p>With Python/mozembed (Mozilla/Gecko), this is simple:</p> <pre><code>mozembed = gtkmozembed.MozEmbed() mozembed.load_url('http://google.com/') </code></pre> <p>.....
13
2009-03-15T01:00:46Z
647,066
<p>Miuler: No les gusta que usted escribio la pregunta en espanol. Si se responde en ingles puedo ayudar traducir a espanlol otra vez. I said if the answers are in English I will make sure he understands by translating back to Spanish, which he is obviously more comfortable with...</p> <p>I don't think we should be l...
2
2009-03-15T01:20:07Z
[ "python", "webkit" ]
Need a simple "Hello World" example using the Webkit library in Python
647,041
<p>Does anyone know of a simple "Hello World" example for using the Webkit library in Python? I have a GTK window, and inside I want to put Webkit.</p> <p>With Python/mozembed (Mozilla/Gecko), this is simple:</p> <pre><code>mozembed = gtkmozembed.MozEmbed() mozembed.load_url('http://google.com/') </code></pre> <p>.....
13
2009-03-15T01:00:46Z
647,121
<p>Did you check the <a href="http://code.google.com/p/pywebkitgtk/">Python bindings for the WebKit GTK+ port</a>. In one of the directory there are demos on how to use it, including a browser: python demos/tabbed_browser.py</p> <p>You could check also the slides of a FOSDEM by Alp Toker on <a href="http://www.atoker....
30
2009-03-15T02:11:25Z
[ "python", "webkit" ]
Python xml ElementTree from a string source?
647,071
<p>The ElementTree.parse reads from a file, how can I use this if I already have the XML data in a string?</p> <p>Maybe I am missing something here, but there must be a way to use the ElementTree without writing out the string to a file and reading it again.</p> <p><a href="http://docs.python.org/library/xml.etree.el...
41
2009-03-15T01:24:19Z
647,081
<p>It's on the page you linked. Use fromstring.</p>
0
2009-03-15T01:36:39Z
[ "python", "xml" ]
Python xml ElementTree from a string source?
647,071
<p>The ElementTree.parse reads from a file, how can I use this if I already have the XML data in a string?</p> <p>Maybe I am missing something here, but there must be a way to use the ElementTree without writing out the string to a file and reading it again.</p> <p><a href="http://docs.python.org/library/xml.etree.el...
41
2009-03-15T01:24:19Z
647,082
<p>If you're using <code>xml.etree.ElementTree.parse</code> to parse from a file, then you can use <code>xml.etree.ElementTree.fromstring</code> to parse from text.</p> <p>See <a href="http://docs.python.org/library/xml.etree.elementtree.html" rel="nofollow">xml.etree.ElementTree</a></p>
31
2009-03-15T01:36:44Z
[ "python", "xml" ]
Python xml ElementTree from a string source?
647,071
<p>The ElementTree.parse reads from a file, how can I use this if I already have the XML data in a string?</p> <p>Maybe I am missing something here, but there must be a way to use the ElementTree without writing out the string to a file and reading it again.</p> <p><a href="http://docs.python.org/library/xml.etree.el...
41
2009-03-15T01:24:19Z
647,084
<p>You need the xml.etree.ElementTree.fromstring(text)</p> <pre><code>from xml.etree.ElementTree import XML, fromstring, tostring myxml = fromstring(text) </code></pre>
10
2009-03-15T01:37:22Z
[ "python", "xml" ]
Python xml ElementTree from a string source?
647,071
<p>The ElementTree.parse reads from a file, how can I use this if I already have the XML data in a string?</p> <p>Maybe I am missing something here, but there must be a way to use the ElementTree without writing out the string to a file and reading it again.</p> <p><a href="http://docs.python.org/library/xml.etree.el...
41
2009-03-15T01:24:19Z
18,281,386
<p>You can parse the text as a string, which creates an Element, and create an ElementTree using that Element.</p> <pre><code>import xml.etree.ElementTree as ET tree = ET.ElementTree(ET.fromstring(xmlstring)) </code></pre> <p>I just came across this issue and the documentation, while complete, is not very straightfor...
61
2013-08-16T20:09:47Z
[ "python", "xml" ]
Python: Abstract Base Class and ZopeInterface
647,110
<p>What's the point of both? When do you think it's appropriate to use either?</p>
4
2009-03-15T02:04:06Z
647,159
<p>There is an article <a href="http://griddlenoise.blogspot.com/2007/05/abc-may-be-easy-as-123-but-it-cant-beat.html">ABC may be easy as 123, but it can't beat zope.interface</a>, which goes into details comparing both and links to other documents.</p>
6
2009-03-15T02:35:46Z
[ "python", "oop", "design", "zope.interface" ]
Python: Abstract Base Class and ZopeInterface
647,110
<p>What's the point of both? When do you think it's appropriate to use either?</p>
4
2009-03-15T02:04:06Z
4,339,141
<p>See also <a href="http://glyph.twistedmatrix.com/2009/02/explaining-why-interfaces-are-great.html" rel="nofollow">Explaining Why Interfaces Are Great</a>.</p>
3
2010-12-02T19:46:24Z
[ "python", "oop", "design", "zope.interface" ]
Why can I not paste the output of Pythons REPL without manual-editing?
647,142
<p>A huge amount of example Python code shows the output of the Python REPL, for example:</p> <pre><code>&gt;&gt;&gt; class eg(object): ... def __init__(self, name): ... self.name = name ... def hi(self): ... print "Hi %s" % (self.name) ... &gt;&gt;&gt; greeter = eg("Bob") &gt;&gt;&gt;...
4
2009-03-15T02:23:48Z
647,154
<p>The code is presented this way, because it is meant to be a step by step process. The three characters you see ">>>" are the ones of the Python IDE, but it seems you know that already. When you have access to a console or a shell, and type python, you will get something like this.</p> <pre><code>% python Python 2.5...
0
2009-03-15T02:30:43Z
[ "python", "user-interface", "read-eval-print-loop" ]
Why can I not paste the output of Pythons REPL without manual-editing?
647,142
<p>A huge amount of example Python code shows the output of the Python REPL, for example:</p> <pre><code>&gt;&gt;&gt; class eg(object): ... def __init__(self, name): ... self.name = name ... def hi(self): ... print "Hi %s" % (self.name) ... &gt;&gt;&gt; greeter = eg("Bob") &gt;&gt;&gt;...
4
2009-03-15T02:23:48Z
647,185
<p>I don't know if there's a good solution out there for this. Ideally, there'd be some way to modify the behavior of the interpretter to accept copy/paste input of this sort. Here are some alternate suggestions:</p> <p>Use triple quoting to save the example to a string. Then, use exec:</p> <pre><code>&gt;&gt;&gt; de...
2
2009-03-15T02:56:35Z
[ "python", "user-interface", "read-eval-print-loop" ]
Why can I not paste the output of Pythons REPL without manual-editing?
647,142
<p>A huge amount of example Python code shows the output of the Python REPL, for example:</p> <pre><code>&gt;&gt;&gt; class eg(object): ... def __init__(self, name): ... self.name = name ... def hi(self): ... print "Hi %s" % (self.name) ... &gt;&gt;&gt; greeter = eg("Bob") &gt;&gt;&gt;...
4
2009-03-15T02:23:48Z
647,244
<h3>How to run/adopt "the output of Pythons REPL"</h3> <ul> <li><p>Use <a href="http://ipython.scipy.org/moin/">IPython</a> shell</p> <pre><code>In [99]: %cpaste Pasting code; enter '--' alone on the line to stop. :&gt;&gt;&gt; class eg(object): :... def __init__(self, name): :... self.name = name :.....
9
2009-03-15T03:36:36Z
[ "python", "user-interface", "read-eval-print-loop" ]
Why can I not paste the output of Pythons REPL without manual-editing?
647,142
<p>A huge amount of example Python code shows the output of the Python REPL, for example:</p> <pre><code>&gt;&gt;&gt; class eg(object): ... def __init__(self, name): ... self.name = name ... def hi(self): ... print "Hi %s" % (self.name) ... &gt;&gt;&gt; greeter = eg("Bob") &gt;&gt;&gt;...
4
2009-03-15T02:23:48Z
647,706
<p>"Why" questions rarely have useful answers.</p> <p>For example, if I said that the reason why was to avoid a complex intellectual property infringement lawsuit, what does that do? Nothing. You still have to stop copying and pasting and start thinking and typing.</p> <p>Or, for example, if I said that the reason ...
1
2009-03-15T12:10:47Z
[ "python", "user-interface", "read-eval-print-loop" ]
Provide discount to preferred customer with Satchmo?
647,257
<p>I am new to Satchmo -- picked it up because I needed payment processing for site subscriptions and physical product.</p> <p>My site will have two classes of users: paid subscribers and free users. Both can order a physical product. Paid subscribers get an automatic discount on all orders.</p> <p>I don't see a con...
1
2009-03-15T03:46:33Z
1,198,670
<p>Checkout the tiered pricing module</p>
2
2009-07-29T07:57:12Z
[ "python", "django", "satchmo" ]
Multiple overlapping plots with independent scaling in Matplotlib
647,443
<p>I currently have code that calls <code>matplotlib.pylab.plot</code> multiple times to display multiple sets of data on the same screen, and Matplotlib scales each to the global min and max, considering all plots. Is there a way to ask it to scale each plot independently, to the min and max of that particular plot?<...
8
2009-03-15T07:28:34Z
647,712
<p>There's no direct support for this, but here's some code from a <a href="http://article.gmane.org/gmane.comp.python.matplotlib.general/1987" rel="nofollow">mailing list posting</a> that illlustrates two independent vertical axes:</p> <pre><code>x=arange(10) y1=sin(x) y2=10*cos(x) rect=[0.1,0.1,0.8,0.8] a1=axes(rec...
3
2009-03-15T12:14:35Z
[ "python", "matplotlib" ]
Multiple overlapping plots with independent scaling in Matplotlib
647,443
<p>I currently have code that calls <code>matplotlib.pylab.plot</code> multiple times to display multiple sets of data on the same screen, and Matplotlib scales each to the global min and max, considering all plots. Is there a way to ask it to scale each plot independently, to the min and max of that particular plot?<...
8
2009-03-15T07:28:34Z
3,291,173
<p>This is how you create a single plot (add_subplot(1,1,1)) and limit the scale on the y-axes.</p> <pre><code>myFig = figure() myPlot = self.figure.add_subplot(1,1,1) myPlot.plot([1,2,3,4,5], [5,4,3,2,1], '+r') myPlot.set_ylim(1,5) # Limit y-axes min 1, max 5 </code></pre>
0
2010-07-20T14:46:26Z
[ "python", "matplotlib" ]
Multiple overlapping plots with independent scaling in Matplotlib
647,443
<p>I currently have code that calls <code>matplotlib.pylab.plot</code> multiple times to display multiple sets of data on the same screen, and Matplotlib scales each to the global min and max, considering all plots. Is there a way to ask it to scale each plot independently, to the min and max of that particular plot?<...
8
2009-03-15T07:28:34Z
24,144,584
<p>I need something like this but wanted to create an example that you can copy and paste into the interactive shell and take a look at it. Here it is for those of you requiring a working solution:</p> <pre><code>from numpy import arange from math import sin, cos import matplotlib.pyplot as plt x = arange(10) y1 = [s...
0
2014-06-10T15:11:38Z
[ "python", "matplotlib" ]
Multiple overlapping plots with independent scaling in Matplotlib
647,443
<p>I currently have code that calls <code>matplotlib.pylab.plot</code> multiple times to display multiple sets of data on the same screen, and Matplotlib scales each to the global min and max, considering all plots. Is there a way to ask it to scale each plot independently, to the min and max of that particular plot?<...
8
2009-03-15T07:28:34Z
24,167,481
<p>Here is a solution using date plots, and I think its the most optimized solution using twinx() a short hand for adding a second y axis. </p> <pre><code>import matplotlib.pyplot as plt import matplotlib.dates as md import datetime import numpy numpy.random.seed(0) t = md.drange(datetime.datetime(2012, 11, 1), ...
0
2014-06-11T15:59:00Z
[ "python", "matplotlib" ]
How do I forward a complete email without downloading attachments?
647,500
<p>Hello (and thanks in advance!)</p> <p>I'm working in Python and I got IMAP and SMTP to work with my Gmail account. I now need to forward select messages to another account (after reading their body).</p> <p>How do I do this without downloading the attachments and recreating the entire message?</p> <p>Thanks!</p> ...
1
2009-03-15T08:55:54Z
647,504
<p>Look at the IMAP and SMTP Lemonade extensions. There is support for forwarding messages without downloading. It's a very new extension, so not many IMAP servers support it yet; I'm not sure if Gmail is one of them.</p> <p>Section 2 of <a href="ftp://ftp.rfc-editor.org/in-notes/rfc4550.txt" rel="nofollow">RFC 4550...
2
2009-03-15T09:00:27Z
[ "python", "smtp", "gmail", "imap", "forward" ]
How can I know python's path under windows?
647,515
<p>I want to know where is the python's installation path. For example:</p> <p>C:\Python25</p> <p>But however, I have no idea how to do. How can I get the installation path of python?</p> <p>Thanks.</p>
12
2009-03-15T09:09:18Z
647,564
<p>In the <code>sys</code> package, you can find a lot of useful information about your installation:</p> <pre><code>import sys print sys.executable print sys.exec_prefix </code></pre> <p>I'm not sure what this will give on your Windows system, but on my Mac <code>executable</code> points to the Python binary and <co...
4
2009-03-15T09:41:58Z
[ "python", "path" ]
How can I know python's path under windows?
647,515
<p>I want to know where is the python's installation path. For example:</p> <p>C:\Python25</p> <p>But however, I have no idea how to do. How can I get the installation path of python?</p> <p>Thanks.</p>
12
2009-03-15T09:09:18Z
647,600
<p>On my windows installation, I get these results:</p> <pre><code>&gt;&gt;&gt; import sys &gt;&gt;&gt; sys.executable 'C:\\Python26\\python.exe' &gt;&gt;&gt; sys.platform 'win32' &gt;&gt;&gt; </code></pre> <p>(You can also look in <code>sys.path</code> for reasonable locations.)</p>
2
2009-03-15T10:18:52Z
[ "python", "path" ]
How can I know python's path under windows?
647,515
<p>I want to know where is the python's installation path. For example:</p> <p>C:\Python25</p> <p>But however, I have no idea how to do. How can I get the installation path of python?</p> <p>Thanks.</p>
12
2009-03-15T09:09:18Z
647,798
<pre><code>&gt;&gt;&gt; import os &gt;&gt;&gt; import sys &gt;&gt;&gt; os.path.dirname(sys.executable) 'C:\\Python25' </code></pre>
28
2009-03-15T13:17:29Z
[ "python", "path" ]
How can I know python's path under windows?
647,515
<p>I want to know where is the python's installation path. For example:</p> <p>C:\Python25</p> <p>But however, I have no idea how to do. How can I get the installation path of python?</p> <p>Thanks.</p>
12
2009-03-15T09:09:18Z
648,552
<p>If you need to know the installed path under Windows <strong>without</strong> starting the python interpreter, have a look in the Windows registry.</p> <p>Each installed Python version will have a registry key in either:</p> <ul> <li><code>HKLM\SOFTWARE\Python\PythonCore\versionnumber\InstallPath</code></li> <li><...
23
2009-03-15T21:08:54Z
[ "python", "path" ]
python, regex split and special character
647,655
<p>How can I split correctly a string containing a sentence with special chars using whitespaces as separator ? Using regex split method I cannot obtain the desired result.</p> <p>Example code:</p> <pre><code># -*- coding: utf-8 -*- import re s="La felicità è tutto" # "The happiness is everything" in italian l=re...
11
2009-03-15T11:24:44Z
647,667
<p>Your regex should be <code>(\s)</code> instead of <code>(\W)</code> like this:</p> <pre><code>l = re.compile("(\s)").split(s) </code></pre> <p>The code above will give you the exact output you requested. However the following line makes more sense:</p> <pre><code>l = re.compile("\s").split(s) </code></pre> <p>...
16
2009-03-15T11:32:00Z
[ "python", "regex", "unicode", "split" ]