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 |
|---|---|---|---|---|---|---|---|---|---|
How can I program software using Python for Linux/Windows? | 1,774,384 | <p>For example, using C# I can make software fairly easily for Windows.</p>
<p>I downloaded Python but all I get is a terminal like window for executing single lines of code.</p>
<p>Is there a free IDE/Visual editor for designing GUI's in conjunction with Python?</p>
<p>Thank SO. :D</p>
| 2 | 2009-11-21T03:20:23Z | 1,774,387 | <p>Yes, lots.</p>
<p><a href="http://wiki.python.org/moin/GuiProgramming" rel="nofollow">http://wiki.python.org/moin/GuiProgramming</a></p>
| 1 | 2009-11-21T03:22:02Z | [
"python",
"windows",
"linux",
"user-interface",
"ide"
] |
How can I program software using Python for Linux/Windows? | 1,774,384 | <p>For example, using C# I can make software fairly easily for Windows.</p>
<p>I downloaded Python but all I get is a terminal like window for executing single lines of code.</p>
<p>Is there a free IDE/Visual editor for designing GUI's in conjunction with Python?</p>
<p>Thank SO. :D</p>
| 2 | 2009-11-21T03:20:23Z | 1,774,440 | <p>The character-based terminal (console) interface isn't the only one Python affords. It is often the most visible because it is</p>
<ul>
<li>"built-in"</li>
<li>often used in the early stages of learning the language, allowing one to focus on various idioms of the language, without the added complexity of the objec... | 2 | 2009-11-21T03:47:54Z | [
"python",
"windows",
"linux",
"user-interface",
"ide"
] |
How can I program software using Python for Linux/Windows? | 1,774,384 | <p>For example, using C# I can make software fairly easily for Windows.</p>
<p>I downloaded Python but all I get is a terminal like window for executing single lines of code.</p>
<p>Is there a free IDE/Visual editor for designing GUI's in conjunction with Python?</p>
<p>Thank SO. :D</p>
| 2 | 2009-11-21T03:20:23Z | 1,774,448 | <p>If you know .Net and C#, you could use IronPython and WPF. Then you can use Visual Studio 2010 Beta 2 as your development environment. <a href="http://code.msdn.microsoft.com/twitter/" rel="nofollow">Here's</a> an example of how it can be done.</p>
| 0 | 2009-11-21T03:52:32Z | [
"python",
"windows",
"linux",
"user-interface",
"ide"
] |
download a zip file to a local drive and extract all files to a destination folder using python 2.5 | 1,774,434 | <p>I am trying to download a zip file to a local drive and extract all files to a destination folder.</p>
<p>so i have come up with solution but it is only to "download" a file from a directory to another directory but it doesn't work for downloading files. for the extraction, I am able to get it to work in 2.6 but no... | 2 | 2009-11-21T03:44:57Z | 1,774,443 | <p>For downloading, look at urllib:</p>
<pre><code>import urllib
webFile = urllib.urlopen(url)
</code></pre>
<p>For unzipping, use <a href="http://docs.python.org/library/zipfile.html" rel="nofollow">zipfile</a>. See also <a href="http://code.activestate.com/recipes/252508/" rel="nofollow">this example</a>.</p>
| 2 | 2009-11-21T03:49:06Z | [
"python",
"http",
"download",
"extract",
"unzip"
] |
download a zip file to a local drive and extract all files to a destination folder using python 2.5 | 1,774,434 | <p>I am trying to download a zip file to a local drive and extract all files to a destination folder.</p>
<p>so i have come up with solution but it is only to "download" a file from a directory to another directory but it doesn't work for downloading files. for the extraction, I am able to get it to work in 2.6 but no... | 2 | 2009-11-21T03:44:57Z | 1,774,444 | <p><a href="http://docs.python.org/library/urllib.html?highlight=urllib#urllib.urlretrieve">urllib.urlretrieve</a> can get a file (zip or otherwise;-) from a URL to a given path.</p>
<p><code>extractall</code> is indeed new in 2.6, but in 2.5 you can use an explicit loop (get all names, open each name, etc). Do you ne... | 11 | 2009-11-21T03:49:40Z | [
"python",
"http",
"download",
"extract",
"unzip"
] |
download a zip file to a local drive and extract all files to a destination folder using python 2.5 | 1,774,434 | <p>I am trying to download a zip file to a local drive and extract all files to a destination folder.</p>
<p>so i have come up with solution but it is only to "download" a file from a directory to another directory but it doesn't work for downloading files. for the extraction, I am able to get it to work in 2.6 but no... | 2 | 2009-11-21T03:44:57Z | 34,006,064 | <p>The shortest way i've found so far, is to use +alex answer, but with <strong>ZipFile.extractall()</strong> instead of the loop:</p>
<pre><code>from zipfile import ZipFile
from urllib import urlretrieve
from tempfile import mktemp
filename = mktemp('.zip')
destDir = mktemp()
theurl = 'http://www.example.com/file.zi... | 1 | 2015-11-30T19:07:24Z | [
"python",
"http",
"download",
"extract",
"unzip"
] |
Module import error using IDLE | 1,774,453 | <p>I'm an absolute beginner using IDLE (Python 2.6.4) to learn the basics. I recently found a <a href="http://code.google.com/p/css-py" rel="nofollow">Python program</a> that I want to run but it throws an error although the code looks fine (i.e all modules exist):</p>
<pre><code>from css.parse import parse
data = ""... | 0 | 2009-11-21T03:55:49Z | 1,774,458 | <p>You should have your <code>test.py</code> script in the same folder as the folder, not <strong>in</strong> the folder.</p>
<p>So it should look like this:</p>
<pre><code>../
test.py
css/
</code></pre>
| 1 | 2009-11-21T03:57:30Z | [
"python",
"path",
"python-idle"
] |
Module import error using IDLE | 1,774,453 | <p>I'm an absolute beginner using IDLE (Python 2.6.4) to learn the basics. I recently found a <a href="http://code.google.com/p/css-py" rel="nofollow">Python program</a> that I want to run but it throws an error although the code looks fine (i.e all modules exist):</p>
<pre><code>from css.parse import parse
data = ""... | 0 | 2009-11-21T03:55:49Z | 1,774,530 | <p>A generic but useful reference regarding the way <strong>Python module search path</strong> is<br>
<a href="http://docs.python.org/tutorial/modules.html#the-module-search-path" rel="nofollow">this brief but informative section of Python Documentation</a></p>
<p>The default paths and the environmental variables whic... | 1 | 2009-11-21T04:36:00Z | [
"python",
"path",
"python-idle"
] |
Am I supposed to use PyQT4 for programming cross-platform software in Python? | 1,774,487 | <p>So a user suggested getting PyQT.</p>
<p>A quick Google gave me this: <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download" rel="nofollow">Link</a></p>
<p>Is this GUI Library for pay?</p>
<p>If my development environment is Ubuntu Linux, what should I download on that site. I have no idea.</p>
<p>... | 2 | 2009-11-21T04:11:46Z | 1,774,499 | <p>Near the top of the page you will find:</p>
<h2>Source Packages</h2>
<p>This is the latest stable version of PyQt4.</p>
<pre>
PyQt-x11-gpl-4.6.2.tar.gz Linux, UNIX source
PyQt-win-gpl-4.6.2.zip Windows source
PyQt-mac-gpl-4.6.2.tar.gz MacOS/X source
</pre>
<p>For Ubuntu, choose the first one.</p>
| 0 | 2009-11-21T04:16:39Z | [
"python",
"qt",
"cross-platform"
] |
Am I supposed to use PyQT4 for programming cross-platform software in Python? | 1,774,487 | <p>So a user suggested getting PyQT.</p>
<p>A quick Google gave me this: <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download" rel="nofollow">Link</a></p>
<p>Is this GUI Library for pay?</p>
<p>If my development environment is Ubuntu Linux, what should I download on that site. I have no idea.</p>
<p>... | 2 | 2009-11-21T04:11:46Z | 1,774,500 | <p>PyQT is released under multiple licenses: <a href="http://www.riverbankcomputing.co.uk/software/pyqt/license" rel="nofollow">http://www.riverbankcomputing.co.uk/software/pyqt/license</a></p>
<p>You only need to pay if you don't want to release your product under the GPL.</p>
<p>PyQT isn't the only option for cross... | 1 | 2009-11-21T04:16:44Z | [
"python",
"qt",
"cross-platform"
] |
Am I supposed to use PyQT4 for programming cross-platform software in Python? | 1,774,487 | <p>So a user suggested getting PyQT.</p>
<p>A quick Google gave me this: <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download" rel="nofollow">Link</a></p>
<p>Is this GUI Library for pay?</p>
<p>If my development environment is Ubuntu Linux, what should I download on that site. I have no idea.</p>
<p>... | 2 | 2009-11-21T04:11:46Z | 1,774,501 | <p>You may want to look at <a href="http://www.pyside.org/" rel="nofollow">PySide</a> which is sponsored by Nokia, who own QT. It's also LGPL, which is a bit better of a license than the PyQT bindings. It's also a bit more pythonic in how it works. Unfortunately, it's new, so there isn't as much documentation. On t... | 10 | 2009-11-21T04:17:51Z | [
"python",
"qt",
"cross-platform"
] |
Am I supposed to use PyQT4 for programming cross-platform software in Python? | 1,774,487 | <p>So a user suggested getting PyQT.</p>
<p>A quick Google gave me this: <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download" rel="nofollow">Link</a></p>
<p>Is this GUI Library for pay?</p>
<p>If my development environment is Ubuntu Linux, what should I download on that site. I have no idea.</p>
<p>... | 2 | 2009-11-21T04:11:46Z | 1,774,532 | <p>I will answer the question you have stated in title</p>
<p>"Am I supposed to use PyQT4 for programming cross-platform software in Python?"</p>
<p><strong>No.</strong></p>
<p>You can use wxPython (<a href="http://www.wxpython.org/" rel="nofollow">http://www.wxpython.org/</a>), it is a quite decent GUI toolkit base... | 3 | 2009-11-21T04:38:11Z | [
"python",
"qt",
"cross-platform"
] |
Am I supposed to use PyQT4 for programming cross-platform software in Python? | 1,774,487 | <p>So a user suggested getting PyQT.</p>
<p>A quick Google gave me this: <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download" rel="nofollow">Link</a></p>
<p>Is this GUI Library for pay?</p>
<p>If my development environment is Ubuntu Linux, what should I download on that site. I have no idea.</p>
<p>... | 2 | 2009-11-21T04:11:46Z | 1,774,960 | <p>In Ubuntu Linux, for PyQT try the package <a href="http://packages.ubuntu.com/karmic/python-qt4" rel="nofollow">python-qt4</a>.</p>
<p>An alternative is <a href="http://www.wxpython.org/" rel="nofollow">wxpython</a>, and in Ubuntu the package is <a href="http://packages.ubuntu.com/karmic/python-wxgtk2.8" rel="nofol... | 0 | 2009-11-21T08:45:35Z | [
"python",
"qt",
"cross-platform"
] |
Am I supposed to use PyQT4 for programming cross-platform software in Python? | 1,774,487 | <p>So a user suggested getting PyQT.</p>
<p>A quick Google gave me this: <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download" rel="nofollow">Link</a></p>
<p>Is this GUI Library for pay?</p>
<p>If my development environment is Ubuntu Linux, what should I download on that site. I have no idea.</p>
<p>... | 2 | 2009-11-21T04:11:46Z | 1,774,981 | <p>You should try pyQt and wxPython both, but You will know which one better when you release your program to public.</p>
<p>you can install wxpython with synaptic easily.</p>
<p>and here is helloworld for wxpython</p>
<pre><code>import wx
app = wx.App()
frame = wx.Frame(None, wx.ID_ANY, "Hello World")
frame.Show(Tr... | 0 | 2009-11-21T09:00:16Z | [
"python",
"qt",
"cross-platform"
] |
Am I supposed to use PyQT4 for programming cross-platform software in Python? | 1,774,487 | <p>So a user suggested getting PyQT.</p>
<p>A quick Google gave me this: <a href="http://www.riverbankcomputing.co.uk/software/pyqt/download" rel="nofollow">Link</a></p>
<p>Is this GUI Library for pay?</p>
<p>If my development environment is Ubuntu Linux, what should I download on that site. I have no idea.</p>
<p>... | 2 | 2009-11-21T04:11:46Z | 1,889,030 | <p>For cross-platform qt is the best option. GTK doesn't look well on windows, wxwidget/wxpython is ok but not so powerful and tkinter is too ugly/basic. Besides, qt4 is LGPL so you can link with it even if your application is not GPL.</p>
| 0 | 2009-12-11T16:02:42Z | [
"python",
"qt",
"cross-platform"
] |
Appending to a List | 1,774,616 | <pre><code>L = ['abc', 'ADB', 'aBe']
L[len(L):]=['a1', 'a2'] # append items at the end...
L[-1:]=['a3', 'a4'] # append more items at the end...
</code></pre>
<p>... works, but 'a2' is missing in the output:</p>
<pre><code>['abc', 'ADB', 'aBe', 'append', 'a1', 'a3', 'a4']
</code></pre>
| 0 | 2009-11-21T05:37:52Z | 1,774,619 | <p>What is wrong with:</p>
<pre><code>L.append('a1')
</code></pre>
<p>or</p>
<pre><code>L += ['a1', 'a2']
</code></pre>
| 1 | 2009-11-21T05:40:40Z | [
"python",
"list"
] |
Appending to a List | 1,774,616 | <pre><code>L = ['abc', 'ADB', 'aBe']
L[len(L):]=['a1', 'a2'] # append items at the end...
L[-1:]=['a3', 'a4'] # append more items at the end...
</code></pre>
<p>... works, but 'a2' is missing in the output:</p>
<pre><code>['abc', 'ADB', 'aBe', 'append', 'a1', 'a3', 'a4']
</code></pre>
| 0 | 2009-11-21T05:37:52Z | 1,774,620 | <p>to append items to a list, you can use +</p>
<pre><code>L + ["a1","a2"]
</code></pre>
| 1 | 2009-11-21T05:40:49Z | [
"python",
"list"
] |
Appending to a List | 1,774,616 | <pre><code>L = ['abc', 'ADB', 'aBe']
L[len(L):]=['a1', 'a2'] # append items at the end...
L[-1:]=['a3', 'a4'] # append more items at the end...
</code></pre>
<p>... works, but 'a2' is missing in the output:</p>
<pre><code>['abc', 'ADB', 'aBe', 'append', 'a1', 'a3', 'a4']
</code></pre>
| 0 | 2009-11-21T05:37:52Z | 1,774,621 | <p>I think that the -1 is pointing at the last element of the list, which gets overwritten by 'a3'. As described <a href="http://docs.python.org/tutorial/datastructures.html" rel="nofollow">here</a>, you can do a </p>
<pre><code>list.extend(['a3', 'a4'])
</code></pre>
| 3 | 2009-11-21T05:40:56Z | [
"python",
"list"
] |
Appending to a List | 1,774,616 | <pre><code>L = ['abc', 'ADB', 'aBe']
L[len(L):]=['a1', 'a2'] # append items at the end...
L[-1:]=['a3', 'a4'] # append more items at the end...
</code></pre>
<p>... works, but 'a2' is missing in the output:</p>
<pre><code>['abc', 'ADB', 'aBe', 'append', 'a1', 'a3', 'a4']
</code></pre>
| 0 | 2009-11-21T05:37:52Z | 1,774,623 | <p>Your 3rd assignment is overwriting the 'a2' value.</p>
<p>Perhaps you should be using a more straightforward method:</p>
<pre><code>L = ['abc', 'ADB', 'aBe']
L += ['a1', 'a2']
L += ['a3', 'a4']
Etc.
</code></pre>
| 1 | 2009-11-21T05:41:50Z | [
"python",
"list"
] |
Appending to a List | 1,774,616 | <pre><code>L = ['abc', 'ADB', 'aBe']
L[len(L):]=['a1', 'a2'] # append items at the end...
L[-1:]=['a3', 'a4'] # append more items at the end...
</code></pre>
<p>... works, but 'a2' is missing in the output:</p>
<pre><code>['abc', 'ADB', 'aBe', 'append', 'a1', 'a3', 'a4']
</code></pre>
| 0 | 2009-11-21T05:37:52Z | 1,774,626 | <p>Use <code>L.append</code> (for a single element) or <code>L.extend</code> (for a sequence) -- there's absolutely no call for playing fancy "assign-to-slice" tricks (especially if you don't master them!-). The slice <code>[-1:]</code> means "last element <strong>included</strong> onwards" -- so, by assigning to that... | 3 | 2009-11-21T05:42:53Z | [
"python",
"list"
] |
Appending to a List | 1,774,616 | <pre><code>L = ['abc', 'ADB', 'aBe']
L[len(L):]=['a1', 'a2'] # append items at the end...
L[-1:]=['a3', 'a4'] # append more items at the end...
</code></pre>
<p>... works, but 'a2' is missing in the output:</p>
<pre><code>['abc', 'ADB', 'aBe', 'append', 'a1', 'a3', 'a4']
</code></pre>
| 0 | 2009-11-21T05:37:52Z | 1,774,630 | <p>Use the extend method</p>
<pre><code>L = ['abc', 'ADB', 'aBe']
L.extend(['a1', 'a2'])
L.extend(['a3', 'a4'])
</code></pre>
| 0 | 2009-11-21T05:43:39Z | [
"python",
"list"
] |
Subversion post-commit hook | 1,774,646 | <p>I have created a subversion post-commit hook to send out an email everytime a commit is made.Im calling a python script from the file post-commit in /var/svn/repos/hooks . </p>
<pre><code>REPOS="$1"
REV="$2"
~/svnnotify.py $REV
</code></pre>
<p>But the problem is that the svn commit command is taking a longer tim... | 3 | 2009-11-21T05:50:32Z | 1,774,656 | <p>Call a batch file and in that batch file execute python script to run in the background by adding ampersand at end of command in batch file( & ).</p>
| 0 | 2009-11-21T05:57:41Z | [
"python",
"svn",
"unix",
"svn-hooks"
] |
Subversion post-commit hook | 1,774,646 | <p>I have created a subversion post-commit hook to send out an email everytime a commit is made.Im calling a python script from the file post-commit in /var/svn/repos/hooks . </p>
<pre><code>REPOS="$1"
REV="$2"
~/svnnotify.py $REV
</code></pre>
<p>But the problem is that the svn commit command is taking a longer tim... | 3 | 2009-11-21T05:50:32Z | 1,774,657 | <p>Try adding an ampersand (<code>&</code>) after the line that calls your script to put it in the background and return immediately.</p>
| 4 | 2009-11-21T05:58:02Z | [
"python",
"svn",
"unix",
"svn-hooks"
] |
Subversion post-commit hook | 1,774,646 | <p>I have created a subversion post-commit hook to send out an email everytime a commit is made.Im calling a python script from the file post-commit in /var/svn/repos/hooks . </p>
<pre><code>REPOS="$1"
REV="$2"
~/svnnotify.py $REV
</code></pre>
<p>But the problem is that the svn commit command is taking a longer tim... | 3 | 2009-11-21T05:50:32Z | 1,774,675 | <p>Maybe put the update in a simple queue that gets scooped up by a script run invoked from cron and sends a message if something is sitting in the queue.</p>
<p>Queue could be a simple file in /tmp, an sqlite file, or a MySQL table.</p>
<p>If it's taking noticeably long to send the e-mail, maybe there's something up... | 0 | 2009-11-21T06:08:06Z | [
"python",
"svn",
"unix",
"svn-hooks"
] |
Python 2.6 DB error | 1,774,752 | <p>I'm trying to get the Yahoo! BOSS package working, but when I try to run the example file I get the following error:</p>
<pre><code>$ python examples/ex5.py
File "examples/ex5.py", line 28
tb = db.group(by=["yn$title"], key="rank", reducer=lambda d1,d2: d1+d2, as="total", table=tb, norm=text.norm)
... | 0 | 2009-11-21T06:47:16Z | 1,774,772 | <p><code>as</code> was a pseudo-keyword in 2.5, it's become a full-fledged keyword in 2.6 -- that's definitely the cause of your problem!</p>
<p>As for the workaround, try adding a <code>**{'as': 'total'}</code> at the end of your call and remove the plain <code>as='total'</code> -- that should work.</p>
| 1 | 2009-11-21T06:56:46Z | [
"python",
"python-2.6",
"yahoo-boss-api"
] |
Does a exception with just a raise have any use? | 1,774,792 | <p>For example, here is some code from django.templates.loader.app_directories.py.[1]</p>
<pre><code>try:
yield safe_join(template_dir, template_name)
except UnicodeDecodeError:
# The template dir name was a bytestring that wasn't valid UTF-8.
raise
</code></pre>
<p>If you catch an exception just to re ra... | 4 | 2009-11-21T07:08:52Z | 1,774,804 | <p>None at all, that I can think of, except if you're debugging that source code and set a breakpoint on the <code>raise</code> statement.</p>
| 3 | 2009-11-21T07:13:55Z | [
"python",
"exception-handling"
] |
Does a exception with just a raise have any use? | 1,774,792 | <p>For example, here is some code from django.templates.loader.app_directories.py.[1]</p>
<pre><code>try:
yield safe_join(template_dir, template_name)
except UnicodeDecodeError:
# The template dir name was a bytestring that wasn't valid UTF-8.
raise
</code></pre>
<p>If you catch an exception just to re ra... | 4 | 2009-11-21T07:08:52Z | 1,774,812 | <p>Strictly speaking, it's unneeded. </p>
<p>Some possibilities:</p>
<ol>
<li>For documentation purposes - just to make it explicit which exceptions are expected</li>
<li>As a placeholder for a future (or past) more serious handling before re-raising</li>
</ol>
| 2 | 2009-11-21T07:19:42Z | [
"python",
"exception-handling"
] |
Does a exception with just a raise have any use? | 1,774,792 | <p>For example, here is some code from django.templates.loader.app_directories.py.[1]</p>
<pre><code>try:
yield safe_join(template_dir, template_name)
except UnicodeDecodeError:
# The template dir name was a bytestring that wasn't valid UTF-8.
raise
</code></pre>
<p>If you catch an exception just to re ra... | 4 | 2009-11-21T07:08:52Z | 1,774,834 | <p>In the code you linked to is another additional exception handler:</p>
<pre><code>try:
yield safe_join(template_dir, template_name)
except UnicodeDecodeError:
# The template dir name was a bytestring that wasn't valid UTF-8.
raise
except ValueError:
# The joined path was located outside of template_... | 17 | 2009-11-21T07:31:45Z | [
"python",
"exception-handling"
] |
Does a exception with just a raise have any use? | 1,774,792 | <p>For example, here is some code from django.templates.loader.app_directories.py.[1]</p>
<pre><code>try:
yield safe_join(template_dir, template_name)
except UnicodeDecodeError:
# The template dir name was a bytestring that wasn't valid UTF-8.
raise
</code></pre>
<p>If you catch an exception just to re ra... | 4 | 2009-11-21T07:08:52Z | 1,774,933 | <p>The most common use is to propagate some one particular exception and handle all the rest. You can find a lot of examples for propagating <code>KeyboardInterrupt</code> and <code>SystemExit</code> (e.g. look at <code>asyncore</code> source): it's convenient for servers to log and continue in case of error in request... | 1 | 2009-11-21T08:30:13Z | [
"python",
"exception-handling"
] |
Unable to use PIL after installing using pythononmac.org package (Mac OS Leopard) | 1,774,825 | <p>I'm trying to use PIL for a Google App Engine project. I've installed PIL using the <a href="http://pythonmac.org/packages/py25-fat/index.html" rel="nofollow">installer from pythononmac.org</a> but it doesn't seem to do anything, or at least neither I nor Python can find the files. I'm running Python 2.5.1.</p>
| 0 | 2009-11-21T07:27:57Z | 1,774,993 | <p>The installers found on that page were designed to be used with the python 2.5 installer found there. Note that most of the packages are now out-of-date. The PIL installer uses the site-packages library in the framework used by the 2.5 Python on that page and by the more up-to-date python.org installer: <code>/Lib... | 3 | 2009-11-21T09:11:00Z | [
"python",
"osx",
"installation",
"python-imaging-library",
"osx-leopard"
] |
how to import contacts from various services like gmail or yahoo using python/django | 1,774,915 | <p>How can I import contacts of given email id/pwd from </p>
<ol>
<li>gmail</li>
<li>yahoo</li>
<li>hotmail </li>
<li>etc</li>
</ol>
<p>using python/django application. Please suggest?</p>
| 4 | 2009-11-21T08:12:22Z | 1,775,153 | <p>you can maybe ask to export the contacts into cvs file (usually possible), upload the file to your site and then you can inspect the file</p>
<p>or you can have a look <a href="http://www.adluo.com/index.php" rel="nofollow">here</a> for a php version</p>
| -3 | 2009-11-21T10:49:01Z | [
"python",
"django"
] |
how to import contacts from various services like gmail or yahoo using python/django | 1,774,915 | <p>How can I import contacts of given email id/pwd from </p>
<ol>
<li>gmail</li>
<li>yahoo</li>
<li>hotmail </li>
<li>etc</li>
</ol>
<p>using python/django application. Please suggest?</p>
| 4 | 2009-11-21T08:12:22Z | 1,775,165 | <p>You might want to look into <a href="http://pinaxproject.com/" rel="nofollow">pinax</a> an open source pluggable django app collection which also has support for yahoo, google and hcard contact import.</p>
| 1 | 2009-11-21T11:01:09Z | [
"python",
"django"
] |
how to import contacts from various services like gmail or yahoo using python/django | 1,774,915 | <p>How can I import contacts of given email id/pwd from </p>
<ol>
<li>gmail</li>
<li>yahoo</li>
<li>hotmail </li>
<li>etc</li>
</ol>
<p>using python/django application. Please suggest?</p>
| 4 | 2009-11-21T08:12:22Z | 2,137,120 | <p>for msn/hotmail : <a href="http://osdir.com/ml/DjangoUsers/2009-06/msg01169.html" rel="nofollow">http://osdir.com/ml/DjangoUsers/2009-06/msg01169.html</a></p>
<p>for yahoo : <a href="http://rocketscience.itteco.org/2009/12/16/importing-yahoo-contacts-in-django/" rel="nofollow">http://rocketscience.itteco.org/2009/1... | 4 | 2010-01-26T02:07:23Z | [
"python",
"django"
] |
how to import contacts from various services like gmail or yahoo using python/django | 1,774,915 | <p>How can I import contacts of given email id/pwd from </p>
<ol>
<li>gmail</li>
<li>yahoo</li>
<li>hotmail </li>
<li>etc</li>
</ol>
<p>using python/django application. Please suggest?</p>
| 4 | 2009-11-21T08:12:22Z | 11,819,696 | <p>Amir Hussain,</p>
<p>Yahoo mail using captcha, so it will not works for any scripts or service unless they have managed service with the help of a third party for captcha decoder. So u have to contact a service provider who provide managed service. </p>
<p>As far as I know, Improsys is the first Address Grabber ma... | 1 | 2012-08-05T20:10:58Z | [
"python",
"django"
] |
Can this be made more pythonic? | 1,775,459 | <p>I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.</p>
<p>Thanks</p>
<pre><code>from math im... | 2 | 2009-11-21T13:17:26Z | 1,775,475 | <p>A few minor things from the <a href="http://www.python.org/dev/peps/pep-0008/" rel="nofollow">style guide</a>.</p>
<p>
<li>Uses four spaces, not two. (Personally I prefer tabs, but that's not the Pythonic way.)
<li>Fewer blank lines.
<li>Consistent whitespace: <code>n ==2:</code> => <code>n == 2:</code>
<li>Use und... | 5 | 2009-11-21T13:26:26Z | [
"python",
"primes"
] |
Can this be made more pythonic? | 1,775,459 | <p>I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.</p>
<p>Thanks</p>
<pre><code>from math im... | 2 | 2009-11-21T13:17:26Z | 1,775,484 | <p>The given code is not very efficient. Alternative solution (just as inefficient):<sup>†</sup></p>
<pre><code>>>> from math import sqrt
>>> def is_prime(n):
... return all(n % d for d in range(2, int(sqrt(n)) + 1))
...
>>> def primes_up_to(n):
... return filter(is_prime, ra... | 6 | 2009-11-21T13:29:11Z | [
"python",
"primes"
] |
Can this be made more pythonic? | 1,775,459 | <p>I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.</p>
<p>Thanks</p>
<pre><code>from math im... | 2 | 2009-11-21T13:17:26Z | 1,775,485 | <p>Your algorithm itself may be implemented pythonically, but it's often useful to re-write algorithms in a functional way - You might end up with a completely different but more readable solution at all (which is even more pythonic).</p>
<pre><code>def primes(upper):
n = 2; found = []
while n < upper:
... | 7 | 2009-11-21T13:29:15Z | [
"python",
"primes"
] |
Can this be made more pythonic? | 1,775,459 | <p>I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.</p>
<p>Thanks</p>
<pre><code>from math im... | 2 | 2009-11-21T13:17:26Z | 1,775,506 | <p>Firstly, you should not assign max to a variable as it is an inbuilt function used to find the maximum value from an iterable. Also, that entire section of code can instead be written as</p>
<pre><code>for i in xrange(3, int(sqrt(n))+1, 2):
if n%i==0: return False
</code></pre>
<p>Also, instead of defining a n... | 2 | 2009-11-21T13:39:23Z | [
"python",
"primes"
] |
Can this be made more pythonic? | 1,775,459 | <p>I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.</p>
<p>Thanks</p>
<pre><code>from math im... | 2 | 2009-11-21T13:17:26Z | 1,775,508 | <p>Usually you don't use while loops for simple things like this. You rather create a range object and get the elements from there. So you could rewrite the first loop to this for example:</p>
<pre>
for i in range( 3, int( sqrt( n ) ) + 1, 2 ):
if n % i == 0:
return False
</pre>
<p>And it would be a lot b... | 1 | 2009-11-21T13:40:29Z | [
"python",
"primes"
] |
Can this be made more pythonic? | 1,775,459 | <p>I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.</p>
<p>Thanks</p>
<pre><code>from math im... | 2 | 2009-11-21T13:17:26Z | 1,775,595 | <p>You can make it more pythonic with sieve algorithm (all primes small than 100):</p>
<pre><code>def primes(n):
sieved = set()
for i in range(2, n):
if not(i in sieved):
for j in range(i + i, n, i):
sieved.add(j)
return set(range(2, n)) - sieved
print primes(100)
</cod... | 1 | 2009-11-21T14:13:56Z | [
"python",
"primes"
] |
Can this be made more pythonic? | 1,775,459 | <p>I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.</p>
<p>Thanks</p>
<pre><code>from math im... | 2 | 2009-11-21T13:17:26Z | 1,775,613 | <p>Translated from the brilliant guys at <a href="http://stacktrace.it/2008/01/progetto-eulero-problema-3/" rel="nofollow">stacktrace.it</a> (Daniele Varrazzo, specifically), this version takes advantage of <a href="http://en.wikipedia.org/wiki/Binary%5Fheap" rel="nofollow">a binary min-heap</a> to solve this problem:<... | 1 | 2009-11-21T14:24:47Z | [
"python",
"primes"
] |
Can this be made more pythonic? | 1,775,459 | <p>I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.</p>
<p>Thanks</p>
<pre><code>from math im... | 2 | 2009-11-21T13:17:26Z | 1,775,667 | <p>I recently found <a href="http://pyeuler.wikidot.com/start" rel="nofollow">Project Euler solutions in functional python</a> and it has some really nice examples of working with primes like this. <a href="http://pyeuler.wikidot.com/problems-1-10" rel="nofollow">Number 7</a> is pretty close to your problem:</p>
<pre>... | 2 | 2009-11-21T14:48:10Z | [
"python",
"primes"
] |
Python Threads do not run in C++ Application Embedded Interpreter | 1,775,612 | <p>I have a C++ application which uses embedded python interpreter with the Python C API. It can evaluate Python files and source code with PyRun_SimpleFile and PyObject_CallMethod.</p>
<p>Now I have a python source code which has a worked thread which subclasses threading.Thread and has a simple run re-implementation... | 3 | 2009-11-21T14:24:28Z | 1,977,399 | <p>What is the main thread doing? Is it simply returning control to your C++ app? If so, remember to release the GIL (Global Interpreter Lock) when not running any Python code in your main thread, otherwise your other Python threads will stall waiting for the GIL to be released.</p>
<p>The easiest way to do so is to u... | 2 | 2009-12-29T22:46:50Z | [
"python",
"multithreading"
] |
Python Threads do not run in C++ Application Embedded Interpreter | 1,775,612 | <p>I have a C++ application which uses embedded python interpreter with the Python C API. It can evaluate Python files and source code with PyRun_SimpleFile and PyObject_CallMethod.</p>
<p>Now I have a python source code which has a worked thread which subclasses threading.Thread and has a simple run re-implementation... | 3 | 2009-11-21T14:24:28Z | 25,819,019 | <p>I've had the same similar problem and found the solution. I know the thread is pretty old but just in case anybody is wondering... Here is a code sample that does what you need.</p>
<pre><code>#include <Python.h>
#include <iostream>
#include <string>
#include <chrono>
#include <thread>... | 2 | 2014-09-13T01:37:56Z | [
"python",
"multithreading"
] |
Automatically pick tags from context using Python | 1,775,637 | <p>How can I pick tags from an article or a user's post using Python?</p>
<p>Is the following method ok?</p>
<ol>
<li><p>Build a list of word frequency from the text and sort them.</p></li>
<li><p>Remove some common words and pick the top 10 words remained in the list as the tags.</p></li>
</ol>
<p>If the above meth... | 4 | 2009-11-21T14:38:13Z | 1,775,670 | <p>Here's an article on <a href="http://digitalhistoryhacks.blogspot.com/2006/08/easy-pieces-in-python-removing-stop.html" rel="nofollow">removing stop words</a>. The link to the stop word list in the article is broken but <a href="http://armandbrahaj.blog.al/2009/04/14/list-of-english-stop-words/" rel="nofollow">here'... | 4 | 2009-11-21T14:49:32Z | [
"python",
"tags"
] |
Automatically pick tags from context using Python | 1,775,637 | <p>How can I pick tags from an article or a user's post using Python?</p>
<p>Is the following method ok?</p>
<ol>
<li><p>Build a list of word frequency from the text and sort them.</p></li>
<li><p>Remove some common words and pick the top 10 words remained in the list as the tags.</p></li>
</ol>
<p>If the above meth... | 4 | 2009-11-21T14:38:13Z | 1,775,672 | <p>The <a href="http://www.nltk.org/" rel="nofollow">Natural Language Toolkit</a> offers a broad variety of methods for this kind of stuff. I can't give you hands-on advice as I'm not familiar with this subject, but I think it's worth the effort to read a few <a href="http://www.nltk.org/documentation" rel="nofollow">... | 3 | 2009-11-21T14:50:06Z | [
"python",
"tags"
] |
Automatically pick tags from context using Python | 1,775,637 | <p>How can I pick tags from an article or a user's post using Python?</p>
<p>Is the following method ok?</p>
<ol>
<li><p>Build a list of word frequency from the text and sort them.</p></li>
<li><p>Remove some common words and pick the top 10 words remained in the list as the tags.</p></li>
</ol>
<p>If the above meth... | 4 | 2009-11-21T14:38:13Z | 1,775,718 | <p>I'd suggest you <a href="http://blog.stackoverflow.com/2009/11/creative-commons-data-dump-nov-09/" rel="nofollow">download the Stack Overflow data dump</a>. There you get a lot of real world posts, with appropriate tags, to test different algorithms of tag selection.</p>
<p>But generally I doubt it will work too we... | 2 | 2009-11-21T15:06:25Z | [
"python",
"tags"
] |
Automatically pick tags from context using Python | 1,775,637 | <p>How can I pick tags from an article or a user's post using Python?</p>
<p>Is the following method ok?</p>
<ol>
<li><p>Build a list of word frequency from the text and sort them.</p></li>
<li><p>Remove some common words and pick the top 10 words remained in the list as the tags.</p></li>
</ol>
<p>If the above meth... | 4 | 2009-11-21T14:38:13Z | 1,775,731 | <p>Instead of blacklisting words that shouldn't be tags, why don't you instead build a whitelist of words that would make for good tags?</p>
<p>Start with an handful of tags that you would like to have, like <code>Python</code>, <code>off-topic</code>, <code>football</code>, <code>rickroll</code> or whatnot (depends o... | 0 | 2009-11-21T15:11:32Z | [
"python",
"tags"
] |
Automatically pick tags from context using Python | 1,775,637 | <p>How can I pick tags from an article or a user's post using Python?</p>
<p>Is the following method ok?</p>
<ol>
<li><p>Build a list of word frequency from the text and sort them.</p></li>
<li><p>Remove some common words and pick the top 10 words remained in the list as the tags.</p></li>
</ol>
<p>If the above meth... | 4 | 2009-11-21T14:38:13Z | 1,778,174 | <p>Train Bayes or Fischer filter with already tagged data (e.g. with Stackoverflow data dump suggested by sth) and use it to classify new posts. I'd recommend reading excellent Programming Collective Intelligence book by Toby Segaran for more information and python examples on this topic.</p>
| 1 | 2009-11-22T08:14:03Z | [
"python",
"tags"
] |
Continuously redraw wxPython element | 1,775,921 | <p>I have a chat client that continuously polls a server and fetches new messages.</p>
<p>From my <strong>def __init__()</strong> I have:</p>
<pre><code>wx.CallAfter(self.pollServer)
</code></pre>
<p>Which is defined:</p>
<pre><code>def pollServer(self):
t = self.updateMessages()
time.sleep(5)
self.poll... | 1 | 2009-11-21T16:19:43Z | 1,775,934 | <p>instead of </p>
<pre><code>time.sleep(5)
self.pollServer()
</code></pre>
<p>try with</p>
<pre><code>wx.CallLater(5,self.pollServer)
</code></pre>
| 2 | 2009-11-21T16:24:00Z | [
"python",
"wxpython",
"refresh",
"timer"
] |
Using Python 3.1 with TextMate | 1,775,954 | <p>TextMate seems to use the built-in Python version I assume (sys.path doesn't work). How do you configure it to use 3.1 instead? I've already installed the 3.1 package and I can use IDLE for interactive sessions, but I need to use TextMate now.</p>
<p>Thanks</p>
| 17 | 2009-11-21T16:34:17Z | 1,776,026 | <p>TextMate uses the value of the <code>TM_PYTHON</code> variable to find the path to the Python interpreter. A good solution is to take advantage of TextMate's ability to define variables like <code>TM_PYTHON</code> on a per-project basis:</p>
<ol>
<li><p>Open a new or existing TextMate Project (<code>File -> New... | 39 | 2009-11-21T16:56:05Z | [
"python",
"osx",
"python-3.x",
"textmate"
] |
Using Python 3.1 with TextMate | 1,775,954 | <p>TextMate seems to use the built-in Python version I assume (sys.path doesn't work). How do you configure it to use 3.1 instead? I've already installed the 3.1 package and I can use IDLE for interactive sessions, but I need to use TextMate now.</p>
<p>Thanks</p>
| 17 | 2009-11-21T16:34:17Z | 1,776,037 | <p>According to <a href="http://old.nabble.com/using-python-3.0.1-td22499054.html" rel="nofollow">this long thread</a> (which was about Python 3.0, and the TextMate version existing back last spring, but I believe is still valid for Python 3.1 and today's TextMate), you can get it done (e.g. via @Ned's answer), but onc... | 5 | 2009-11-21T17:01:35Z | [
"python",
"osx",
"python-3.x",
"textmate"
] |
Using Python 3.1 with TextMate | 1,775,954 | <p>TextMate seems to use the built-in Python version I assume (sys.path doesn't work). How do you configure it to use 3.1 instead? I've already installed the 3.1 package and I can use IDLE for interactive sessions, but I need to use TextMate now.</p>
<p>Thanks</p>
| 17 | 2009-11-21T16:34:17Z | 3,297,378 | <p>Late to the party, sorry! I take it you want to run the script using TextMate's 'built-in' interpreter? I've found the simplest solution is to add a shebang, which works extremely well;</p>
<pre><code>#!/usr/bin/env python3
</code></pre>
<p>for python 3.1 or;</p>
<pre><code>#!/usr/bin/env python
</code></pre>
<p... | 6 | 2010-07-21T08:17:35Z | [
"python",
"osx",
"python-3.x",
"textmate"
] |
Using Python 3.1 with TextMate | 1,775,954 | <p>TextMate seems to use the built-in Python version I assume (sys.path doesn't work). How do you configure it to use 3.1 instead? I've already installed the 3.1 package and I can use IDLE for interactive sessions, but I need to use TextMate now.</p>
<p>Thanks</p>
| 17 | 2009-11-21T16:34:17Z | 7,792,338 | <p>the shebang is the best solution, to see where python 3 is installed type in terminal:</p>
<blockquote>
<p>which python3</p>
</blockquote>
<p>you will get something like this:</p>
<blockquote>
<p>/usr/local/bin/python3</p>
</blockquote>
<p>if nothing shows up first install python3</p>
<p>and at the top of y... | 1 | 2011-10-17T10:19:46Z | [
"python",
"osx",
"python-3.x",
"textmate"
] |
Python 3: Write newlines to HTML | 1,776,066 | <p>I have upgraded to Python 3 and can't figure out how to convert backslash escaped newlines to HTML.</p>
<p>The browser renders the backslashes literally, so "\n" has no effect on the HTML source. As a result, my source page is all in one long line and impossible to diagnose.</p>
| 4 | 2009-11-21T17:11:52Z | 1,776,085 | <p>Maybe I don't get it, but isn't <code><br /></code> some kind of newline for HTML?</p>
<pre><code>s = "Hello HTML\n"
to_render = s.replace("\n", "<br />")
</code></pre>
<p>If you render something with mimetype <code>"text/plain"</code> <code>\n</code>ewlines should work.</p>
| 0 | 2009-11-21T17:16:19Z | [
"python",
"html",
"unicode",
"python-3.x",
"newline"
] |
Python 3: Write newlines to HTML | 1,776,066 | <p>I have upgraded to Python 3 and can't figure out how to convert backslash escaped newlines to HTML.</p>
<p>The browser renders the backslashes literally, so "\n" has no effect on the HTML source. As a result, my source page is all in one long line and impossible to diagnose.</p>
| 4 | 2009-11-21T17:11:52Z | 1,776,100 | <p>normally I do like this <code>s=s.replace("\n","<br />\n")</code> </p>
<p>because </p>
<p><code><br /></code> is needed in web page display and </p>
<p><code>\n</code> is needed in source display.</p>
<p>just my 2 cents</p>
| 3 | 2009-11-21T17:21:28Z | [
"python",
"html",
"unicode",
"python-3.x",
"newline"
] |
Python 3: Write newlines to HTML | 1,776,066 | <p>I have upgraded to Python 3 and can't figure out how to convert backslash escaped newlines to HTML.</p>
<p>The browser renders the backslashes literally, so "\n" has no effect on the HTML source. As a result, my source page is all in one long line and impossible to diagnose.</p>
| 4 | 2009-11-21T17:11:52Z | 1,776,101 | <p>Print() should add a newline by default - unless you tell it otherwise. However there have been other changes in Python 3:</p>
<pre><code>Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
Old: print x, # Trailing comma suppresses newline
New: print(x, end=" ") # Appends a space instead o... | -1 | 2009-11-21T17:22:14Z | [
"python",
"html",
"unicode",
"python-3.x",
"newline"
] |
Python 3: Write newlines to HTML | 1,776,066 | <p>I have upgraded to Python 3 and can't figure out how to convert backslash escaped newlines to HTML.</p>
<p>The browser renders the backslashes literally, so "\n" has no effect on the HTML source. As a result, my source page is all in one long line and impossible to diagnose.</p>
| 4 | 2009-11-21T17:11:52Z | 1,780,981 | <p>It turns out that Chinese characters (æ) in the string is causing Unicode to do something unknown. But I'm getting closer!</p>
| 0 | 2009-11-23T03:34:50Z | [
"python",
"html",
"unicode",
"python-3.x",
"newline"
] |
Python 3: Write newlines to HTML | 1,776,066 | <p>I have upgraded to Python 3 and can't figure out how to convert backslash escaped newlines to HTML.</p>
<p>The browser renders the backslashes literally, so "\n" has no effect on the HTML source. As a result, my source page is all in one long line and impossible to diagnose.</p>
| 4 | 2009-11-21T17:11:52Z | 1,834,706 | <p>The solution is:</p>
<pre><code>#!/usr/bin/python
import sys
def print(s): return sys.stdout.buffer.write(s.encode('utf-8'))
print("Content-type:text/plain;charset=utf-8\n\n")
print('æ\n')
</code></pre>
<p>See the original discussion here:
<a href="http://groups.google.com/group/comp.lang.python/msg/f8bba... | 0 | 2009-12-02T18:00:55Z | [
"python",
"html",
"unicode",
"python-3.x",
"newline"
] |
python reload function and syntactically incorrect module | 1,776,153 | <p>What happens when I reload a module in python and the new code for the module is syntactically incorrect? The reload(module) function doesn't seem to be throwing any exception. Is there any way to determine if the reload was successful or failed?</p>
| 3 | 2009-11-21T17:40:13Z | 1,776,176 | <p>The reload() command should raise a SyntaxError:</p>
<pre><code>In [34]: import test
# This works fine
</code></pre>
<p>After making a syntax error in test.py: (changed import --> pimport)</p>
<pre><code>In [35]: reload(test)
------------------------------------------------------------
File "/home/unutbu/pybi... | 3 | 2009-11-21T17:47:45Z | [
"python"
] |
Advice on Python Parser Generators | 1,776,185 | <p>Hey guys, this is my first question here on Stack Overflow and I was wondering if I could ask the advice of people who know a bit more about Python and Parser Generators than I do.</p>
<p>I've been given a task where I have to create a parser for a simple C-like language. I can use any programming language and tool... | 9 | 2009-11-21T17:50:00Z | 1,776,190 | <p><a href="http://pyparsing.wikispaces.com/">PyParsing</a> is a python tool to generate parsers. There are a <a href="http://pyparsing.wikispaces.com/Examples">lot of interesting examples</a>.</p>
<p>Easy to get started:</p>
<pre><code>from pyparsing import Word, alphas
# define grammar
greet = Word( alphas ) + ","... | 10 | 2009-11-21T17:51:55Z | [
"python",
"parser-generator"
] |
Advice on Python Parser Generators | 1,776,185 | <p>Hey guys, this is my first question here on Stack Overflow and I was wondering if I could ask the advice of people who know a bit more about Python and Parser Generators than I do.</p>
<p>I've been given a task where I have to create a parser for a simple C-like language. I can use any programming language and tool... | 9 | 2009-11-21T17:50:00Z | 1,776,201 | <p>It looks like a <a href="http://pyparsing.wikispaces.com/">pyparsing</a> job for me. And it makes it relatively easy to manipulate the output, too.</p>
| 6 | 2009-11-21T17:54:25Z | [
"python",
"parser-generator"
] |
replacing Matlab with python | 1,776,290 | <p>i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. </p>
<p>i have done some research and many have sai... | 15 | 2009-11-21T18:24:26Z | 1,776,303 | <p>Maybe you like <a href="http://www.sagemath.org/" rel="nofollow">sagemath</a>, which 'combines the power of many existing open-source packages into a common Python-based interface'. Here is a <a href="http://sagemath.org/doc/tutorial/tour.html" rel="nofollow">feature tour</a>.</p>
| 4 | 2009-11-21T18:27:59Z | [
"python",
"matlab"
] |
replacing Matlab with python | 1,776,290 | <p>i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. </p>
<p>i have done some research and many have sai... | 15 | 2009-11-21T18:24:26Z | 1,776,325 | <p>Duplicate of <a href="http://stackoverflow.com/questions/179904/what-is-matlab-good-for-why-is-it-so-used-by-universities-when-is-it-better-tha">this</a>.</p>
<p>My sense is that for pure numerical/linear algebra computations and visualization Matlab is a slightly more consistent development environment. Numpy/Scip... | 0 | 2009-11-21T18:36:18Z | [
"python",
"matlab"
] |
replacing Matlab with python | 1,776,290 | <p>i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. </p>
<p>i have done some research and many have sai... | 15 | 2009-11-21T18:24:26Z | 1,776,343 | <p><a href="http://www.pythonxy.com/foreword.php" rel="nofollow">python(x,y)</a> is quite powerful, but only for Windows or Linux so you'll have to use bootcamp or Linux. A more lightweight package for mathematics is <a href="http://matplotlib.sourceforge.net/" rel="nofollow">Matplotlib</a>, which basically adds plotti... | 1 | 2009-11-21T18:41:21Z | [
"python",
"matlab"
] |
replacing Matlab with python | 1,776,290 | <p>i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. </p>
<p>i have done some research and many have sai... | 15 | 2009-11-21T18:24:26Z | 1,776,373 | <p>On a Mac the easiest ways to get started are (in no particular order):</p>
<ul>
<li><a href="http://www.enthought.com/products/epd.php" rel="nofollow">Enthought Python Distribution</a> which includes most scientific packages you are likely to need. Free for academic/non-commercial use.</li>
<li><a href="http://www.... | 20 | 2009-11-21T18:55:34Z | [
"python",
"matlab"
] |
replacing Matlab with python | 1,776,290 | <p>i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. </p>
<p>i have done some research and many have sai... | 15 | 2009-11-21T18:24:26Z | 1,776,911 | <p>Try <a href="http://www.sagemath.org/" rel="nofollow">Sage</a> - it is designed as an open source replacement for Matlab, Mathematica etc. It is implemented in Python and can be scripted with Python, but it also adds a lot of maths-specific features. There is an <a href="http://www.sagemath.org/download-mac.html" ... | 4 | 2009-11-21T21:53:07Z | [
"python",
"matlab"
] |
replacing Matlab with python | 1,776,290 | <p>i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. </p>
<p>i have done some research and many have sai... | 15 | 2009-11-21T18:24:26Z | 1,777,708 | <p>I've been programming with Matlab for about 15 years, and with Python for about 10. It usually breaks down this way:</p>
<p>If you can satisfy the following conditions:
1. You primarily use matrices and matrix operations
2. You have the money for a Matlab license
3. You work on a platform that mathworks... | 12 | 2009-11-22T03:12:25Z | [
"python",
"matlab"
] |
replacing Matlab with python | 1,776,290 | <p>i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. </p>
<p>i have done some research and many have sai... | 15 | 2009-11-21T18:24:26Z | 1,799,774 | <p>It would be great if the matlab to python conversion <a href="http://sourceforge.net/projects/mat2py/" rel="nofollow">mat2py</a> project at sourcefourge took off.. </p>
| 0 | 2009-11-25T20:35:09Z | [
"python",
"matlab"
] |
replacing Matlab with python | 1,776,290 | <p>i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available. </p>
<p>i have done some research and many have sai... | 15 | 2009-11-21T18:24:26Z | 19,096,059 | <p>There are three aspects to consider when replacing Matlab with Python; the core language capabilities, the IDE and the Price.</p>
<h1>Capabilities Comparison</h1>
<p>This section outlines all of the capabilities of each platform. In short everything Matlab can do, Python can also do plus much more. However, things... | 6 | 2013-09-30T13:54:29Z | [
"python",
"matlab"
] |
Strategies for debugging numerical stability issues? | 1,776,409 | <p>I'm trying to write an implementation of Wilson's spectral density factorization algorithm [1] for Python. The algorithm iteratively factorizes a [QxQ] matrix function into its square root (it's sort of an extension of the Newton-Raphson square-root finder for spectral density matrices).</p>
<p>The problem is that ... | 5 | 2009-11-21T19:04:23Z | 1,776,430 | <p>I would recommend asking this question on the <a href="http://mail.scipy.org/mailman/listinfo/scipy-user" rel="nofollow">scipy-user</a> mailing list, perhaps with an example of your code. Generally the people on the list seem to be highly experienced with numerical computation and are really helpful, just following ... | 3 | 2009-11-21T19:14:30Z | [
"python",
"matrix",
"scipy",
"numerical-stability",
"spectral-density"
] |
Strategies for debugging numerical stability issues? | 1,776,409 | <p>I'm trying to write an implementation of Wilson's spectral density factorization algorithm [1] for Python. The algorithm iteratively factorizes a [QxQ] matrix function into its square root (it's sort of an extension of the Newton-Raphson square-root finder for spectral density matrices).</p>
<p>The problem is that ... | 5 | 2009-11-21T19:04:23Z | 1,776,462 | <p><a href="http://pyinterval.googlecode.com/svn/trunk/html/index.html" rel="nofollow">Interval arithmetic</a> can help, but I'm not sure if performance will be sufficient to actually allow meaningful debugging at the matrix sizes of your interest (you have to figure on a couple orders of magnitude worth of slowdown, w... | 2 | 2009-11-21T19:26:43Z | [
"python",
"matrix",
"scipy",
"numerical-stability",
"spectral-density"
] |
couchDB , python and authentication | 1,776,434 | <p>I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is:</p>
<pre><code>Create database 'mydb': {'error': 'unauthorized', 'reason': 'You are not a server admin.'}
</code></pre>
<p>I hand edited the local.ini file to include my standard... | 10 | 2009-11-21T19:15:40Z | 1,777,642 | <p>The <code>Couch</code> class in the example does not pass any authentication information to the database, so it is not a miracle that it does not allow privileged operations. So your only options are:</p>
<ul>
<li>disable authentication completely (as you mentioned)</li>
<li>pass the user name and password as part ... | 4 | 2009-11-22T02:37:41Z | [
"python",
"couchdb"
] |
couchDB , python and authentication | 1,776,434 | <p>I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is:</p>
<pre><code>Create database 'mydb': {'error': 'unauthorized', 'reason': 'You are not a server admin.'}
</code></pre>
<p>I hand edited the local.ini file to include my standard... | 10 | 2009-11-21T19:15:40Z | 1,848,846 | <p>You can also do:</p>
<pre><code>db = couchdb.Database("http://your.url/yourdb")
db.resource.http.add_credentials(username, password)
</code></pre>
<p>after which all your requests should work.</p>
| 6 | 2009-12-04T18:35:36Z | [
"python",
"couchdb"
] |
couchDB , python and authentication | 1,776,434 | <p>I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is:</p>
<pre><code>Create database 'mydb': {'error': 'unauthorized', 'reason': 'You are not a server admin.'}
</code></pre>
<p>I hand edited the local.ini file to include my standard... | 10 | 2009-11-21T19:15:40Z | 1,964,048 | <p>There are several patches for python-couchdb that enable authentication. The code probably will be included in Version 0.7 but until then you can usr teh fork at <a href="http://github.com/mdornseif/couchdb-python" rel="nofollow">http://github.com/mdornseif/couchdb-python</a> - it allows you to use <a href="http://u... | 0 | 2009-12-26T18:56:38Z | [
"python",
"couchdb"
] |
couchDB , python and authentication | 1,776,434 | <p>I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is:</p>
<pre><code>Create database 'mydb': {'error': 'unauthorized', 'reason': 'You are not a server admin.'}
</code></pre>
<p>I hand edited the local.ini file to include my standard... | 10 | 2009-11-21T19:15:40Z | 4,309,247 | <p>Just pass it as part of the URI...python-couchdb will parse the user/pass out and use them:</p>
<p><a href="http://user:pass@localhost:5984" rel="nofollow">http://user:pass@localhost:5984</a></p>
| 2 | 2010-11-29T23:45:38Z | [
"python",
"couchdb"
] |
couchDB , python and authentication | 1,776,434 | <p>I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is:</p>
<pre><code>Create database 'mydb': {'error': 'unauthorized', 'reason': 'You are not a server admin.'}
</code></pre>
<p>I hand edited the local.ini file to include my standard... | 10 | 2009-11-21T19:15:40Z | 4,994,439 | <p>To concour David's reply, (i.e. "This is how I do it using module CouchDB 0.8 in python 2.6 with couchdb 1.0.2")</p>
<p>couch = couchdb.Server(couch_server)</p>
<p>couch.resource.credentials = (USERNAME, PASSWORD)</p>
| 18 | 2011-02-14T16:16:15Z | [
"python",
"couchdb"
] |
couchDB , python and authentication | 1,776,434 | <p>I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is:</p>
<pre><code>Create database 'mydb': {'error': 'unauthorized', 'reason': 'You are not a server admin.'}
</code></pre>
<p>I hand edited the local.ini file to include my standard... | 10 | 2009-11-21T19:15:40Z | 9,633,367 | <p>Above are all nice; but I've found that for oauth validation methods versus basic auth, this works really well:</p>
<pre><code>from couchdb import Server, Session
auth = Session()
auth.name = USERNAME
auth.password = PASSWORD
s = Server('http://localhost:5984/', session=auth)
db = s['dbname']
</code></pre>
<p>Note... | 1 | 2012-03-09T11:33:35Z | [
"python",
"couchdb"
] |
postgresql and python | 1,776,511 | <p>I need to visualize spatial data (20 polygons) from "postgis" database (postgresql), with python. I know how to connect postgresql database with python only, but I don`t how to visualize those polygons. It is project for my university. We need to use for example matplotlib and create application in python which will... | 1 | 2009-11-21T19:38:17Z | 1,776,520 | <p>There are many plotting packages for Python (and of course they support plotting polygons, it's one of the most fundamental features in that space;-), and the most popular one, I believe, is <a href="http://matplotlib.sourceforge.net/" rel="nofollow">matplotlib</a>.</p>
| 2 | 2009-11-21T19:40:30Z | [
"python",
"postgresql"
] |
postgresql and python | 1,776,511 | <p>I need to visualize spatial data (20 polygons) from "postgis" database (postgresql), with python. I know how to connect postgresql database with python only, but I don`t how to visualize those polygons. It is project for my university. We need to use for example matplotlib and create application in python which will... | 1 | 2009-11-21T19:38:17Z | 1,776,550 | <p>With matplotlib, you can draw polygons with the <a href="http://www.scipy.org/Cookbook/Matplotlib/ShadedRegions" rel="nofollow">fill() command</a>.</p>
<p>For example, to create a polygon with vertices (3,2),(4,2),(4,4),(3,4),
you define x=[3,4,4,3], y=[2,2,4,4] (the respective x and y coordinates)
and use fill(x,y... | 1 | 2009-11-21T19:49:15Z | [
"python",
"postgresql"
] |
postgresql and python | 1,776,511 | <p>I need to visualize spatial data (20 polygons) from "postgis" database (postgresql), with python. I know how to connect postgresql database with python only, but I don`t how to visualize those polygons. It is project for my university. We need to use for example matplotlib and create application in python which will... | 1 | 2009-11-21T19:38:17Z | 1,776,688 | <p>I've had good luck using the <a href="http://www.pythonware.com/products/pil/" rel="nofollow">Python Imaging Library</a> when I've needed to create raster (bitmap) graphics. It's got a pretty simple interface and makes it pretty easy to overlay graphics on top of another image. Unfortunately, PIL isn't updated tha... | 3 | 2009-11-21T20:33:24Z | [
"python",
"postgresql"
] |
postgresql and python | 1,776,511 | <p>I need to visualize spatial data (20 polygons) from "postgis" database (postgresql), with python. I know how to connect postgresql database with python only, but I don`t how to visualize those polygons. It is project for my university. We need to use for example matplotlib and create application in python which will... | 1 | 2009-11-21T19:38:17Z | 1,777,743 | <p>What is the purpose you are trying to achieve here? Do you just want to look at the data in the .shp files? There is an open source application called <a href="http://www.qgis.org/" rel="nofollow">Quantum GIS</a> that allows you to open spatial data directly from PostGIS (and directly from a shapefile for that matte... | 0 | 2009-11-22T03:46:35Z | [
"python",
"postgresql"
] |
postgresql and python | 1,776,511 | <p>I need to visualize spatial data (20 polygons) from "postgis" database (postgresql), with python. I know how to connect postgresql database with python only, but I don`t how to visualize those polygons. It is project for my university. We need to use for example matplotlib and create application in python which will... | 1 | 2009-11-21T19:38:17Z | 1,777,836 | <p>maybe u can try the <a href="http://matplotlib.sourceforge.net/examples/api/patch%5Fcollection.html" rel="nofollow">patch_collection example</a>. I have copy it here with matplotlib.pyplot and only Polygon part: </p>
<pre><code>import matplotlib
import matplotlib.pyplot as plt
from matplotlib.patches import Polygo... | 1 | 2009-11-22T04:42:55Z | [
"python",
"postgresql"
] |
How can a python base class tell whether a sub class has overriden its methods? | 1,776,994 | <p>Here is my guess, which doesn't work:</p>
<pre><code>class BaseClass(object):
def foo(self):
return 'foo'
def bar(self):
return 'bar'
def methods_implemented(self):
"""This doesn't work..."""
overriden = []
for method in ('foo', 'bar'):
this_method = g... | 5 | 2009-11-21T22:27:31Z | 1,777,092 | <p>Perhaps this?</p>
<pre><code>>>> class BaseClass(object):
... def foo(self):
... return 'foo'
... def bar(self):
... return 'bar'
... def methods_implemented(self):
... """This does work."""
... overriden = []
... for method in ('foo', 'bar'):
... ... | 8 | 2009-11-21T23:03:44Z | [
"python"
] |
How can a python base class tell whether a sub class has overriden its methods? | 1,776,994 | <p>Here is my guess, which doesn't work:</p>
<pre><code>class BaseClass(object):
def foo(self):
return 'foo'
def bar(self):
return 'bar'
def methods_implemented(self):
"""This doesn't work..."""
overriden = []
for method in ('foo', 'bar'):
this_method = g... | 5 | 2009-11-21T22:27:31Z | 1,777,094 | <p>The methods, even though calling the same object, are NOT the same object. You must test to see if the functions wrapped in the unbound method are the same object.</p>
<p>I'm using 2.6 over here, so I also changed the class to inherit from object.</p>
<pre><code>>>> class BaseClass(object):
... def fo... | 0 | 2009-11-21T23:05:48Z | [
"python"
] |
Which programming language has very short context-free Grammar in its formal specification? | 1,777,011 | <p>What programming language has short and beautiful grammars (in EBNF)?</p>
<p>Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful... | 6 | 2009-11-21T22:32:01Z | 1,777,020 | <p>What about GL Shading language? <a href="http://oss.sgi.com/projects/ogl-sample/registry/ARB/GLSLangSpec.Full.1.10.59.pdf" rel="nofollow">Language Specification</a> (PDF)</p>
<p>However for these kind of hobbies I always preferred to implement a subset of a known language by myself without choosing anything "premad... | 0 | 2009-11-21T22:34:46Z | [
"python",
"c",
"bash",
"vhdl"
] |
Which programming language has very short context-free Grammar in its formal specification? | 1,777,011 | <p>What programming language has short and beautiful grammars (in EBNF)?</p>
<p>Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful... | 6 | 2009-11-21T22:32:01Z | 1,777,035 | <p>One of the simplest imperative languages is Oberon-2. <a href="http://www-vs.informatik.uni-ulm.de:81/projekte/Oberon-2.Report/AppendixB-2.html" rel="nofollow">Syntax of Oberon-2</a>.</p>
<p>Also take a look at Oberon-07 (<a href="http://www.inf.ethz.ch/personal/wirth/Articles/Oberon/Oberon07.Report.pdf" rel="nofol... | 3 | 2009-11-21T22:40:28Z | [
"python",
"c",
"bash",
"vhdl"
] |
Which programming language has very short context-free Grammar in its formal specification? | 1,777,011 | <p>What programming language has short and beautiful grammars (in EBNF)?</p>
<p>Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful... | 6 | 2009-11-21T22:32:01Z | 1,777,087 | <h2>Assembly languages!</h2>
<p>...in general, and particularly for CPUs which have a simple architecture (few instructions, few addressing modes, few registers) have a relatively short grammar.</p>
<p>In fact, specialized processors, such as these found in programmable logic controllers can have a language with even... | 3 | 2009-11-21T23:02:41Z | [
"python",
"c",
"bash",
"vhdl"
] |
Which programming language has very short context-free Grammar in its formal specification? | 1,777,011 | <p>What programming language has short and beautiful grammars (in EBNF)?</p>
<p>Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful... | 6 | 2009-11-21T22:32:01Z | 1,777,095 | <p>I haven't compared, but Lua is a language renowned for its simple syntax. The BNF is at the very end of this reference manual: <a href="http://www.lua.org/manual/5.1/manual.html" rel="nofollow">http://www.lua.org/manual/5.1/manual.html</a> .</p>
| 3 | 2009-11-21T23:06:08Z | [
"python",
"c",
"bash",
"vhdl"
] |
Which programming language has very short context-free Grammar in its formal specification? | 1,777,011 | <p>What programming language has short and beautiful grammars (in EBNF)?</p>
<p>Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful... | 6 | 2009-11-21T22:32:01Z | 1,777,112 | <p>Pascal has only 2-3 pages of BNF notations </p>
| 1 | 2009-11-21T23:13:48Z | [
"python",
"c",
"bash",
"vhdl"
] |
Which programming language has very short context-free Grammar in its formal specification? | 1,777,011 | <p>What programming language has short and beautiful grammars (in EBNF)?</p>
<p>Some languages are easer to be parsed. Some time ago I have created a simple VHDL parser, but it was very slow. Not because it is implemented completely in Python, but because VHDL grammar (in EBNF) is huge. The EBNF of Python is beautiful... | 6 | 2009-11-21T22:32:01Z | 1,777,190 | <p>Lisp is probably pretty small.</p>
<pre><code>lisp ::= `(´ exp `)´
</code></pre>
| 0 | 2009-11-21T23:48:12Z | [
"python",
"c",
"bash",
"vhdl"
] |
How to auto log into gmail atom feed with Python? | 1,777,081 | <p>Gmail has this sweet thing going on to get an atom feed:</p>
<pre><code>def gmail_url(user, pwd):
return "https://"+str(user)+":"+str(pwd)+"@gmail.google.com/gmail/feed/atom"
</code></pre>
<p>Now when you do this in a browser, it authenticates and forwards you. But in Python, at least what I'm trying, isn't w... | 10 | 2009-11-21T23:01:16Z | 1,777,142 | <p>You can use the HTTPBasicAuthHandler, I tried the following and it worked:</p>
<pre><code>import urllib2
def get_unread_msgs(user, passwd):
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password(
realm='New mail feed',
uri='https://mail.google.com',
user='%s@gmail.c... | 13 | 2009-11-21T23:30:37Z | [
"python",
"rss",
"gmail",
"atom",
"urllib"
] |
Using python imaplib to "delete" an email from Gmail? | 1,777,264 | <p>Can you delete emails with imaplib? If so how?</p>
| 12 | 2009-11-22T00:13:58Z | 1,777,290 | <p>Deleting an email over IMAP is performed in two phases:</p>
<ul>
<li>mark one or more items for deletion: <code>imap.store(msg_no, '+FLAGS', '\\Deleted')</code></li>
<li>expunge the mailbox: <code>imap.expunge()</code></li>
</ul>
<p>(<code>imap</code> is your <code>IMAP4</code> object)</p>
| 15 | 2009-11-22T00:23:40Z | [
"python",
"email",
"imap"
] |
Using python imaplib to "delete" an email from Gmail? | 1,777,264 | <p>Can you delete emails with imaplib? If so how?</p>
| 12 | 2009-11-22T00:13:58Z | 1,777,304 | <p>Use the <a href="http://docs.python.org/library/imaplib.html?highlight=imaplib#imaplib.IMAP4.store">store</a> method (of the <code>IMAP4</code> object representing your connection) to set the <code>r'\Deleted'</code> flag on the message number you want to delete, as the example in the docs show; then the <a href="ht... | 20 | 2009-11-22T00:30:37Z | [
"python",
"email",
"imap"
] |
Using python imaplib to "delete" an email from Gmail? | 1,777,264 | <p>Can you delete emails with imaplib? If so how?</p>
| 12 | 2009-11-22T00:13:58Z | 3,044,555 | <pre><code>imap.uid('STORE', list_of_msgno , '+FLAGS', '(\Deleted)')
imap.expunge()
</code></pre>
<p>i.e </p>
<pre><code>imap.uid('STORE', '2, 4, 9, 12' , '+FLAGS', '(\Deleted)')
</code></pre>
<p>Here <code>(2, 4, 9, 12)</code> are <code>uid</code> of the messages which are going to be deleted.</p>
| 9 | 2010-06-15T11:07:43Z | [
"python",
"email",
"imap"
] |
How to detect Mac OS version using Python? | 1,777,344 | <p>My application is assumed to be running on a Mac OS X system. However, what I need to do is figure out what version of Mac OS (or Darwin) it is running on, preferably as a number. For instance,</p>
<ul>
<li>"10.4.11" would return either 10.4 or 8</li>
<li>"10.5.4" would return 10.5 or 9</li>
<li>"10.6" would retu... | 16 | 2009-11-22T00:41:06Z | 1,777,365 | <pre><code>>>> import platform
>>> platform.mac_ver()
('10.5.8', ('', '', ''), 'i386')
</code></pre>
<p>As you see, the first item of the tuple <a href="http://docs.python.org/library/platform.html?highlight=mac%5Fver#platform.mac%5Fver"><code>mac_ver</code></a> returns is a string, not a number (har... | 34 | 2009-11-22T00:49:10Z | [
"python",
"osx"
] |
How to detect Mac OS version using Python? | 1,777,344 | <p>My application is assumed to be running on a Mac OS X system. However, what I need to do is figure out what version of Mac OS (or Darwin) it is running on, preferably as a number. For instance,</p>
<ul>
<li>"10.4.11" would return either 10.4 or 8</li>
<li>"10.5.4" would return 10.5 or 9</li>
<li>"10.6" would retu... | 16 | 2009-11-22T00:41:06Z | 1,777,368 | <p>If you want to run a command - like 'uname' - and get the results as a string, use the <a href="http://docs.python.org/library/subprocess.html" rel="nofollow">subprocess module</a>.</p>
<pre><code>import subprocess
output = subprocess.Popen(["uname", "-r"], stdout=subprocess.PIPE).communicate()[0]
</code></pre>
| 0 | 2009-11-22T00:50:23Z | [
"python",
"osx"
] |
How to detect Mac OS version using Python? | 1,777,344 | <p>My application is assumed to be running on a Mac OS X system. However, what I need to do is figure out what version of Mac OS (or Darwin) it is running on, preferably as a number. For instance,</p>
<ul>
<li>"10.4.11" would return either 10.4 or 8</li>
<li>"10.5.4" would return 10.5 or 9</li>
<li>"10.6" would retu... | 16 | 2009-11-22T00:41:06Z | 1,777,372 | <p>You could parse the output of the /usr/bin/sw_vers command.</p>
| 1 | 2009-11-22T00:51:15Z | [
"python",
"osx"
] |
How to detect Mac OS version using Python? | 1,777,344 | <p>My application is assumed to be running on a Mac OS X system. However, what I need to do is figure out what version of Mac OS (or Darwin) it is running on, preferably as a number. For instance,</p>
<ul>
<li>"10.4.11" would return either 10.4 or 8</li>
<li>"10.5.4" would return 10.5 or 9</li>
<li>"10.6" would retu... | 16 | 2009-11-22T00:41:06Z | 16,028,538 | <p>If you are already using os, you might want to use os.uname() </p>
<pre><code>import os
os.uname()
</code></pre>
| 2 | 2013-04-16T03:59:31Z | [
"python",
"osx"
] |
How to detect Mac OS version using Python? | 1,777,344 | <p>My application is assumed to be running on a Mac OS X system. However, what I need to do is figure out what version of Mac OS (or Darwin) it is running on, preferably as a number. For instance,</p>
<ul>
<li>"10.4.11" would return either 10.4 or 8</li>
<li>"10.5.4" would return 10.5 or 9</li>
<li>"10.6" would retu... | 16 | 2009-11-22T00:41:06Z | 16,981,403 | <p>platform.mac_ver() will return a tuple (release, versioninfo, machine</p>
<p>So get mac version by code</p>
<pre><code>>>> platform.mac_ver()[0]
'10.8.4'
</code></pre>
<p>this method is easy</p>
| 0 | 2013-06-07T10:02:16Z | [
"python",
"osx"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.