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 reboot a Windows XP64 Machine in a Python Script?
341,138
<p>How can I reboot a Windows XP64 Machine in a Python Script? This machine does not have the "shutdown" or "restart" executables available.</p>
4
2008-12-04T16:06:52Z
341,329
<p>You can use win32api module and call WinApi functions. <a href="http://code.activestate.com/recipes/360649/" rel="nofollow">Recipe at code.activestate.com</a></p>
2
2008-12-04T17:01:18Z
[ "python", "windows" ]
How can I reboot a Windows XP64 Machine in a Python Script?
341,138
<p>How can I reboot a Windows XP64 Machine in a Python Script? This machine does not have the "shutdown" or "restart" executables available.</p>
4
2008-12-04T16:06:52Z
341,369
<p>found it </p> <p>win32api.InitiateSystemShutdown("localhost", "Maintenance Reboot", 60, 1, 1)</p>
4
2008-12-04T17:10:04Z
[ "python", "windows" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
341,216
<p>As far as I know Python runs off of the commandline using the PATH variable as opposed to a registry setting.</p> <p>So if you point to the correct version on your PATH you will use that. Remember to restart your command prompt to use the new PATH settings.</p>
2
2008-12-04T16:29:01Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
341,218
<p>You can have both installed.</p> <p>You should write in front of your script :</p> <pre><code>#!/bin/env python2.6 </code></pre> <p>or eventually..</p> <pre><code>#!/bin/env python3.0 </code></pre> <h2>Update</h2> <p>My solution work perfectly with Unix, after a quick search on <a href="http://news.softpedia.c...
28
2008-12-04T16:29:38Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
341,231
<p>I think there is an option to setup the windows file association for .py files in the installer. Uncheck it and you should be fine.</p> <p>If not, you can easily re-associate .py files with the previous version. The simplest way is to right click on a .py file, select "open with" / "choose program". On the dialo...
1
2008-12-04T16:33:47Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
341,444
<p>I would assume so, I have Python 2.4, 2.5 and 2.6 installed side-by-side on the same computer.</p>
0
2008-12-04T17:31:33Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
436,455
<p>I'm using 2.5, 2.6, and 3.0 from the shell with one line batch scripts of the form:</p> <pre><code>:: The @ symbol at the start turns off the prompt from displaying the command. :: The % represents an argument, while the * means all of them. @c:\programs\pythonX.Y\python.exe %* </code></pre> <p>Name them <code>pyt...
9
2009-01-12T18:26:55Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
453,580
<p>You should make sure that the PATH environment variable doesn't contain both python.exe files ( add the one you're currently using to run scripts on a day to day basis ) , or do as Kniht suggested with the batch files . Aside from that , I don't see why not .</p> <p>P.S : I have 2.6 installed as my <strong>"primary...
1
2009-01-17T16:53:19Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
604,714
<p>The Python installation normally associates <code>.py</code>, <code>.pyw</code> and <code>.pyc</code> files with the Python interpreter. So you can run a Python script either by double-clicking it in Explorer or by typing its name in a command-line window (so no need to type <code>python scriptname.py</code>, just <...
3
2009-03-03T00:57:41Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
762,725
<p>Here you go...</p> <p><strong>winpylaunch.py</strong></p> <pre><code># # Looks for a directive in the form: #! C:\Python30\python.exe # The directive must start with #! and contain ".exe". # This will be assumed to be the correct python interpreter to # use to run the script ON WINDOWS. If no interpreter is # foun...
7
2009-04-18T01:45:53Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
13,297,878
<p>The official solution for coexistence seems to be the <a href="http://blog.python.org/2011/07/python-launcher-for-windows_11.html">Python Launcher for Windows</a>, PEP 397 which was included in <a href="http://www.python.org/download/releases/3.3.0/">Python 3.3.0</a>. Installing the release dumps <code>py.exe</code...
35
2012-11-08T21:11:48Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
32,195,996
<p>Here's my setup:</p> <ol> <li>Install both Python 2.7 and 3.4 with the <a href="https://www.python.org/downloads/">windows installers</a>.</li> <li>Go to <code>C:\Python34</code> (the default install path) and change python.exe to python3.exe</li> <li><strong>Edit</strong> <a href="https://www.microsoft.com/resourc...
7
2015-08-25T05:15:42Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
34,572,947
<p><H3>Here is how to run Python 2 and 3 on the same machine</H3></p> <ol> <li> install Python 2.x </li> <li>install Python 3.x </li> <li>Start Powershell </li> <li>Type <b>Python -2</b> to launch Python 2.x </li> <li>Type <b>Python -3</b> to launch Python 2.x </li> </ol> <p>The <i>Python Launcher for Windows</...
1
2016-01-03T03:10:43Z
[ "python", "windows", "python-3.x", "compatibility" ]
Can I install Python 3.x and 2.x on the same computer?
341,184
<p>I'm running Windows and the shell/OS automatically runs Python based on the registry settings when you run a program on the command line. Will this break if I install a 2.x and 3.x version of Python on the same machine?</p> <p>I want to play with Python 3 while still being able to run 2.x scripts on the same machin...
69
2008-12-04T16:18:57Z
38,094,030
<p>From version 3.3 Python introduced Launcher for Windows utility <a href="https://docs.python.org/3/using/windows.html#python-launcher-for-windows" rel="nofollow">https://docs.python.org/3/using/windows.html#python-launcher-for-windows</a>.</p> <p>So to be able to use multiple versions of Python:</p> <ol> <li>insta...
2
2016-06-29T08:18:41Z
[ "python", "windows", "python-3.x", "compatibility" ]
Python Decorators run before function it is decorating is called?
341,379
<p>As an example,</p> <pre><code>def get_booking(f=None): print "Calling get_booking Decorator" def wrapper(request, **kwargs): booking = _get_booking_from_session(request) if booking == None: # we don't have a booking in our session. return HttpRedirect('/') els...
4
2008-12-04T17:13:32Z
341,389
<p>I believe python decorators are just syntactic sugar.</p> <pre><code>@foo def bar (): pass </code></pre> <p>is the same thing as</p> <pre><code>def bar (): pass bar = foo(bar) </code></pre> <p>As you can see, <em>foo</em> is being called even though <em>bar</em> has not been called. This is why you see t...
19
2008-12-04T17:17:27Z
[ "python", "django", "decorator" ]
Python Decorators run before function it is decorating is called?
341,379
<p>As an example,</p> <pre><code>def get_booking(f=None): print "Calling get_booking Decorator" def wrapper(request, **kwargs): booking = _get_booking_from_session(request) if booking == None: # we don't have a booking in our session. return HttpRedirect('/') els...
4
2008-12-04T17:13:32Z
341,391
<p>A decorator is called as soon as the decorated function is defined. It is equivalent to writing something like this:</p> <pre><code>def __do_stuff(...): ... do_stuff = get_booking(__do_stuff) </code></pre>
0
2008-12-04T17:18:22Z
[ "python", "django", "decorator" ]
Python Decorators run before function it is decorating is called?
341,379
<p>As an example,</p> <pre><code>def get_booking(f=None): print "Calling get_booking Decorator" def wrapper(request, **kwargs): booking = _get_booking_from_session(request) if booking == None: # we don't have a booking in our session. return HttpRedirect('/') els...
4
2008-12-04T17:13:32Z
341,406
<p>python decorators are functions applied to a function to transform it:</p> <pre><code>@my_decorator def function (): ... </code></pre> <p>is like doing this: </p> <pre><code>def function():... function = my_decorator(function) </code></pre> <p>What you want to do is:</p> <pre><code>def get_booking(f=None): ...
0
2008-12-04T17:20:57Z
[ "python", "django", "decorator" ]
Python Decorators run before function it is decorating is called?
341,379
<p>As an example,</p> <pre><code>def get_booking(f=None): print "Calling get_booking Decorator" def wrapper(request, **kwargs): booking = _get_booking_from_session(request) if booking == None: # we don't have a booking in our session. return HttpRedirect('/') els...
4
2008-12-04T17:13:32Z
341,513
<p>Since you are starting with decorators, I think reading these will be helpful, so that you know the pitfalls and workarounds beforehand.</p> <p>Here are two links to earlier discussions on decorators.</p> <p><a href="http://stackoverflow.com/questions/306130/python-decorator-makes-function-forget-that-it-belongs-t...
2
2008-12-04T17:50:05Z
[ "python", "django", "decorator" ]
Best way of sharing/managing our internal python library between applications
342,425
<p>Our company (xyz) is moving a lot of our Flash code to Python.</p> <p>In Flash, we have a shared library between our Flash apps - package xyz. We can make changes to the package without fear of breaking other apps when they are deployed because Flash compiles their code and includes the contents of the library. We ...
3
2008-12-04T23:16:44Z
342,442
<p>"explicitly tested against App1,2,3 every time there was a new library" actually isn't that onerous.</p> <p>Two things.</p> <ul> <li><p>You need a formal set of API unit tests that the library <em>must</em> pass. This is just the API, not every nuance of functionality. If this passes, then your changes are good ...
4
2008-12-04T23:30:12Z
[ "python", "deployment", "shared-libraries", "projects-and-solutions" ]
Best way of sharing/managing our internal python library between applications
342,425
<p>Our company (xyz) is moving a lot of our Flash code to Python.</p> <p>In Flash, we have a shared library between our Flash apps - package xyz. We can make changes to the package without fear of breaking other apps when they are deployed because Flash compiles their code and includes the contents of the library. We ...
3
2008-12-04T23:16:44Z
342,449
<p>I've used variations of this <a href="http://code.activestate.com/recipes/497000/" rel="nofollow">cookbook entry</a> to distribute python apps. Basically it involves zipping all your python sources up into a zip file, then concatenating it with a shell script to import the source files.</p> <p>This can be helpful ...
1
2008-12-04T23:34:10Z
[ "python", "deployment", "shared-libraries", "projects-and-solutions" ]
Best way of sharing/managing our internal python library between applications
342,425
<p>Our company (xyz) is moving a lot of our Flash code to Python.</p> <p>In Flash, we have a shared library between our Flash apps - package xyz. We can make changes to the package without fear of breaking other apps when they are deployed because Flash compiles their code and includes the contents of the library. We ...
3
2008-12-04T23:16:44Z
343,594
<p>I also favour the solution of packing everything together and limit the dependency on the OS libraries to the minimal (glibc and that's it). Hard drive is cheap, customer and support time is not.</p> <p>On windows, it's trivial with py2exe + InnoSetup.</p> <p>On Linux, it looks like <a href="http://pypi.python.org...
1
2008-12-05T11:41:39Z
[ "python", "deployment", "shared-libraries", "projects-and-solutions" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
342,517
<p>Why using python logger instead of django-logging? Give it a try it might just solve your problem. </p> <p><a href="http://code.google.com/p/django-logging/wiki/Overview" rel="nofollow">http://code.google.com/p/django-logging/wiki/Overview</a> </p> <p>At the moment it would only allow to view the root logger, but ...
1
2008-12-05T00:21:05Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
343,575
<p>Difficult to comment on your specific case. If settings.py is executed twice, then it's normal that you get two lines for every log sent.</p> <p>The way we set it up in our projects is to have one module dedicated to logging. That modules has a "module singleton" pattern, so that we only execute the interesting cod...
13
2008-12-05T11:35:08Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
343,701
<p>A hackish way, but you can try to put the logging code inside an admin.py. It is supposed to be imported only once.</p> <p>Alternatively; can you first check if <code>MyApp.views.scans</code> log exists? If it exists (maybe an error is raised) you can simply skip creation (and therefore not add the handler again). ...
0
2008-12-05T12:42:52Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
345,669
<p>Allow me to answer my own question. The underlying problem here is that settings.py gets imported twice, or maybe even more (See <a href="http://www.mail-archive.com/[email protected]/msg39059.html">here</a>). (I still don't understand why this is. Maybe some Django expert could explain that to me.) ...
28
2008-12-06T01:06:01Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
346,474
<p>You could get around your problem by checking for the number of handlers when you are doing your init.</p> <pre><code>def init_logging(): stdoutHandler = logging.StreamHandler( sys.stdout ) stdoutHandler.setLevel( DEBUG ) stdoutHandler.setFormatter( logging.Formatter( LOG_FORMAT_WITH_TIME ) ) logger...
3
2008-12-06T16:55:42Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
1,099,037
<p>To answer the question about why does "Django imports settings.py multiple times": it does not. </p> <p>You are probably running a multiprocess/multithread web server which creates several python sub-interpreters, where each of those imports the code from your django app once.</p> <p>Test that on the django test s...
2
2009-07-08T16:05:30Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
2,657,466
<p>``To answer the question about why does "Django imports settings.py multiple times": it does not.''</p> <p>Actually, it does get imported twice (skip past the first code chunk to get right into it but a good read if you've got the time):</p> <p><a href="http://blog.dscpl.com.au/2010/03/improved-wsgi-script-for-use...
5
2010-04-17T06:12:37Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
3,983,086
<p>As of version 1.3, Django uses standard python logging, configured with the <code>LOGGING</code> setting (documented here: <a href="http://docs.djangoproject.com/en/1.3/ref/settings/#std%3asetting-LOGGING">1.3</a>, <a href="http://docs.djangoproject.com/en/dev/ref/settings/#std%3asetting-LOGGING">dev</a>).</p> <p>D...
23
2010-10-20T23:23:54Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
4,933,153
<p>You can also use a run-once Middleware to get a similar effect, without the private variables. Note that this will only configure the logging for web-requests - you'll need to find a different solution if you want logging in your shell or command runs.</p> <pre><code>from django.conf import settings from django.co...
2
2011-02-08T12:43:34Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
5,889,904
<p>Reviving an old thread, but I was experiencing duplicate messages while using Django 1.3 Python logging with the <a href="http://docs.python.org/library/logging.config.html#configuration-dictionary-schema">dictConfig format</a>. </p> <p>The <code>disable_existing_loggers</code> gets rid of the duplicate handler/lo...
9
2011-05-04T21:09:10Z
[ "python", "django", "logging" ]
Python logging in Django
342,434
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
39
2008-12-04T23:24:26Z
7,658,823
<p>To add to <strong>A Lee</strong> post, python logging documentation states this about propagate:</p> <blockquote> <p><strong>Logger.propagate</strong></p> <p>If this evaluates to false, logging messages are not passed by this logger or by its child loggers to the handlers of higher level (ancestor) loggers. ...
0
2011-10-05T08:52:58Z
[ "python", "django", "logging" ]
Best way to import version-specific python modules
342,437
<p>Which method makes the most sense for importing a module in python that is version specific? My use case is that I'm writing code that will be deployed into a python 2.3 environment and in a few months be upgraded to python 2.5. This:</p> <pre><code>if sys.version_info[:2] &gt;= (2, 5): from string import Templ...
13
2008-12-04T23:28:10Z
342,465
<p>I would probably argue that the second one would be preferable. Sometimes, you can install a module from a newer version of python into an older one. For example, wsgiref comes with Python 2.5, but it isn't entirely uncommon for it to be installed into older versions (I think it will work with python 2.3 up).</p>
2
2008-12-04T23:40:20Z
[ "python", "migration", "module", "code-migration" ]
Best way to import version-specific python modules
342,437
<p>Which method makes the most sense for importing a module in python that is version specific? My use case is that I'm writing code that will be deployed into a python 2.3 environment and in a few months be upgraded to python 2.5. This:</p> <pre><code>if sys.version_info[:2] &gt;= (2, 5): from string import Templ...
13
2008-12-04T23:28:10Z
342,484
<p>Always the second way - you never know what different Python installations will have installed. <code>Template</code> is a specific case where it matters less, but when you test for the capability instead of the versioning you're always more robust.</p> <p>That's how I make <a href="http://www.testoob.org">Testoob<...
27
2008-12-04T23:57:33Z
[ "python", "migration", "module", "code-migration" ]
Python 2.6 multiprocessing.Queue compatible with threads?
342,556
<p>I am experimenting with the new multiprocessing module in Python 2.6. I am creating several processes each with its own multiprocessor.JoinableQueue instance. Each process spawns one or more worker threads (subclasses of threading.Thread) which share the JoinableQueue instance (passed in through each Thread's <cod...
7
2008-12-05T00:45:04Z
342,586
<p>You should pass Queue objects as target's arguments.</p> <p>Example from <a href="http://docs.python.org/library/multiprocessing.html" rel="nofollow">multiprocessing's documentation</a>:</p> <pre><code>from multiprocessing import Process, Queue def f(q): q.put([42, None, 'hello']) if __name__ == '__main__':...
2
2008-12-05T00:59:29Z
[ "python", "multiprocessing", "python-2.6" ]
Python 2.6 multiprocessing.Queue compatible with threads?
342,556
<p>I am experimenting with the new multiprocessing module in Python 2.6. I am creating several processes each with its own multiprocessor.JoinableQueue instance. Each process spawns one or more worker threads (subclasses of threading.Thread) which share the JoinableQueue instance (passed in through each Thread's <cod...
7
2008-12-05T00:45:04Z
342,608
<p>Thanks for the quick response. I am passing the multiprocessing.Queue instances as arguments to each Process as you illustrate. The failure seems to occur in the threads. I am creating them by subclassing threading.Thread and passing the queue to the '<strong>init</strong>' method of each thread instance. This se...
-1
2008-12-05T01:12:12Z
[ "python", "multiprocessing", "python-2.6" ]
Python 2.6 multiprocessing.Queue compatible with threads?
342,556
<p>I am experimenting with the new multiprocessing module in Python 2.6. I am creating several processes each with its own multiprocessor.JoinableQueue instance. Each process spawns one or more worker threads (subclasses of threading.Thread) which share the JoinableQueue instance (passed in through each Thread's <cod...
7
2008-12-05T00:45:04Z
342,713
<p>I didn't experiment with multi-processing in 2.6 yet, but I played a lot with pyprocessing (as it was called in 2.5).</p> <p>I can see that you are looking for a number of processes with each spawning a set of threads respectively.</p> <p>Since you are using the multiprocessing module, I will suggest use multi pro...
4
2008-12-05T02:08:18Z
[ "python", "multiprocessing", "python-2.6" ]
Python 2.6 multiprocessing.Queue compatible with threads?
342,556
<p>I am experimenting with the new multiprocessing module in Python 2.6. I am creating several processes each with its own multiprocessor.JoinableQueue instance. Each process spawns one or more worker threads (subclasses of threading.Thread) which share the JoinableQueue instance (passed in through each Thread's <cod...
7
2008-12-05T00:45:04Z
2,218,036
<p>You may be running into this bug:</p> <p><a href="http://bugs.python.org/issue4660" rel="nofollow">http://bugs.python.org/issue4660</a></p>
1
2010-02-07T19:43:37Z
[ "python", "multiprocessing", "python-2.6" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
342,740
<p>Honestly, no. The Windows API is an 800 pound monster covered with hair. <a href="http://www.charlespetzold.com/faq.html" rel="nofollow">Charlie Petzold's 15 pound book</a> was the canonical reference once upon a time.</p> <p>That said, the <a href="http://python.net/crew/mhammond/win32/" rel="nofollow">Python fo...
28
2008-12-05T02:26:44Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
342,831
<p>Learning Win32 API is 5% of initial understanding of concepts and the patterns used and 95% of RTFM. </p> <p>For those initial 5% the Petzold book is really good but I suspect that there ought to be some online tutorials which you can find in google as good as I can to find.</p> <p>Really, once you get the hang o...
3
2008-12-05T03:34:01Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
342,852
<p>As <a href="http://stackoverflow.com/questions/342729/learning-the-win32-api#342740">Charlie</a> says : "this Api is an 800 pound monster covered with hair". </p> <p>Consider using the express version (free) of visual studio for vb or c# (<a href="http://www.microsoft.com/express/" rel="nofollow">http://www.micros...
1
2008-12-05T03:43:44Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
342,863
<p>Once upon a time I read over some Win32 API tutorials at <a href="http://www.relisoft.com" rel="nofollow">www.relisoft.com</a></p> <p>They are an anti-MFC and pro-Win32 API shop and have a manifesto of sorts explaining practical reasons for why.</p> <p>They also have a general C++ tutorial. 99% of the time I like...
0
2008-12-05T03:51:10Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
342,867
<p>All you need is completely free on MSDN.COM. Win32 is easily programed using C/C++, C#, and Visual Basic. I recommend C/C++. YOu can download the Visual Studio Express editions <a href="http://www.microsoft.com/express/product/default.aspx" rel="nofollow">here</a>.</p> <p>All the documentation (not an abbrevi...
0
2008-12-05T03:54:35Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
342,876
<p>I strongly recommend <a href="http://www.winprog.org/tutorial/">theForger's Win32 API Tutorial</a>. Its a C tutorial, but he pretty much holds your hand and shows you the basics. Its also pretty short, which is nice in a tutorial.</p>
5
2008-12-05T04:01:34Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
343,020
<p>Since you've asked about Python, why do you need the Win32 API ? That's used for writing small, fast C/C++ programs. If your tool is Python, just download wxPython which runs wonderfully on Windows and produces sleek native GUIs with 1% the code and the effort.</p>
2
2008-12-05T06:06:53Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
343,372
<p>" > free resource to learn how to use the windows API (preferably with python)</p> <ol> <li><p>You may refer <a href="http://books.google.co.in/books?id=ns1WMyLVnRMC" rel="nofollow">Python Programming on Win32 by Mark Hammond and Andy Robinson</a> along with <a href="http://sourceforge.net/projects/pywin32/" rel="n...
1
2008-12-05T10:02:57Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
343,804
<p>Avoid tutorials (written by kids, for kids, newbie level) Read the Petzold, Richter, Pietrek, Russinovich and Adv. Win32 api newsgroup news://comp.os.ms-windows.programmer.win32</p>
7
2008-12-05T13:19:43Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
350,143
<p>About 4 years ago I set out to truly understand the Windows API. I was coding in C# at the time, but I felt like the framework was abstracting me too much from the API (which it was). So I switched to Delphi (C++ or C would have also been good choices). </p> <p>In my opinion, it is important that you start working ...
18
2008-12-08T16:53:44Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
350,170
<p>Umm...a lot of people have put the cart before the horse on this one. The question I have for you is: why do you want to learn Win32? </p> <p>If you want to learn it so you can build Windows user interfaces, perhaps consider wxPython instead. If you only plan on calling into non-visual Win32 APIs then the Petzold b...
0
2008-12-08T17:02:05Z
[ "python", "winapi" ]
How should I learn to use the Windows API with Python?
342,729
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. So, how should I go about learning to use the Windows API with Python?</p>
17
2008-12-05T02:20:30Z
1,076,124
<p>You have to start with these two books.</p> <p><a href="http://www.charlespetzold.com/faq.html" rel="nofollow">Petzold</a> book: Great for learning messages and message pumps, GDI and User32 stuff.</p> <p><a href="http://rads.stackoverflow.com/amzn/click/0735624240" rel="nofollow">Richter</a> book: The windows bas...
0
2009-07-02T19:04:10Z
[ "python", "winapi" ]
Problem regarding 3.0's "hashlib" module
343,204
<p>I've been working on getting a 2.5 module ported to 3.0, mostly for my own education, when I've gotten stuck. The class "Builder" has as its init:</p> <pre><code>def __init__(self, **options): self._verifyOptions(options) self._options = options self._initDigest() self._initBuildNames() self._me...
2
2008-12-05T08:35:13Z
343,228
<p>I havent tried 3.0 yet. But there is now a bigger distinction between a sequence of bytes and strings. The latter hold unicode codepoints while the former don't hold unicode but only <code>encoded</code> unicode strings. Hashes operate on sequences of bytes. So you will have to encode your (unicode) strings first be...
0
2008-12-05T08:47:02Z
[ "python", "python-3.x", "py2to3" ]
Problem regarding 3.0's "hashlib" module
343,204
<p>I've been working on getting a 2.5 module ported to 3.0, mostly for my own education, when I've gotten stuck. The class "Builder" has as its init:</p> <pre><code>def __init__(self, **options): self._verifyOptions(options) self._options = options self._initDigest() self._initBuildNames() self._me...
2
2008-12-05T08:35:13Z
343,284
<p>I'm guessing that this line:</p> <pre><code>digester.update(self._options.get('code')) </code></pre> <p>should become:</p> <pre><code>digester.update(self._options.get('code').encode("utf-8")) </code></pre> <p>The actual desired encoding could be different in your case, but UTF-8 will work in all cases.</p>
4
2008-12-05T09:16:24Z
[ "python", "python-3.x", "py2to3" ]
What happened to the python bindings for CGAL?
343,210
<p>I found the <a href="http://www.cgal.org/">Computational Geometry Algorithms Library</a> in my search for an algorithm to decompose a concave polygon into the minimum number of convex components. Links off the site and numerous google results indicate there are python bindings for it, which would be really handy, b...
7
2008-12-05T08:36:49Z
343,231
<p>The fastest would probably be just to look at the code and re-implement it yourself in python. carrying around all of CGAL just for this tiny bit seems redundant.<br /> Also this calculation doesn't strike me as something that would extremely benefit by running compiled.</p>
0
2008-12-05T08:47:23Z
[ "python", "geometry", "polygon", "computational-geometry", "cgal" ]
What happened to the python bindings for CGAL?
343,210
<p>I found the <a href="http://www.cgal.org/">Computational Geometry Algorithms Library</a> in my search for an algorithm to decompose a concave polygon into the minimum number of convex components. Links off the site and numerous google results indicate there are python bindings for it, which would be really handy, b...
7
2008-12-05T08:36:49Z
343,544
<p><a href="http://cgal-python.gforge.inria.fr/" rel="nofollow">CGAL-Python</a> has been inert for over a year but the code (available through the "Download" link) seems to work fine, though not with Python 3.</p>
3
2008-12-05T11:19:22Z
[ "python", "geometry", "polygon", "computational-geometry", "cgal" ]
What happened to the python bindings for CGAL?
343,210
<p>I found the <a href="http://www.cgal.org/">Computational Geometry Algorithms Library</a> in my search for an algorithm to decompose a concave polygon into the minimum number of convex components. Links off the site and numerous google results indicate there are python bindings for it, which would be really handy, b...
7
2008-12-05T08:36:49Z
441,903
<p>You may also be interested in the GEOS library, which is available in Python through <a href="http://trac.gispython.org/lab/wiki/Shapely" rel="nofollow">Shapely</a> and <a href="http://geodjango.org/docs/geos.html" rel="nofollow">the GEOS API included in GeoDjango</a>.</p>
1
2009-01-14T04:28:24Z
[ "python", "geometry", "polygon", "computational-geometry", "cgal" ]
What happened to the python bindings for CGAL?
343,210
<p>I found the <a href="http://www.cgal.org/">Computational Geometry Algorithms Library</a> in my search for an algorithm to decompose a concave polygon into the minimum number of convex components. Links off the site and numerous google results indicate there are python bindings for it, which would be really handy, b...
7
2008-12-05T08:36:49Z
13,081,921
<p>A rewrite of the CGAL-Python bindings has been done as part of the cgal-bindings project. Check it out : <a href="http://code.google.com/p/cgal-bindings/">http://code.google.com/p/cgal-bindings/</a></p>
10
2012-10-26T06:32:58Z
[ "python", "geometry", "polygon", "computational-geometry", "cgal" ]
What happened to the python bindings for CGAL?
343,210
<p>I found the <a href="http://www.cgal.org/">Computational Geometry Algorithms Library</a> in my search for an algorithm to decompose a concave polygon into the minimum number of convex components. Links off the site and numerous google results indicate there are python bindings for it, which would be really handy, b...
7
2008-12-05T08:36:49Z
19,105,479
<p>Bindings for CGAL are inherently difficult. Because the library is heavily template based there's a combinatorial explosion of possible ways to use it. Any binding would need to pick and choose what to include.</p> <p>However: Python package demakein (which I wrote), includes a module to compile C++ snippets on the...
1
2013-09-30T23:19:30Z
[ "python", "geometry", "polygon", "computational-geometry", "cgal" ]
What can Pygame do in terms of graphics that wxPython can't?
343,505
<p>I want to develop a very simple 2D game in Python. Pygame is the most popular library for game development in Python, but I'm already quite familiar with wxPython and feel comfortable using it. I've even written a <a href="http://eli.thegreenplace.net/2008/05/31/a-tetris-clone-in-python-wxpython/">Tetris clone</a> i...
16
2008-12-05T11:03:36Z
344,002
<p>Well, in theory there is nothing you can do with Pygame that you can't with wxPython. The point is not what but how. In my opinion, it's easier to write a game with PyGame becasue:</p> <ul> <li><p>It's faster. Pygame is based on SDL which is a C library specifically designed for games, it has been developed with sp...
19
2008-12-05T14:35:58Z
[ "python", "graphics", "wxpython", "pygame" ]
What can Pygame do in terms of graphics that wxPython can't?
343,505
<p>I want to develop a very simple 2D game in Python. Pygame is the most popular library for game development in Python, but I'm already quite familiar with wxPython and feel comfortable using it. I've even written a <a href="http://eli.thegreenplace.net/2008/05/31/a-tetris-clone-in-python-wxpython/">Tetris clone</a> i...
16
2008-12-05T11:03:36Z
344,045
<p>wxPython is based on <a href="http://wxwidgets.org/">wxWidgets</a> which is a GUI-oriented toolkit. It has the advantage of using the styles and decorations provided by the system it runs on and thus it is very easy to write portable applications that integrate nicely into the look and feel of whatever you're runnin...
13
2008-12-05T14:53:07Z
[ "python", "graphics", "wxpython", "pygame" ]
How do I work with multiple git branches of a python module?
343,517
<p>I want to use git to allow me to work on several features in a module I'm writing concurrently. I'm currently using SVN, with only one workspace, so I just have the workspace on my PYTHONPATH. I'm realizing this is less than ideal, so I was wondering if anyone could suggest a more 'proper' way of doing this.</p> <p...
2
2008-12-05T11:06:01Z
343,534
<p><a href="http://www.python.org/doc/2.5.2/tut/node8.html#SECTION008420000000000000000" rel="nofollow">Relative imports</a> (<a href="http://www.python.org/dev/peps/pep-0328/" rel="nofollow">PEP 328</a>) might help:</p> <pre><code>eggs/ __init__.py foo.py bar.py # foo.py from __future__ import absolute_import ...
3
2008-12-05T11:14:00Z
[ "python", "git", "module" ]
How do I work with multiple git branches of a python module?
343,517
<p>I want to use git to allow me to work on several features in a module I'm writing concurrently. I'm currently using SVN, with only one workspace, so I just have the workspace on my PYTHONPATH. I'm realizing this is less than ideal, so I was wondering if anyone could suggest a more 'proper' way of doing this.</p> <p...
2
2008-12-05T11:06:01Z
343,614
<p>"say I have a module 'eggs', with sub-modules 'foo' and 'bar'. Components in 'bar' use code in foo, so eggs/bar/a.py may 'import eggs.foo'."</p> <p>This may not be the best structure. I suggest you have some other modules struggling to get out.</p> <p>You have <code>eggs.bar.a</code> depending on <code>eggs.foo</...
1
2008-12-05T11:56:56Z
[ "python", "git", "module" ]
How do I work with multiple git branches of a python module?
343,517
<p>I want to use git to allow me to work on several features in a module I'm writing concurrently. I'm currently using SVN, with only one workspace, so I just have the workspace on my PYTHONPATH. I'm realizing this is less than ideal, so I was wondering if anyone could suggest a more 'proper' way of doing this.</p> <p...
2
2008-12-05T11:06:01Z
344,013
<p>Maybe I'm not understanding correctly, but it seems that git would <em>be</em> the solution here, since git's branches don't need separate paths.</p> <p>Create a branch for each working version of your eggs module. Then when you checkout that branch, the entire module is changed to a state matching the version of y...
1
2008-12-05T14:39:44Z
[ "python", "git", "module" ]
How do I submit a form given only the HTML source?
343,622
<p>I would like to be able to submit a form in an <strong>HTML source (string)</strong>. In other words I need at least the ability to generate POST parameters <strong>from a string containing HTML source of the form</strong>. This is needed in unit tests for a Django project. I would like a solution that possibly;</p>...
0
2008-12-05T12:02:54Z
343,639
<p>Since the Django test framework does this, I'm not sure what you're asking.</p> <p>Do you want to test a Django app that has a form?</p> <ul> <li>In which case, you need to do an initial GET</li> <li>followed by the resulting POST</li> </ul> <p>Do you want to write (and test) a Django app that submits a form to a...
2
2008-12-05T12:10:32Z
[ "python", "django", "testing", "parsing", "form-submit" ]
How do I submit a form given only the HTML source?
343,622
<p>I would like to be able to submit a form in an <strong>HTML source (string)</strong>. In other words I need at least the ability to generate POST parameters <strong>from a string containing HTML source of the form</strong>. This is needed in unit tests for a Django project. I would like a solution that possibly;</p>...
0
2008-12-05T12:02:54Z
343,743
<p>Check out <a href="http://wwwsearch.sourceforge.net/mechanize/" rel="nofollow">mechanize</a> or it's wrapper <a href="http://twill.idyll.org/" rel="nofollow">twill</a>. I think it's <a href="http://wwwsearch.sourceforge.net/ClientForm/" rel="nofollow">ClientForm</a> module will work for you.</p>
0
2008-12-05T12:59:34Z
[ "python", "django", "testing", "parsing", "form-submit" ]
How do I submit a form given only the HTML source?
343,622
<p>I would like to be able to submit a form in an <strong>HTML source (string)</strong>. In other words I need at least the ability to generate POST parameters <strong>from a string containing HTML source of the form</strong>. This is needed in unit tests for a Django project. I would like a solution that possibly;</p>...
0
2008-12-05T12:02:54Z
343,794
<p>It is simple... and hard at the same time.<br /> Disclaimer: I don't know much about Python and nothing at all about Django... So I give general, language agnostic advices... If one of the above advices doesn't work for you, you might want to do it manually:</p> <ul> <li>Load the page with an HTML parser, list the ...
2
2008-12-05T13:16:50Z
[ "python", "django", "testing", "parsing", "form-submit" ]
How do I submit a form given only the HTML source?
343,622
<p>I would like to be able to submit a form in an <strong>HTML source (string)</strong>. In other words I need at least the ability to generate POST parameters <strong>from a string containing HTML source of the form</strong>. This is needed in unit tests for a Django project. I would like a solution that possibly;</p>...
0
2008-12-05T12:02:54Z
345,334
<p>You should re-read the <a href="http://docs.djangoproject.com/en/dev/topics/testing/" rel="nofollow">documentation about Django's testing framework</a>, specifically the part about testing views (and forms) with <a href="http://docs.djangoproject.com/en/dev/topics/testing/#module-django.test.client" rel="nofollow">t...
4
2008-12-05T22:08:09Z
[ "python", "django", "testing", "parsing", "form-submit" ]
How to use InterWiki links in moinmoin?
343,769
<p>We use a number of diffrent web services in our company, wiki(moinmoin), bugtracker (internally), requestracker (customer connection), subversion. Is there a way to parse the wikipages so that if I write "... in Bug1234 you could ..." Bug1234 woud be renderd as a link to <code>http://mybugtracker/bug1234</code></p>
2
2008-12-05T13:08:12Z
343,926
<p>check out the interwiki page in moinmoin, (most wikis have them) we use trac for example and you can set up different link paths to point to your different web resources. So in our Trac you can go [[SSGWiki:Some Topic]] and it will point to another internal wiki.</p>
3
2008-12-05T14:06:51Z
[ "python", "wiki", "moinmoin" ]
How to use InterWiki links in moinmoin?
343,769
<p>We use a number of diffrent web services in our company, wiki(moinmoin), bugtracker (internally), requestracker (customer connection), subversion. Is there a way to parse the wikipages so that if I write "... in Bug1234 you could ..." Bug1234 woud be renderd as a link to <code>http://mybugtracker/bug1234</code></p>
2
2008-12-05T13:08:12Z
412,963
<p>I finally found the solution. "Add the site to data/intermap.txt" found at:</p> <p><a href="http://moinmo.in/MoinMoinQuestions#MoinMoinQuestions.2BAC8-Administration.Howtoaddnewinterwikisites.3F" rel="nofollow">http://moinmo.in/MoinMoinQuestions#MoinMoinQuestions.2BAC8-Administration.Howtoaddnewinterwikisites.3F</...
-1
2009-01-05T12:26:21Z
[ "python", "wiki", "moinmoin" ]
How to use InterWiki links in moinmoin?
343,769
<p>We use a number of diffrent web services in our company, wiki(moinmoin), bugtracker (internally), requestracker (customer connection), subversion. Is there a way to parse the wikipages so that if I write "... in Bug1234 you could ..." Bug1234 woud be renderd as a link to <code>http://mybugtracker/bug1234</code></p>
2
2008-12-05T13:08:12Z
1,932,862
<p>add to the file <code>data/intermap.txt</code> (create if not existing, but that should not happen) a line like</p> <pre><code>wpen http://en.wikipedia.org/wiki/ </code></pre> <p>so that you can write <code>[[wpen:MoinMoin]]</code> instead of <code>http://en.wikipedia.org/wiki/MoinMoin</code></p> <p>I also have</...
0
2009-12-19T12:58:37Z
[ "python", "wiki", "moinmoin" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
343,961
<p>What I found is the following site: <a href="http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html" rel="nofollow">http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html</a> It has a javascript converter, you should check the algorithm there. From the page:</p> <blockquote> <p>Programmers: The Java...
10
2008-12-05T14:21:28Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
344,060
<p>According to this page, UTM is supported by proj4js.</p> <p><a href="http://trac.osgeo.org/proj4js/wiki/UserGuide#Supportedprojectionclasses">http://trac.osgeo.org/proj4js/wiki/UserGuide#Supportedprojectionclasses</a></p> <p>You may also want to take a look at <a href="http://gdal.org">GDAL</a>. The gdal library ...
8
2008-12-05T14:58:52Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
344,083
<p>I ended up finding java code from IBM that solved it: <a href="http://www.ibm.com/developerworks/java/library/j-coordconvert/index.html">http://www.ibm.com/developerworks/java/library/j-coordconvert/index.html</a></p> <p>Just for reference, here is my python implementation of the method I needed:</p> <pre><code>im...
31
2008-12-05T15:04:59Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
1,092,232
<p>There is a perl module via CPAN called Geography::NationalGrid which can convert easting/northing to lat/longs. That may help.</p> <p>Alternatively there are lots of scripts on the <a href="http://www.movable-type.co.uk/scripts/latlong-gridref.html" rel="nofollow">movable-type site</a> that let you convert lat/long...
0
2009-07-07T13:04:24Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
6,734,087
<pre class="lang-js prettyprint-override"><code>//////////////////////////////////////////////////////////////////////////////////////////// // // ToLL - function to compute Latitude and Longitude given UTM Northing and Easting in meters // // Description: // This member function converts input north and east coord...
1
2011-07-18T14:00:41Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
10,239,676
<p>I'm new to this as well and have been studying up on the subject recently.</p> <p>Here's a method I found using the python <a href="http://pypi.python.org/pypi/GDAL" rel="nofollow">gdal</a> pacakge (the <em>osr</em> package is included in gdal). The gdal package is pretty powerful, but the documentation could be b...
5
2012-04-20T03:01:42Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
18,621,253
<p>You could use Proj4js, as follows.</p> <p>Download Proj4JS from GitHub, using <a href="https://github.com/proj4js/proj4js" rel="nofollow">this</a> link.</p> <p>The following code will convert from UTM to longitude latitude</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="proj4.js"&gt;&lt;/script&gt; ...
4
2013-09-04T18:30:40Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
27,388,998
<p>A Javascript version of Staale answer</p> <pre><code>function utmToLatLng(zone, easting, northing, northernHemisphere){ if (!northernHemisphere){ northing = 10000000 - northing; } var a = 6378137; var e = 0.081819191; var e1sq = 0.006739497; var k0 = 0.99...
1
2014-12-09T21:17:17Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
How to convert from UTM to LatLng in python or Javascript
343,865
<p>I have a bunch of files with coordinates in UTM form. For each coordinate I have easting, northing and zone. I need to convert this to LatLng for use with Google Map API to show the information in a map.</p> <p>I have found some online calculators that does this, but no actual code or libraries. <a href="http://tra...
23
2008-12-05T13:42:34Z
27,581,360
<p>One problem I had with using proj4js was that it needed the exact zone as @Richard points out. I found a great resource <a href="http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html" rel="nofollow">here</a> which can convert WGS to UTM and wrote a cleaner wrapper in JavaScript:</p> <p><a href="https://gith...
0
2014-12-20T14:55:26Z
[ "javascript", "python", "gis", "arcgis-js-api", "proj4js" ]
Notification Library for Windows
344,442
<p>I'm developing a small tray-icon application for Windows and I need to display non-intrusive visual notifications similar to those that appear when you receive a new message in MSN Messenger or any other IM application.</p> <p>I have looked at <a href="http://www.fullphat.net/index.php">Snarl</a>, but it seems to b...
6
2008-12-05T16:41:40Z
344,600
<p>I wrote one for .NET for the Genghis project (<a href="http://www.codeplex.com/genghis" rel="nofollow">link here</a>) a while back. Looks like it is over at MS CodePlex now. Look for the "AniForm" class. <a href="http://www.sellsbrothers.com/tools/genghis/screenshots/AniForm.JPG" rel="nofollow">Here</a> is a scre...
2
2008-12-05T17:28:54Z
[ "python", "windows", "notifications" ]
Notification Library for Windows
344,442
<p>I'm developing a small tray-icon application for Windows and I need to display non-intrusive visual notifications similar to those that appear when you receive a new message in MSN Messenger or any other IM application.</p> <p>I have looked at <a href="http://www.fullphat.net/index.php">Snarl</a>, but it seems to b...
6
2008-12-05T16:41:40Z
344,613
<p>You don't need anyhting. Just use toasters windows with Win32 api</p>
1
2008-12-05T17:35:51Z
[ "python", "windows", "notifications" ]
Notification Library for Windows
344,442
<p>I'm developing a small tray-icon application for Windows and I need to display non-intrusive visual notifications similar to those that appear when you receive a new message in MSN Messenger or any other IM application.</p> <p>I have looked at <a href="http://www.fullphat.net/index.php">Snarl</a>, but it seems to b...
6
2008-12-05T16:41:40Z
344,649
<p>Are you developing the application in Python? It depends what GUI toolkit you're using.</p> <p>If you're using wxPython, you could try <a href="http://xoomer.alice.it/infinity77/main/ToasterBox.html" rel="nofollow">ToasterBox</a>, or the wxPopupWindow.</p>
2
2008-12-05T17:53:10Z
[ "python", "windows", "notifications" ]
Notification Library for Windows
344,442
<p>I'm developing a small tray-icon application for Windows and I need to display non-intrusive visual notifications similar to those that appear when you receive a new message in MSN Messenger or any other IM application.</p> <p>I have looked at <a href="http://www.fullphat.net/index.php">Snarl</a>, but it seems to b...
6
2008-12-05T16:41:40Z
349,840
<p>You can do it by depending on a GUI library.</p> <p>For example, with PyQt,it is possible :</p> <ul> <li><p><a href="http://pyqt.sourceforge.net/Docs/PyQt4/qsystemtrayicon.html" rel="nofollow">PyQt QSystemTrayIcon Documentation</a></p></li> <li><p><a href="http://qt-project.org/doc/qt-4.8/qsystemtrayicon.html" rel...
3
2008-12-08T15:20:50Z
[ "python", "windows", "notifications" ]
What is the most efficient way of extracting information from a large number of xml files in python?
344,559
<p>I have a directory full (~10<sup>3</sup>, 10<sup>4</sup>) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using xml.parsers.expat (the fastest one) to go through the file...
3
2008-12-05T17:15:37Z
344,641
<p>If you know that the XML files are generated using the ever-same algorithm, it might be more efficient to not do any XML parsing at all. E.g. if you know that the data is in lines 3, 4, and 5, you might read through the file line-by-line, and then use regular expressions.</p> <p>Of course, that approach would fail ...
1
2008-12-05T17:49:00Z
[ "python", "xml", "performance", "large-files", "expat-parser" ]
What is the most efficient way of extracting information from a large number of xml files in python?
344,559
<p>I have a directory full (~10<sup>3</sup>, 10<sup>4</sup>) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using xml.parsers.expat (the fastest one) to go through the file...
3
2008-12-05T17:15:37Z
344,694
<p>The quickest way would be to match strings (with, e.g., regular expressions) instead of parsing XML - depending on your XMLs this could actually work.</p> <p>But the most important thing is this: instead of thinking through several options, just implement them and time them on a small set. This will take roughly th...
3
2008-12-05T18:08:02Z
[ "python", "xml", "performance", "large-files", "expat-parser" ]
What is the most efficient way of extracting information from a large number of xml files in python?
344,559
<p>I have a directory full (~10<sup>3</sup>, 10<sup>4</sup>) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using xml.parsers.expat (the fastest one) to go through the file...
3
2008-12-05T17:15:37Z
345,650
<p>One thing you didn't indicate is whether or not you're reading the XML into a DOM of some kind. I'm guessing that you're probably not, but on the off chance you are, don't. Use xml.sax instead. Using SAX instead of DOM will get you a significant performance boost.</p>
1
2008-12-06T00:52:34Z
[ "python", "xml", "performance", "large-files", "expat-parser" ]
What is the most efficient way of extracting information from a large number of xml files in python?
344,559
<p>I have a directory full (~10<sup>3</sup>, 10<sup>4</sup>) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using xml.parsers.expat (the fastest one) to go through the file...
3
2008-12-05T17:15:37Z
349,472
<p>Usually, I would suggest using ElementTree's <a href="http://effbot.org/zone/element-iterparse.htm" rel="nofollow"><code>iterparse</code></a>, or for extra-speed, its counterpart from <a href="http://codespeak.net/lxml/" rel="nofollow">lxml</a>. Also try to use <a href="http://pypi.python.org/pypi/processing" rel="n...
4
2008-12-08T13:01:56Z
[ "python", "xml", "performance", "large-files", "expat-parser" ]
Having problem importing the PIL image library
344,753
<p>i am trying to do something with the PIL Image library in django, but i experience some problems.</p> <p>I do like this:</p> <p><code> import Image </code></p> <p>And then I do like this</p> <p><code> images = map(Image.open, glob.glob(os.path.join(dirpath, '*.thumb.jpg'))) </code></p> <p>But when i try to run ...
0
2008-12-05T18:34:25Z
344,791
<p>Your example works fine in my machine. I don't know why you're getting that error. PIL documentation say you have to import the library in this way:</p> <pre><code>from PIL import Image </code></pre> <p>You should try that way. As I said, for me works in both ways.</p>
0
2008-12-05T18:51:53Z
[ "python", "django", "image", "python-imaging-library" ]
Having problem importing the PIL image library
344,753
<p>i am trying to do something with the PIL Image library in django, but i experience some problems.</p> <p>I do like this:</p> <p><code> import Image </code></p> <p>And then I do like this</p> <p><code> images = map(Image.open, glob.glob(os.path.join(dirpath, '*.thumb.jpg'))) </code></p> <p>But when i try to run ...
0
2008-12-05T18:34:25Z
344,805
<p>The error above happens because your file is called Image.py and you're trying to import yourself. As Manual pointed out, you should import Image from the PIL module, but you'd also need to rename your file so it's <em>not</em> called Image.py.</p>
1
2008-12-05T19:00:03Z
[ "python", "django", "image", "python-imaging-library" ]
Looking for input in model design for Django Schools
344,826
<p>Today I'm starting a little project to create a Django based school administration program. I'm currently designing the models and their corresponding relationships. Being rather new to Django and relational databases in general, I would like some input.</p> <p>Before I show you the current model layout, you need t...
2
2008-12-05T19:13:41Z
344,919
<p>From a quick look I think that its fairly comprehensive. Perhaps you should allow multiple teachers on a course, and allow reuse of addresses/locations between parents and students.</p> <p>As a general rule I would say that you should start implementing and then you will find where you need improvement.</p>
1
2008-12-05T19:51:46Z
[ "python", "django", "django-models" ]
Looking for input in model design for Django Schools
344,826
<p>Today I'm starting a little project to create a Django based school administration program. I'm currently designing the models and their corresponding relationships. Being rather new to Django and relational databases in general, I would like some input.</p> <p>Before I show you the current model layout, you need t...
2
2008-12-05T19:13:41Z
344,992
<p>Looks like an interesting project. Do note that Django has higher-level types than SQL, so you can make use of things like the email address type.</p> <p>If you're planning on targeting <a href="http://code.google.com/appengine/" rel="nofollow">GAE</a>, you should find a similarly rich <a href="http://code.google....
0
2008-12-05T20:16:53Z
[ "python", "django", "django-models" ]
Looking for input in model design for Django Schools
344,826
<p>Today I'm starting a little project to create a Django based school administration program. I'm currently designing the models and their corresponding relationships. Being rather new to Django and relational databases in general, I would like some input.</p> <p>Before I show you the current model layout, you need t...
2
2008-12-05T19:13:41Z
344,996
<p>hey...i agree...it looks pretty good. someone advised me to use auto-increment on all tables just to be sure there really is a unique id on every record. it's your choice if you'd like to go that route.</p>
0
2008-12-05T20:19:08Z
[ "python", "django", "django-models" ]
Looking for input in model design for Django Schools
344,826
<p>Today I'm starting a little project to create a Django based school administration program. I'm currently designing the models and their corresponding relationships. Being rather new to Django and relational databases in general, I would like some input.</p> <p>Before I show you the current model layout, you need t...
2
2008-12-05T19:13:41Z
345,053
<p>You should link paiement (transaction) to the person concerned.</p>
0
2008-12-05T20:40:28Z
[ "python", "django", "django-models" ]
Looking for input in model design for Django Schools
344,826
<p>Today I'm starting a little project to create a Django based school administration program. I'm currently designing the models and their corresponding relationships. Being rather new to Django and relational databases in general, I would like some input.</p> <p>Before I show you the current model layout, you need t...
2
2008-12-05T19:13:41Z
345,257
<p>Some possible issues:</p> <p>For the location object, what if in the future you need to hold a home address, work address, etc. for a person? Same for email addresses and phone numbers - I would have phone numbers be their own object.</p> <p>Include an Address_3 on your address object.</p>
1
2008-12-05T21:41:53Z
[ "python", "django", "django-models" ]
Looking for input in model design for Django Schools
344,826
<p>Today I'm starting a little project to create a Django based school administration program. I'm currently designing the models and their corresponding relationships. Being rather new to Django and relational databases in general, I would like some input.</p> <p>Before I show you the current model layout, you need t...
2
2008-12-05T19:13:41Z
345,403
<p>I would advise you to not worry about the underling relational database. Yes, you'll need to understand what a foreign key is and the difference between many-to-many and one-to-many, etc., but you should think about your models in terms of Django classes. That's how you'll have to write them anyway, so that's where ...
0
2008-12-05T22:33:48Z
[ "python", "django", "django-models" ]
Looking for input in model design for Django Schools
344,826
<p>Today I'm starting a little project to create a Django based school administration program. I'm currently designing the models and their corresponding relationships. Being rather new to Django and relational databases in general, I would like some input.</p> <p>Before I show you the current model layout, you need t...
2
2008-12-05T19:13:41Z
2,135,038
<p>A student doesn't have a class. He/She attends a class that has them (in the roster). Here's another way to look at the class situation. (notice the model's name. that's just because I tend not to name anything 'Class' because it's easy to get into name clashes that way.)</p> <pre><code>class SchoolClass(models.Mod...
0
2010-01-25T19:36:01Z
[ "python", "django", "django-models" ]
Django Admin's "view on site" points to example.com instead of my domain
344,851
<p>I added a <code>get_absolute_url</code> function to one of my models.</p> <pre><code>def get_absolute_url(self): return '/foo/bar' </code></pre> <p>The admin site picks it up and adds a "view on site" link to the detail page for that object (when I put a real URL there instead of "/foo/bar").</p> <p>The probl...
22
2008-12-05T19:23:11Z
344,909
<p>You have to change <a href="http://docs.djangoproject.com/en/dev/ref/contrib/sites/#ref-contrib-sites">default site</a> domain value.</p>
21
2008-12-05T19:46:26Z
[ "python", "django", "django-admin" ]
Django Admin's "view on site" points to example.com instead of my domain
344,851
<p>I added a <code>get_absolute_url</code> function to one of my models.</p> <pre><code>def get_absolute_url(self): return '/foo/bar' </code></pre> <p>The admin site picks it up and adds a "view on site" link to the detail page for that object (when I put a real URL there instead of "/foo/bar").</p> <p>The probl...
22
2008-12-05T19:23:11Z
374,111
<p>You can change this in /admin/sites if you have admin enabled.</p>
2
2008-12-17T09:51:40Z
[ "python", "django", "django-admin" ]
Django Admin's "view on site" points to example.com instead of my domain
344,851
<p>I added a <code>get_absolute_url</code> function to one of my models.</p> <pre><code>def get_absolute_url(self): return '/foo/bar' </code></pre> <p>The admin site picks it up and adds a "view on site" link to the detail page for that object (when I put a real URL there instead of "/foo/bar").</p> <p>The probl...
22
2008-12-05T19:23:11Z
2,349,374
<p>The funniest thing is that "example.com" appears in an obvious place. Yet, I was looking for in in an hour or so. </p> <p>Just use your admin interface -> Sites -> ... there it is :)</p>
4
2010-02-27T23:30:00Z
[ "python", "django", "django-admin" ]
Django Admin's "view on site" points to example.com instead of my domain
344,851
<p>I added a <code>get_absolute_url</code> function to one of my models.</p> <pre><code>def get_absolute_url(self): return '/foo/bar' </code></pre> <p>The admin site picks it up and adds a "view on site" link to the detail page for that object (when I put a real URL there instead of "/foo/bar").</p> <p>The probl...
22
2008-12-05T19:23:11Z
11,420,803
<p>When you have edited a Site instance thought the admin, you need to restart your web server for the change to take effect. I guess this must mean that the database is only read when the web server first starts.</p>
1
2012-07-10T19:48:26Z
[ "python", "django", "django-admin" ]
Django Admin's "view on site" points to example.com instead of my domain
344,851
<p>I added a <code>get_absolute_url</code> function to one of my models.</p> <pre><code>def get_absolute_url(self): return '/foo/bar' </code></pre> <p>The admin site picks it up and adds a "view on site" link to the detail page for that object (when I put a real URL there instead of "/foo/bar").</p> <p>The probl...
22
2008-12-05T19:23:11Z
11,420,955
<p>As others have mentioned, this is to do with the <a href="https://docs.djangoproject.com/en/1.4/ref/contrib/sites/#how-django-uses-the-sites-framework" rel="nofollow">default <code>sites</code> framework</a>.</p> <p>If you're using <a href="http://south.aeracode.org" rel="nofollow">South</a> for database migrations...
2
2012-07-10T19:58:13Z
[ "python", "django", "django-admin" ]