Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
931,995 | 2009-05-31T12:48:00.000 | 2 | 0 | 1 | 0 | python,math,floating-point | 932,021 | 9 | false | 0 | 0 | This is normal. I would expect log10 to be more accurate then log(x, y), since it knows exactly what the base of the logarithm is, also there may be some hardware support for calculating base-10 logarithms. | 2 | 15 | 0 | I work daily with Python 2.4 at my company. I used the versatile logarithm function 'log' from the standard math library, and when I entered log(2**31, 2) it returned 31.000000000000004, which struck me as a bit odd.
I did the same thing with other powers of 2, and it worked perfectly. I ran 'log10(2**31) / log10(2)' a... | Inaccurate Logarithm in Python | 0.044415 | 0 | 0 | 10,703 |
932,328 | 2009-05-31T16:01:00.000 | 42 | 0 | 1 | 0 | python,operators | 932,347 | 6 | true | 0 | 0 | No, you can't create new operators. However, if you are just evaluating expressions, you could process the string yourself and calculate the results of the new operators. | 2 | 90 | 0 | I would like to define my own operator. Does python support such a thing? | Python: defining my own operators? | 1.2 | 0 | 0 | 62,864 |
932,328 | 2009-05-31T16:01:00.000 | 10 | 0 | 1 | 0 | python,operators | 932,385 | 6 | false | 0 | 0 | If you intend to apply the operation on a particular class of objects, you could just override the operator that matches your function the closest... for instance, overriding __eq__() will override the == operator to return whatever you want. This works for almost all the operators. | 2 | 90 | 0 | I would like to define my own operator. Does python support such a thing? | Python: defining my own operators? | 1 | 0 | 0 | 62,864 |
932,818 | 2009-05-31T20:44:00.000 | 11 | 0 | 1 | 0 | python | 932,829 | 9 | false | 0 | 0 | Variable names persist in the compiled code (that's how e.g. the dir built-in can work), but the mapping that's there goes from name to value, not vice versa. So if there are several variables all worth, for example, 23, there's no way to tell them from each other base only on the value 23 . | 1 | 32 | 0 | Is there a way to know, during run-time, a variable's name (from the code)?
Or do variable's names forgotten during compilation (byte-code or not)?
e.g.:
>>> vari = 15
>>> print vari.~~name~~()
'vari'
Note: I'm talking about plain data-type variables (int, str, list etc.) | How to retrieve a variable's name in python at runtime? | 1 | 0 | 0 | 24,966 |
933,214 | 2009-06-01T00:43:00.000 | 5 | 0 | 1 | 0 | python-3.x,frontend | 933,225 | 5 | false | 0 | 0 | I'm not using Python 3 "in production", yet, but in playing around with it I've found that print being a function is a superb idea -- for example, I can easily put it in a lambda now, where in 2.* I have to use sys.stdout.write("%s\n" % foo), a bit crufty. Plus, the syntax for such tweaks as using an output file differ... | 3 | 3 | 0 | I've recently did some web design as a hobby with a primary motivation to learn interesting things. It was certainly nice to learn Python, but I found out there has just been a Great Python Rewrite too late, so I had to learn both Python 3 and 2.6 essentially.
I'm a newbie, so I'd like people to share what they think ... | What are the used/unused features of Python 3? | 0.197375 | 0 | 0 | 538 |
933,214 | 2009-06-01T00:43:00.000 | 2 | 0 | 1 | 0 | python-3.x,frontend | 933,221 | 5 | false | 0 | 0 | I think everything they did was for the best, in the long run. They removed a lot of the deprecated ways to do things, thus enforcing "There's Only One Way to Do It" and increasing consistency. Also, the with statement is awesome.
The obvious problem with using Python 3 is its lack of support for a lot of [big] librari... | 3 | 3 | 0 | I've recently did some web design as a hobby with a primary motivation to learn interesting things. It was certainly nice to learn Python, but I found out there has just been a Great Python Rewrite too late, so I had to learn both Python 3 and 2.6 essentially.
I'm a newbie, so I'd like people to share what they think ... | What are the used/unused features of Python 3? | 0.07983 | 0 | 0 | 538 |
933,214 | 2009-06-01T00:43:00.000 | 1 | 0 | 1 | 0 | python-3.x,frontend | 933,229 | 5 | false | 0 | 0 | This is really subjective. Python3.x is certainly an improvement over 2.x. It contains long anticipated changes like: Dictionary comprehensions, ordered dictionary, more powerful string formatting...etc Not to mention cleaner library. | 3 | 3 | 0 | I've recently did some web design as a hobby with a primary motivation to learn interesting things. It was certainly nice to learn Python, but I found out there has just been a Great Python Rewrite too late, so I had to learn both Python 3 and 2.6 essentially.
I'm a newbie, so I'd like people to share what they think ... | What are the used/unused features of Python 3? | 0.039979 | 0 | 0 | 538 |
933,822 | 2009-06-01T07:14:00.000 | 0 | 1 | 0 | 0 | c#,python,ruby,ironpython,ironruby | 933,988 | 3 | false | 1 | 0 | IronPython 2.0 has a sample compiler called PYC on Codeplex.com/ironpython which can create DLL's (and applications if you need them too).
IronPython 2.6 has a newer version of PYC under Tools\script.
Cheers,
Davy | 2 | 3 | 0 | Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find ... | Packaging script source files in IronPython and IronRuby | 0 | 0 | 0 | 520 |
933,822 | 2009-06-01T07:14:00.000 | 1 | 1 | 0 | 0 | c#,python,ruby,ironpython,ironruby | 934,609 | 3 | false | 1 | 0 | You could add custom import hook that looks for embedded resources when an import is executed. This is slightly complex and probably not worth the trouble.
A better technique would be to fetch all of the embedded modules at startup time, execute them with the ScriptEngine and put the modules you have created into the s... | 2 | 3 | 0 | Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find ... | Packaging script source files in IronPython and IronRuby | 0.066568 | 0 | 0 | 520 |
934,221 | 2009-06-01T10:08:00.000 | 2 | 0 | 0 | 0 | python | 934,709 | 1 | false | 0 | 0 | Why to pass connection itself? Maybe build a class that handles all the DB-operation and just pass this class' instance around, calling it's methods to perform selects, inserts and all that DB-specific code? | 1 | 0 | 0 | I am having a script which makes a db connection and pereform some select operation.accroding to the fetch data i am calling different functions which also perform db operations.How can i pass db connection to the functions which are being called as i donot want to make new connection | python db connection | 0.379949 | 1 | 0 | 515 |
935,378 | 2009-06-01T15:42:00.000 | 1 | 0 | 1 | 0 | python,methods | 935,413 | 7 | false | 0 | 0 | These methods were named as such to reduce the possibility of naming collisions. | 4 | 38 | 0 | What is the difference between __method__, method and _method__?
Is there any or for some random reason people thought that __doc__ should be right like that instead of doc. What makes a method more special than the other? | Difference between "__method__" and "method" | 0.028564 | 0 | 0 | 9,690 |
935,378 | 2009-06-01T15:42:00.000 | 0 | 0 | 1 | 0 | python,methods | 935,431 | 7 | false | 0 | 0 | Some methods with a double underscore prefix and suffix are special. For example, __init__ is called whenever an instance of that class is created, and __str__ is called when the object is to be printed. Basically, they can be called in special ways. You can use them like any other method, or you can invoke them throug... | 4 | 38 | 0 | What is the difference between __method__, method and _method__?
Is there any or for some random reason people thought that __doc__ should be right like that instead of doc. What makes a method more special than the other? | Difference between "__method__" and "method" | 0 | 0 | 0 | 9,690 |
935,378 | 2009-06-01T15:42:00.000 | 23 | 0 | 1 | 0 | python,methods | 936,012 | 7 | false | 0 | 0 | method is just a normal method
_method should not be called unless you know what you are doing, which normally means that you have written the method yourself.
__method the 2 underscores are used to prevent name mangeling. Attributes or methods like this are accessible over instance._ClassName__method. Although a lot o... | 4 | 38 | 0 | What is the difference between __method__, method and _method__?
Is there any or for some random reason people thought that __doc__ should be right like that instead of doc. What makes a method more special than the other? | Difference between "__method__" and "method" | 1 | 0 | 0 | 9,690 |
935,378 | 2009-06-01T15:42:00.000 | 0 | 0 | 1 | 0 | python,methods | 935,399 | 7 | false | 0 | 0 | Methods prefaced and prefixed with the double underscore are generally so marked to indicate that they are part of the Python language specification. | 4 | 38 | 0 | What is the difference between __method__, method and _method__?
Is there any or for some random reason people thought that __doc__ should be right like that instead of doc. What makes a method more special than the other? | Difference between "__method__" and "method" | 0 | 0 | 0 | 9,690 |
936,381 | 2009-06-01T19:36:00.000 | 1 | 0 | 0 | 0 | python,xml,oracle,xmltype | 946,854 | 3 | true | 0 | 0 | I managed to do this with cx_Oracle.
I used the sys.xmltype.createxml() function in the statement that inserts the rows in a table with XMLTYPE fields; then I used prepare() and setinputsizes() to specify that the bind variables I used for XMLTYPE fields were of cx_Oracle.CLOB type. | 1 | 5 | 0 | It seems cx_Oracle doesn't.
Any other suggestion for handling xml with Oracle and Python is appreciated.
Thanks. | Is there an Oracle wrapper for Python that supports xmltype columns? | 1.2 | 1 | 0 | 1,256 |
936,783 | 2009-06-01T21:06:00.000 | 1 | 1 | 0 | 1 | python,ssh | 936,816 | 2 | false | 0 | 0 | Well, the main reason probably was that when people started getting interested in such things in VHLLs such as Python, it didn't make sense to them to implement a standard which they themselves would not find useful.
I am not familiar with the protocol differences, but would it be possible for you to adapt an existing ... | 2 | 4 | 0 | There seem to be a few good pure Python SSH2 client implementations out there, but I haven't been able to find one for SSH1. Is there some specific reason for this other than lack of interest in such a project? I am fully aware of the many SSH1 vulnerabilities, but a pure Python SSH1 client implementation would still b... | Why no pure Python SSH1 (version 1) client implementations? | 0.099668 | 0 | 0 | 1,865 |
936,783 | 2009-06-01T21:06:00.000 | 3 | 1 | 0 | 1 | python,ssh | 940,483 | 2 | true | 0 | 0 | SSHv1 was considered deprecated in 2001, so I assume nobody really wanted to put the effort into it. I'm not sure if there's even an rfc for SSH1, so getting the full protocol spec may require reading through old source code.
Since there are known vulnerabilities, it's not much better than telnet, which is almost unive... | 2 | 4 | 0 | There seem to be a few good pure Python SSH2 client implementations out there, but I haven't been able to find one for SSH1. Is there some specific reason for this other than lack of interest in such a project? I am fully aware of the many SSH1 vulnerabilities, but a pure Python SSH1 client implementation would still b... | Why no pure Python SSH1 (version 1) client implementations? | 1.2 | 0 | 0 | 1,865 |
939,746 | 2009-06-02T14:02:00.000 | 0 | 0 | 0 | 0 | python | 947,222 | 2 | false | 0 | 0 | To the best of my knowledge, python does not contain the ability to simulate keystrokes. You can however use python to call a program which has the functionality that you need for OS X. You could also write said program using Objective C most likely.
Or you could save yourself the pain and use Automator. Perhaps if ... | 1 | 1 | 0 | I am trying to automate a app using python. I need help to send keyboard commands through python. I am using powerBook G4. | How i can send the commands from keyboards using python. I am trying to automate mac app (GUI) | 0 | 0 | 1 | 665 |
939,754 | 2009-06-02T14:03:00.000 | 19 | 0 | 1 | 0 | python,multithreading | 939,827 | 6 | false | 0 | 0 | You have to consider multiple things if you want to use multiple threads:
You can only run #processors threads simultaneously. (Obvious)
In Python each thread is a 'kernel thread' which normally takes a non-trivial amount of resources (8 mb stack by default on linux)
Python has a global interpreter lock, which means o... | 3 | 6 | 0 | I'm new to threading and was wondering if it's bad to spawn a lot of threads for various tasks (in a server environment). Do threads take up a lot more memory/cpu compared to more linear programming? | Threading In Python | 1 | 0 | 0 | 3,257 |
939,754 | 2009-06-02T14:03:00.000 | 4 | 0 | 1 | 0 | python,multithreading | 939,815 | 6 | false | 0 | 0 | It depends on the platform.
Windows threads have to commit around 1MB of memory when created. It's better to have some kind of threadpool than spawning threads like a madman, to make sure you never allocate more than a fixed amount of threads. Also, when you work in Python, you're subject to the Global Interpreter Loc... | 3 | 6 | 0 | I'm new to threading and was wondering if it's bad to spawn a lot of threads for various tasks (in a server environment). Do threads take up a lot more memory/cpu compared to more linear programming? | Threading In Python | 0.132549 | 0 | 0 | 3,257 |
939,754 | 2009-06-02T14:03:00.000 | 5 | 0 | 1 | 0 | python,multithreading | 941,253 | 6 | false | 0 | 0 | Since you're new to threading, there's something else worth bearing in mind - which I prefer to view as parallel scoping of values.
With traditional linear/sequential programming for any given object you only have one thread accessing and changing a piece of data. This is generally made safe due to having lexical scope... | 3 | 6 | 0 | I'm new to threading and was wondering if it's bad to spawn a lot of threads for various tasks (in a server environment). Do threads take up a lot more memory/cpu compared to more linear programming? | Threading In Python | 0.16514 | 0 | 0 | 3,257 |
940,149 | 2009-06-02T15:15:00.000 | 0 | 0 | 0 | 0 | python,ruby,user-interface,desktop,software-distribution | 976,069 | 7 | false | 0 | 1 | I don't think anyone really answered his question.
As for me, I use VB to do Shell() calls to Ocra compiled Ruby scripts.
It works pretty well and allows me to create apps that run in all modern OS.
Linux testing is done by using Wine to run and ensuring that I use a pre .NET version of VB for the .exe compilation. | 3 | 10 | 0 | Is there any way besides Shoes to develop and distribute cross-platform GUI desktop applications written in Ruby?
I come to believe that general bugginess of _why's applications is exceptionally crippling in case of Shoes, and anything more complex than a two-button form is a pain to maintain.
RubyGTK, wxRuby, etc seem... | Distributing Ruby/Python desktop apps | 0 | 0 | 0 | 3,071 |
940,149 | 2009-06-02T15:15:00.000 | 2 | 0 | 0 | 0 | python,ruby,user-interface,desktop,software-distribution | 940,214 | 7 | false | 0 | 1 | The state of affairs is pretty bad. The most reliable method at present is probably to use JRuby. I know that's probably not the answer you want to hear, but, as you say, ruby2exe is unreliable, and Shoes is a long way off (and isn't even intended to be a full-scale application). Personally, I dislike forcing users ... | 3 | 10 | 0 | Is there any way besides Shoes to develop and distribute cross-platform GUI desktop applications written in Ruby?
I come to believe that general bugginess of _why's applications is exceptionally crippling in case of Shoes, and anything more complex than a two-button form is a pain to maintain.
RubyGTK, wxRuby, etc seem... | Distributing Ruby/Python desktop apps | 0.057081 | 0 | 0 | 3,071 |
940,149 | 2009-06-02T15:15:00.000 | -2 | 0 | 0 | 0 | python,ruby,user-interface,desktop,software-distribution | 942,712 | 7 | false | 0 | 1 | I've read about (but not used) Seattlerb's Wilson, which describes itself as a pure x86 assembler, but it doesn't sound like it'd be cross-platform or GUI. | 3 | 10 | 0 | Is there any way besides Shoes to develop and distribute cross-platform GUI desktop applications written in Ruby?
I come to believe that general bugginess of _why's applications is exceptionally crippling in case of Shoes, and anything more complex than a two-button form is a pain to maintain.
RubyGTK, wxRuby, etc seem... | Distributing Ruby/Python desktop apps | -0.057081 | 0 | 0 | 3,071 |
940,564 | 2009-06-02T16:39:00.000 | 0 | 0 | 0 | 0 | java,python,spring | 10,500,205 | 3 | false | 1 | 0 | Good stuff. I have used Spring Java, Spring Dot Net and now starting with Spring Python. Python has always been pretty easy to use for programmers; I think, especially since it's easy to write. I found Spring Dot Net to be a bit confusing, but both Spring Java and Python seem to be similar. I'm sure they have their... | 1 | 18 | 0 | I am an avid fan of the Spring framework for Java (by Rod Johnson).
I am learning Python and was excited to find about Spring for Python.
I would be interested in hearing the community's views on the comparison of
these two flavours of Spring. How well does it fit Python's paradigms etc. | How does Spring for Python compare with Spring for Java | 0 | 0 | 0 | 16,197 |
941,638 | 2009-06-02T20:11:00.000 | 0 | 0 | 0 | 0 | javascript,python,html,web-applications | 943,612 | 4 | false | 1 | 0 | set "Indexes" option to the directory in the apache config.
To learn how to build webapps in python, learn django. | 2 | 2 | 0 | Goal: simple browser app, for navigating files on a web server, in a tree view.
Background: Building a web site as a learning experience, w/ Apache, mod_python, Python code. (No mod_wsgi yet.)
What tools should I learn to write the browser tree? I see JavaScript, Ajax, neither of which I know. Learn them? Grab a ... | How to construct a web file browser? | 0 | 0 | 1 | 552 |
941,638 | 2009-06-02T20:11:00.000 | 1 | 0 | 0 | 0 | javascript,python,html,web-applications | 941,664 | 4 | false | 1 | 0 | If you want to make interactive browser, you have to learn JS and ajax.
If you want to build only browser based on links, python would be enough. | 2 | 2 | 0 | Goal: simple browser app, for navigating files on a web server, in a tree view.
Background: Building a web site as a learning experience, w/ Apache, mod_python, Python code. (No mod_wsgi yet.)
What tools should I learn to write the browser tree? I see JavaScript, Ajax, neither of which I know. Learn them? Grab a ... | How to construct a web file browser? | 0.049958 | 0 | 1 | 552 |
942,730 | 2009-06-03T01:46:00.000 | 1 | 0 | 0 | 0 | python,user-interface,mouse,cursor,pythoncard | 942,839 | 1 | true | 0 | 0 | PythonCard builds on top of wx, so if you import wx you should be able to build a suitable cursor (e.g. with wx.CursorFromImage), set it (e.g. with wx.BeginBusyCursor) when your wait begins, and end it (with wx.EndBusyCursor) when your wait ends. | 1 | 0 | 0 | How do I change the mouse cursor to indicate a waiting state using Python and PythonCard?
I didn't see anything in the documentation. | How to Change Mouse Cursor in PythonCard | 1.2 | 0 | 0 | 591 |
944,700 | 2009-06-03T13:19:00.000 | 241 | 0 | 1 | 0 | python,math | 944,756 | 18 | false | 0 | 0 | numpy.isnan(number) tells you if it's NaN or not. | 1 | 1,412 | 0 | float('nan') represents NaN (not a number). But how do I check for it? | How can I check for NaN values? | 1 | 0 | 0 | 2,218,724 |
945,001 | 2009-06-03T14:12:00.000 | 0 | 0 | 0 | 0 | python,django,rss | 1,095,528 | 3 | true | 1 | 0 | I've been banging my head against this one for a while. It seems that the django rss system need a "datetime" object instead of just the date (since it wants a time zone, and the date object doesn't have a time, let alone a time zone...)
I might be wrong though, but it's something that I've found via the error logs. | 1 | 0 | 0 | I'm publishing a feed from a Django application.
I subclassed django.contrib.syndication.feeds.Feed, everything works fine, except the date that doesn't get published on the feed.
Here's the method I've created on my Feed class
def item_pubdate(self, item):
return item.date
this method never gets called.... | Publish feeds using Django | 1.2 | 0 | 0 | 619 |
947,436 | 2009-06-03T21:43:00.000 | 6 | 0 | 0 | 0 | python,django | 947,486 | 1 | false | 1 | 0 | Simple: Don't use global objects.
If you want an object inside the view, instantiate it inside the view, not as global. That way it will be collected after the view ends. | 1 | 0 | 0 | Here is my problem. DJango continues to store all the global objects after the first run of a script. For instance, an object you instantiate in views.py globally will be there until you restart the app server. This is fine unless your object is tied to some outside resource that may time out. Now the way I was thi... | How to I reload global vars on every page refresh in DJango | 1 | 0 | 0 | 371 |
947,810 | 2009-06-03T23:21:00.000 | 0 | 0 | 1 | 0 | python,shell,read-eval-print-loop,interactive-session | 38,593,747 | 20 | false | 0 | 0 | Some comments were asking how to save all of the IPython inputs at once. For %save magic in IPython, you can save all of the commands programmatically as shown below, to avoid the prompt message and also to avoid specifying the input numbers.
currentLine = len(In)-1
%save -f my_session 1-$currentLine
The -f op... | 3 | 451 | 0 | I find myself frequently using Python's interpreter to work with databases, files, etc -- basically a lot of manual formatting of semi-structured data. I don't properly save and clean up the useful bits as often as I would like. Is there a way to save my input into the shell (db connections, variable assignments, lit... | How to save a Python interactive session? | 0 | 0 | 0 | 215,023 |
947,810 | 2009-06-03T23:21:00.000 | 0 | 0 | 1 | 0 | python,shell,read-eval-print-loop,interactive-session | 44,425,033 | 20 | false | 0 | 0 | I'd like to suggest another way to maintain python session through tmux on linux. you run tmux, attach your self to the session you opened (if not attached after opening it directly). execute python and do whatever you are doing on it. then detach from session. detaching from a tmux session does not close the session. ... | 3 | 451 | 0 | I find myself frequently using Python's interpreter to work with databases, files, etc -- basically a lot of manual formatting of semi-structured data. I don't properly save and clean up the useful bits as often as I would like. Is there a way to save my input into the shell (db connections, variable assignments, lit... | How to save a Python interactive session? | 0 | 0 | 0 | 215,023 |
947,810 | 2009-06-03T23:21:00.000 | 0 | 0 | 1 | 0 | python,shell,read-eval-print-loop,interactive-session | 54,548,764 | 20 | false | 0 | 0 | To save input and output on XUbuntu:
In XWindows, run iPython from the Xfce terminal app
click Terminal in the top menu bar and look for save contents in the dropdown
I find this saves the input and output, going all the way back to when I opened the terminal. This is not ipython specific, and would work with ssh s... | 3 | 451 | 0 | I find myself frequently using Python's interpreter to work with databases, files, etc -- basically a lot of manual formatting of semi-structured data. I don't properly save and clean up the useful bits as often as I would like. Is there a way to save my input into the shell (db connections, variable assignments, lit... | How to save a Python interactive session? | 0 | 0 | 0 | 215,023 |
948,212 | 2009-06-04T01:40:00.000 | 3 | 0 | 0 | 0 | python,sql,sqlalchemy | 951,640 | 4 | true | 0 | 0 | Well, thanks to Hao Lian above, I came up with a functional if painful solution.
Assume that we have a declarative-style mapped class, Clazz, and a list of tuples of compound primary key values, values
(Edited to use a better (IMO) sql generation style):
from sqlalchemy.sql.expression import text,bindparam
...
def... | 1 | 10 | 0 | I'm trying to find a way to cause SQLAlchemy to generate a query of the following form:
select * from t where (a,b) in ((a1,b1),(a2,b2));
Is this possible?
If not, any suggestions on a way to emulate it? | Sqlalchemy complex in_ clause with tuple in list of tuples | 1.2 | 1 | 0 | 6,490 |
948,493 | 2009-06-04T03:42:00.000 | 0 | 0 | 0 | 0 | python,django,validation | 948,500 | 3 | false | 1 | 0 | Well, you can always use a GUID. As you said it would be stored as a valid key. | 1 | 2 | 0 | I'm using django for a web-magazine with subscriber-content. when a user purchases a subscription, the site will create a validation key, and send it to the user email address.
The validation key would be added to a list of "valid keys" until it is used.
What is the best method for creating a simple yet unique key? C... | method for creating a unique validation key/number | 0 | 0 | 0 | 1,123 |
949,784 | 2009-06-04T10:42:00.000 | 3 | 0 | 1 | 0 | python,read-eval-print-loop | 949,847 | 3 | false | 0 | 0 | You either need to go non-blocking or use a thread.
I would personally use Twisted for concurrency, which also offers a REPL-protocol which is easy to integrate. | 1 | 5 | 0 | I am currently developing a simple application in python that connects to a server. At the moment, it's single-threaded (as multithreading is not currently required).
However I would like - for debugging, maintenance and such to also be able to have a REPL via stdin.
How do I go about that, if possible? Will I need to ... | Python REPL for a running process | 0.197375 | 0 | 0 | 1,975 |
950,145 | 2009-06-04T12:13:00.000 | 2 | 0 | 0 | 0 | python,3d,wxpython,embedding,blender | 950,196 | 5 | false | 0 | 1 | Blender has python plugins, you can write a plugin to interract with your program. | 1 | 1 | 0 | Is it possible to embed a 3-D editor inside my wxPython application? (I'm thinking Blender, but other suggestions are welcome.)
My application opens a wxPython window, and I want to have a 3-D editor inside of it. Of course, I want my program and the 3-D editor to interact with each other.
Possible? How? | Embedding a 3-D editor (such as Blender) in a wxPython application | 0.07983 | 0 | 0 | 1,823 |
950,790 | 2009-06-04T14:03:00.000 | 4 | 0 | 0 | 0 | python,django | 950,874 | 2 | false | 1 | 0 | Yes, you can use the same database.
Some people use Django on top of a PHP application for its admin functionality, or to build newer features with Django and its ORM.
What I'm trying to say is that if you're putting data from your crawl into the same place that you will let Django store its data, you can access them a... | 1 | 1 | 0 | I'm planning on writing a web crawler and a web-based front end for it (or, at least, the information it finds). I was wondering if it's possible to use the Django framework to let the web crawler use the same MySQL backend as the website (without making the web crawler a "website" in it's self). | Use Django Framework with Website and Stand-alone App | 0.379949 | 0 | 0 | 1,344 |
951,974 | 2009-06-04T17:29:00.000 | 0 | 0 | 0 | 0 | python,ide,komodo | 952,842 | 5 | false | 0 | 1 | try using eclipse instead with PyDev. | 2 | 3 | 0 | Continuing on with my Python learning, I just installed Komodo edit, are there any recommended add ins/extensions that I should include? Any recommendations on using it or another GUI designer (TkInter base)? | Komodo Extension | 0 | 0 | 0 | 1,483 |
951,974 | 2009-06-04T17:29:00.000 | 0 | 0 | 0 | 0 | python,ide,komodo | 7,241,975 | 5 | false | 0 | 1 | I use to install MoreKomodo and TweakUI after putting Komodo on some machine for me. | 2 | 3 | 0 | Continuing on with my Python learning, I just installed Komodo edit, are there any recommended add ins/extensions that I should include? Any recommendations on using it or another GUI designer (TkInter base)? | Komodo Extension | 0 | 0 | 0 | 1,483 |
952,110 | 2009-06-04T17:51:00.000 | 2 | 0 | 1 | 0 | python,recursion,palindrome | 952,171 | 11 | false | 0 | 0 | Here's another viewpoint
A palindromic string is
Some letter, x.
Some palindromic substrinng.
The same letter, x, repeated.
Also, note that you may be given a proper English sentence "Able was I ere I saw Elba." with punctuation. Your palindrome checker may have to quietly skip punctuation. Also, you may have to qu... | 2 | 10 | 0 | I need help writing a recursive function which detects whether a string is a palindrome. But i can't use any loops it must be recursive. Can anyone help show me how this is done . Im using Python. | Recursive Function palindrome in Python | 0.036348 | 0 | 0 | 99,261 |
952,110 | 2009-06-04T17:51:00.000 | 3 | 0 | 1 | 0 | python,recursion,palindrome | 952,129 | 11 | false | 0 | 0 | If a string is zero or one letters long, it's a palindrome.
If a string has the first and last letters the same, and the remaining letters (I think it's a [1: -1] slice in Python, but my Python is a bit rusty) are a palindrome, it's a palindrome.
Now, write that as a palindrome function that takes a string. It will ca... | 2 | 10 | 0 | I need help writing a recursive function which detects whether a string is a palindrome. But i can't use any loops it must be recursive. Can anyone help show me how this is done . Im using Python. | Recursive Function palindrome in Python | 0.054491 | 0 | 0 | 99,261 |
952,648 | 2009-06-04T19:34:00.000 | 1 | 0 | 1 | 0 | python,ruby,debugging,parser-generator | 2,475,183 | 5 | false | 0 | 0 | ANTLR above has the advantage to generate human readable and understandable code,
since it is (a very sophisticated and powerful) top-down parser,
so you can step through it with a regular debugger
and see what it really is doing.
That's why it is my parser generator of choice.
Bottom up parser generators like PLY have... | 1 | 4 | 0 | The first parser generator I've worked with was Parse::RecDescent, and the guides/tutorials available for it were great, but the most useful feature it has was it's debugging tools, specifically the tracing capabilities ( activated by setting $RD_TRACE to 1 ). I am looking for a parser generator that can help you debug... | Help me find an appropriate ruby/python parser generator | 0.039979 | 0 | 0 | 2,569 |
953,701 | 2009-06-05T00:01:00.000 | 9 | 1 | 0 | 0 | python,gps,gpsd | 973,022 | 6 | true | 0 | 0 | Apparently the python module that comes with gpsd is the best module to go with for us.
The gps module coming with the gpsd has some very useful functions. The first one is getting the data from gpsd and transforming those data in a usable data structure.
Then the moduls give you access to your speed, and your current ... | 1 | 8 | 0 | I'm looking for a free library for python that can calculate your direction and your speed from GPS coordinates and maybe can calculate if you are in some boundaries or things like this.
Are there Libraries that you know and that worked well for you?
We are using python on a linux machine and getting the data from the ... | Which gps library would you recommend for python? | 1.2 | 0 | 0 | 32,709 |
955,941 | 2009-06-05T13:47:00.000 | 3 | 0 | 1 | 0 | python | 955,956 | 7 | false | 0 | 0 | os.path.isdir('string')
os.path.isfile('string') | 2 | 152 | 0 | How do you check whether a file is a normal file or a directory using python? | How to identify whether a file is normal file or directory | 0.085505 | 0 | 0 | 25,290 |
955,941 | 2009-06-05T13:47:00.000 | 42 | 0 | 1 | 0 | python | 956,092 | 7 | false | 0 | 0 | As other answers have said, os.path.isdir() and os.path.isfile() are what you want. However, you need to keep in mind that these are not the only two cases. Use os.path.islink() for symlinks for instance. Furthermore, these all return False if the file does not exist, so you'll probably want to check with os.path.ex... | 2 | 152 | 0 | How do you check whether a file is a normal file or a directory using python? | How to identify whether a file is normal file or directory | 1 | 0 | 0 | 25,290 |
956,904 | 2009-06-05T16:39:00.000 | 0 | 0 | 0 | 1 | python,django,amazon-s3,amazon-ec2 | 6,308,720 | 5 | false | 1 | 0 | I'd suggest using a separately-mounted EBS volume. I tried doing the same thing for some movie files. Access to S3 was slow, and S3 has some limitations like not being able to rename files, no real directory structure, etc.
You can set up EBS volumes in a RAID5 configuration and add space as you need it. | 1 | 4 | 0 | I have a webapp (call it myapp.com) that allows users to upload files. The webapp will be deployed on Amazon EC2 instance. I would like to serve these files back out to the webapp consumers via an s3 bucket based domain (i.e. uploads.myapp.com).
When the user uploads the files, I can easily drop them in into a fold... | mounting an s3 bucket in ec2 and using transparently as a mnt point | 0 | 1 | 0 | 8,589 |
958,491 | 2009-06-05T22:51:00.000 | 1 | 0 | 0 | 0 | python,keyboard | 981,709 | 2 | false | 0 | 1 | I think it's going to depend heavily on the environment: curses & the activestate recipe are good for command line, but if you want it to run in a DE, you'll need some hooks to that DE. You might look at Qt or GTK bindings for python, or there's a python-xlib library that might let you tie right into the X system.
So I... | 2 | 5 | 0 | I'm writing a macro generator/ keyboard remapper in python, for xubuntu.
I've figured out how to intercept and record keystrokes, and send keystrokes I want to record, but I haven't figured out how to block keystrokes. I need to disable keyboard input to remap a key. For example, if I wanted to send 'a' when I press th... | Python disable/redirect keyboard input | 0.099668 | 0 | 0 | 5,147 |
958,491 | 2009-06-05T22:51:00.000 | 0 | 0 | 0 | 0 | python,keyboard | 993,251 | 2 | false | 0 | 1 | I've got a keyboard hook that detects X events. I'm looking for a way to globally prevent a single keyboard event from being sent to a window. Something that works by accessing the event queue and removing the keyboard event from it would be ideal. It looks like it should be possible using Python Xlib, but I can't figu... | 2 | 5 | 0 | I'm writing a macro generator/ keyboard remapper in python, for xubuntu.
I've figured out how to intercept and record keystrokes, and send keystrokes I want to record, but I haven't figured out how to block keystrokes. I need to disable keyboard input to remap a key. For example, if I wanted to send 'a' when I press th... | Python disable/redirect keyboard input | 0 | 0 | 0 | 5,147 |
959,479 | 2009-06-06T11:08:00.000 | 3 | 0 | 1 | 0 | python,windows,development-environment | 959,494 | 10 | false | 0 | 0 | Well, if you're thinking of setting up an Ubuntu VM anyway, you might as well make that your development environment. Then you can install Apache and MySQL or Postgres on that VM just via the standard packaging tools (apt-get install), and there's no danger of polluting your Windows environment.
You can either do the a... | 3 | 9 | 0 | I currently work with .NET exclusively and would like to have a go at python. To this end I need to set up a python development environment. I guide to this would be handy. I guess I would be doing web development so will need a web server and probably a database. I also need pointers to popular ORM's, an MVC framework... | I need a beginners guide to setting up windows for python development | 0.059928 | 0 | 0 | 1,647 |
959,479 | 2009-06-06T11:08:00.000 | 1 | 0 | 1 | 0 | python,windows,development-environment | 986,203 | 10 | false | 0 | 0 | NOTE: I included a lot of links to frameworks, projects and what-not, but as a new user I was limited to 1 link per answer. If someone else with enough reputation to edit wants/can edit them into this answer instead of the footnotes, I'd be grateful.
There are some Python IDE's such as Wing IDE[1], I believe some peopl... | 3 | 9 | 0 | I currently work with .NET exclusively and would like to have a go at python. To this end I need to set up a python development environment. I guide to this would be handy. I guess I would be doing web development so will need a web server and probably a database. I also need pointers to popular ORM's, an MVC framework... | I need a beginners guide to setting up windows for python development | 0.019997 | 0 | 0 | 1,647 |
959,479 | 2009-06-06T11:08:00.000 | 0 | 0 | 1 | 0 | python,windows,development-environment | 959,891 | 10 | false | 0 | 0 | Python has build in SQL like database and web server, so you wouldn't need to install any third party apps. Remember Python comes with batteries included. | 3 | 9 | 0 | I currently work with .NET exclusively and would like to have a go at python. To this end I need to set up a python development environment. I guide to this would be handy. I guess I would be doing web development so will need a web server and probably a database. I also need pointers to popular ORM's, an MVC framework... | I need a beginners guide to setting up windows for python development | 0 | 0 | 0 | 1,647 |
960,467 | 2009-06-06T20:33:00.000 | 3 | 0 | 0 | 0 | python,qt,widget,designer | 1,235,766 | 3 | false | 0 | 1 | I have a single main window with a QGraphicsView and lots of QGraphicsItem objects. Each type of the Items have a different context menu.
I find that not being able to create the contextMenu's, or at least the actions that are in them a serious limitation of QtDesigner. It means that I can create about 10% or so of t... | 3 | 1 | 0 | Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this. | how can I add a QMenu and QMenuItems to a window from Qt Designer | 0.197375 | 0 | 0 | 3,989 |
960,467 | 2009-06-06T20:33:00.000 | 3 | 0 | 0 | 0 | python,qt,widget,designer | 960,506 | 3 | true | 0 | 1 | When you edit a QMainWindow you can right click the window and then choose "create menu bar".
Or are you talking about a "context menu" aka "right click menu"? | 3 | 1 | 0 | Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this. | how can I add a QMenu and QMenuItems to a window from Qt Designer | 1.2 | 0 | 0 | 3,989 |
960,467 | 2009-06-06T20:33:00.000 | 0 | 0 | 0 | 0 | python,qt,widget,designer | 960,479 | 3 | false | 0 | 1 | Adding menu editing for every widget in the designer would probably make a very awkward and inconvenient UI. There's really no place you can visualize it on.
If you're editing a QMainWindow you can edit the menu bar and its popups because there's a proper place for them to be displayed in. | 3 | 1 | 0 | Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this. | how can I add a QMenu and QMenuItems to a window from Qt Designer | 0 | 0 | 0 | 3,989 |
961,263 | 2009-06-07T05:27:00.000 | 0 | 0 | 1 | 0 | python,variables,input | 69,707,808 | 19 | false | 0 | 0 | In short, using list comprehension and split()
Python 3:
var1, var2 = [int(num) for num in input("Enter two numbers separated by space: ").split()] | 3 | 42 | 0 | This is somewhat of a simple question and I hate to ask it here, but I can't seem the find the answer anywhere else: is it possible to get multiple values from the user in one line of Python?
For instance, in C I can do something like this: scanf("%d %d", &var1, &var2). However, I can't figure out what the Python equi... | Two values from one input in python? | 0 | 0 | 0 | 192,265 |
961,263 | 2009-06-07T05:27:00.000 | 1 | 0 | 1 | 0 | python,variables,input | 45,059,561 | 19 | false | 0 | 0 | This is a sample code to take two inputs seperated by split command and delimiter as ","
>>> var1, var2 = input("enter two numbers:").split(',')
>>>enter two numbers:2,3
>>> var1
'2'
>>> var2
'3'
Other variations of delimiters that can be used are as below :
var1, var2 = input("enter two numbers:").split(',')
var1, v... | 3 | 42 | 0 | This is somewhat of a simple question and I hate to ask it here, but I can't seem the find the answer anywhere else: is it possible to get multiple values from the user in one line of Python?
For instance, in C I can do something like this: scanf("%d %d", &var1, &var2). However, I can't figure out what the Python equi... | Two values from one input in python? | 0.010526 | 0 | 0 | 192,265 |
961,263 | 2009-06-07T05:27:00.000 | 3 | 0 | 1 | 0 | python,variables,input | 46,063,803 | 19 | false | 0 | 0 | The solution I found is the following:
Ask the user to enter two numbers separated by a comma or other character
value = input("Enter 2 numbers (separated by a comma): ")
Then, the string is split: n takes the first value and m the second one
n,m = value.split(',')
Finally, to use them as integers, it is necessary to ... | 3 | 42 | 0 | This is somewhat of a simple question and I hate to ask it here, but I can't seem the find the answer anywhere else: is it possible to get multiple values from the user in one line of Python?
For instance, in C I can do something like this: scanf("%d %d", &var1, &var2). However, I can't figure out what the Python equi... | Two values from one input in python? | 0.031568 | 0 | 0 | 192,265 |
961,465 | 2009-06-07T08:08:00.000 | 6 | 0 | 0 | 0 | python,error-handling,sockets | 961,484 | 1 | true | 0 | 0 | It appears Python is exposing the error code from the OS - the interpretation of the code is OS-dependent.
111 is ECONNREFUSED on many Linux systems, and on Cygwin.
146 is ECONNREFUSED on Solaris.
10061 is WSAECONNREFUSED in winerror.h - it's the Windows Socket API's version of ECONNREFUSED.
No doubt on other systems, ... | 1 | 2 | 0 | I use python 2.4.1 on Linux, and a python package written inside the company I work in, for establishing a connection between 2 hosts for test purposes.
Upon establishing the connection the side defined as the client side failed when calling socket.connect with the correct parameters (I checked) with the error code 111... | Identical Error Codes | 1.2 | 0 | 1 | 867 |
961,735 | 2009-06-07T11:19:00.000 | 0 | 0 | 0 | 0 | python,gtk,pygtk | 962,054 | 2 | false | 0 | 1 | I don't know if this applies to gtk.EntryCompletion widgets, but for cell like widgets you can control their height with the cell.set_fixed_height_from_font(True) method.
Look at the gtk.CellRendererText API for details. | 2 | 2 | 0 | I use gtk.EntryCompletion to implement the autocomletion function.
But the list is so long that the pop-up window touches the bottom of screen.
And I cant find the method of set the height of pop-up window in doc of pygtk.
How to set the height of pop-up window in gtk.EntryCompletion? | pygtk: How to set the height of pop-up window in gtk.EntryCompletion | 0 | 0 | 0 | 509 |
961,735 | 2009-06-07T11:19:00.000 | 0 | 0 | 0 | 0 | python,gtk,pygtk | 7,963,132 | 2 | false | 0 | 1 | Maybe you can solve the problem using gtk.EntryCompletion.set_minimum_key_length to prevent long list of suggestions. | 2 | 2 | 0 | I use gtk.EntryCompletion to implement the autocomletion function.
But the list is so long that the pop-up window touches the bottom of screen.
And I cant find the method of set the height of pop-up window in doc of pygtk.
How to set the height of pop-up window in gtk.EntryCompletion? | pygtk: How to set the height of pop-up window in gtk.EntryCompletion | 0 | 0 | 0 | 509 |
961,972 | 2009-06-07T14:29:00.000 | 1 | 0 | 1 | 0 | python | 27,588,519 | 4 | false | 0 | 0 | try to make sure the value whose log you are trying to find can never be 0. As log(0) tends to negative infinity, the function call will give you a math domain error. Correct that and I think you'll be fine. | 2 | 4 | 0 | i want to find out a log10 of an integer in python and i get an error like
math domain error
my code is this
w=math.log10(q*q1)/math.log10(2)
where q1,q2 are integers
yeah q1 is 0 sometimes | python logarithm | 0.049958 | 0 | 0 | 20,690 |
961,972 | 2009-06-07T14:29:00.000 | 9 | 0 | 1 | 0 | python | 961,977 | 4 | true | 0 | 0 | Is q or q1 equal to zero or one of them negative? | 2 | 4 | 0 | i want to find out a log10 of an integer in python and i get an error like
math domain error
my code is this
w=math.log10(q*q1)/math.log10(2)
where q1,q2 are integers
yeah q1 is 0 sometimes | python logarithm | 1.2 | 0 | 0 | 20,690 |
963,080 | 2009-06-08T00:08:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine | 972,243 | 4 | false | 1 | 0 | If you're using the 'webapp' framework included with App Engine (or, actually, most other WSGI-baesd frameworks), a new RequestHandler is instantiated for each request. Thus, you can use class variables on your handler class to store per-request data. | 3 | 0 | 0 | I'm creating a python app for google app engine and I've got a performance problem with some expensive operations that are repetitive within a single request. To help deal with this I'd like to create a sort of mini-cache that's scoped to a single request. This is as opposed to a session-wide or application-wide cach... | How can I create a variable that is scoped to a single request in app engine? | 0.099668 | 0 | 0 | 211 |
963,080 | 2009-06-08T00:08:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine | 963,706 | 4 | false | 1 | 0 | use local list to store data and do a model.put at end of your request processing. save multiple db trips | 3 | 0 | 0 | I'm creating a python app for google app engine and I've got a performance problem with some expensive operations that are repetitive within a single request. To help deal with this I'd like to create a sort of mini-cache that's scoped to a single request. This is as opposed to a session-wide or application-wide cach... | How can I create a variable that is scoped to a single request in app engine? | 0 | 0 | 0 | 211 |
963,080 | 2009-06-08T00:08:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 963,107 | 4 | false | 1 | 0 | Module variables may (or may not) persist between requests (the same app instance may or may not stay alive between requests), but you can explicitly clear them (del, or set to None, say) at the start of your handling a request, or when you know you're done with one. At worst (if your code is peculiarly organized) you ... | 3 | 0 | 0 | I'm creating a python app for google app engine and I've got a performance problem with some expensive operations that are repetitive within a single request. To help deal with this I'd like to create a sort of mini-cache that's scoped to a single request. This is as opposed to a session-wide or application-wide cach... | How can I create a variable that is scoped to a single request in app engine? | 0.049958 | 0 | 0 | 211 |
963,932 | 2009-06-08T08:47:00.000 | 0 | 0 | 1 | 0 | python,django,google-app-engine,list | 965,860 | 3 | false | 1 | 0 | There is no specific change "inherent" in appengine with respect to common aspects like lists. It is as just the same, plain python. | 1 | 0 | 0 | I am trying to convert a set object to list...for example "p=list('abc')" is not working.
any ideas or is it inherent in appengine | Can't seem to get list() working | 0 | 0 | 0 | 275 |
964,123 | 2009-06-08T09:49:00.000 | 0 | 0 | 0 | 0 | python,trac,netbeans6.5 | 964,191 | 5 | false | 0 | 0 | Usually, we unit test first.
Then, we write log messages to diagnose problems.
We generally don't depend heavily on debugging because it's often hard to do in situations where Python scripts are embedded in a larger product. | 1 | 4 | 0 | I'm about to start a fair amount of work extending Trac to fit our business requirements.
So far I've used pythonWin and now Netbeans 6.5 as the development environments - neither of these seem to provide any way of debugging the plugin I am working on.
I'm totally new to Python so probably have not set up the develop... | How should I debug Trac plugins? | 0 | 0 | 0 | 1,146 |
964,459 | 2009-06-08T11:30:00.000 | -1 | 0 | 1 | 0 | javascript,python | 964,478 | 9 | false | 0 | 0 | I don't know Python good enough to tell you a solution. But if you want to use that to sanitize the user input you have to be very, very careful. Removing stuff between and just doesn't catch everything. Maybe you can have a look at existing solutions (I assume Django includes something like this). | 2 | 5 | 0 | how to remove text between <script> and </script> using python? | how to remove text between using python? | -0.022219 | 0 | 0 | 10,944 |
964,459 | 2009-06-08T11:30:00.000 | 0 | 0 | 1 | 0 | javascript,python | 964,487 | 9 | false | 0 | 0 | If you're removing everything between <script> and </script> why not just remove the entire node?
Are you expecting a resig-style src and body? | 2 | 5 | 0 | how to remove text between <script> and </script> using python? | how to remove text between using python? | 0 | 0 | 0 | 10,944 |
965,694 | 2009-06-08T16:13:00.000 | 12 | 0 | 1 | 0 | python,settings | 966,074 | 13 | false | 1 | 0 | Just one more option, PyQt. Qt has a platform independent way of storing settings with the QSettings class. Underneath the hood, on windows it uses the registry and in linux it stores the settings in a hidden conf file. QSettings works very well and is pretty seemless. | 6 | 65 | 0 | Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another? | What's the official way of storing settings for Python programs? | 1 | 0 | 0 | 43,088 |
965,694 | 2009-06-08T16:13:00.000 | 35 | 0 | 1 | 0 | python,settings | 965,795 | 13 | true | 1 | 0 | Depends on the predominant intended audience.
If it is programmers who change the file anyway, just use python files like settings.py
If it is end users then, think about ini files. | 6 | 65 | 0 | Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another? | What's the official way of storing settings for Python programs? | 1.2 | 0 | 0 | 43,088 |
965,694 | 2009-06-08T16:13:00.000 | -1 | 0 | 1 | 0 | python,settings | 965,733 | 13 | false | 1 | 0 | why would Guido blessed something that is out of his scope? No there is nothing particular blessed. | 6 | 65 | 0 | Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another? | What's the official way of storing settings for Python programs? | -0.015383 | 0 | 0 | 43,088 |
965,694 | 2009-06-08T16:13:00.000 | 0 | 0 | 1 | 0 | python,settings | 965,742 | 13 | false | 1 | 0 | It is more of convenience. There is no official way per say. But using XML files would make sense as they can be manipulated by various other applications/libraries. | 6 | 65 | 0 | Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another? | What's the official way of storing settings for Python programs? | 0 | 0 | 0 | 43,088 |
965,694 | 2009-06-08T16:13:00.000 | 4 | 0 | 1 | 0 | python,settings | 965,913 | 13 | false | 1 | 0 | It depends largely on how complicated your configuration is. If you're doing a simple key-value mapping and you want the capability to edit the settings with a text editor, I think ConfigParser is the way to go.
If your settings are complicated and include lists and nested data structures, I'd use XML or JSON and crea... | 6 | 65 | 0 | Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another? | What's the official way of storing settings for Python programs? | 0.061461 | 0 | 0 | 43,088 |
965,694 | 2009-06-08T16:13:00.000 | 6 | 0 | 1 | 0 | python,settings | 965,730 | 13 | false | 1 | 0 | I am not sure that there is an 'official' way (it is not mentioned in the Zen of Python :) )- I tend to use the Config Parser module myself and I think that you will find that pretty common. I prefer that over the python file approach because you can write back to it and dynamically reload if you want. | 6 | 65 | 0 | Django uses real Python files for settings, Trac uses a .ini file, and some other pieces of software uses XML files to hold this information.
Are one of these approaches blessed by Guido and/or the Python community more than another? | What's the official way of storing settings for Python programs? | 1 | 0 | 0 | 43,088 |
967,369 | 2009-06-08T22:36:00.000 | 6 | 0 | 0 | 1 | python,shell,terminal,stdout | 967,383 | 4 | false | 0 | 0 | You can use os.getppid() to find out the process id for the parent-process of this one, and then use that process id to determine which program that process is running. More usefully, you could use sys.stdout.isatty() -- that doesn't answer your title question but appears to better solve the actual problem you explain ... | 1 | 7 | 0 | is there a way to find out from within a python program if it was started in a terminal or e.g. in a batch engine like sun grid engine?
the idea is to decide on printing some progress bars and other ascii-interactive stuff, or not.
thanks!
p. | python: find out if running in shell or not (e.g. sun grid engine queue) | 1 | 0 | 0 | 1,762 |
967,661 | 2009-06-09T00:29:00.000 | 1 | 0 | 1 | 0 | python,truncate | 967,676 | 8 | false | 0 | 0 | You have several options - you can round the number using round(), however this can introduce some inaccuracies (315.15 might round to 315.150000003 for example). If you're just looking to truncate the value of the float when you're displaying it, you can specify the width of the output using printf("%.2f", mynumber). ... | 1 | 12 | 0 | How can truncate an input like 315.15321531321
I want to truncate all the values after the hundredths position so it becomes 315.15
how do i do that? | python truncate after a hundreds? | 0.024995 | 0 | 0 | 38,627 |
968,317 | 2009-06-09T05:36:00.000 | 0 | 0 | 0 | 0 | python,image-processing,opencv,color-space | 968,351 | 3 | false | 0 | 0 | How about using a formular like r' = r-(g+b)? | 2 | 1 | 1 | I'm using the python OpenCV bindings and at the moment I try to isolate a colorrange. That means I want to filter out everything that is not reddish.
I tried to take only the red color channel but this includes the white spaces in the Image too.
What is a good way to do that? | How to isolate a single color in an image | 0 | 0 | 0 | 2,798 |
968,317 | 2009-06-09T05:36:00.000 | 1 | 0 | 0 | 0 | python,image-processing,opencv,color-space | 2,204,755 | 3 | false | 0 | 0 | Use the HSV colorspace. Select pixels that have an H value in the range that you consider to contain "red," and an S value large enough that you do not consider it to be neutral, maroon, brown, or pink. You might also need to throw out pixels with low V's. The H dimension is a circle, and red is right where the circ... | 2 | 1 | 1 | I'm using the python OpenCV bindings and at the moment I try to isolate a colorrange. That means I want to filter out everything that is not reddish.
I tried to take only the red color channel but this includes the white spaces in the Image too.
What is a good way to do that? | How to isolate a single color in an image | 0.066568 | 0 | 0 | 2,798 |
969,093 | 2009-06-09T09:37:00.000 | 0 | 0 | 1 | 0 | python | 52,444,195 | 10 | false | 0 | 0 | help(name of the function)
if you are using jupyter or ipython notebook ,then adding "?" would bring dogstring for the code. this is helpful if you want to see help of specific function.example pandas.read_csv?.
by pressing "Tab" you can see what you need to enter as parameters, although it would not give what a functi... | 2 | 9 | 0 | Is there any way to search for a particular package/function using keywords in the Python console?
For example, I may want to search "pdf" for pdf related tasks. | How to search help using python console | 0 | 0 | 0 | 53,692 |
969,093 | 2009-06-09T09:37:00.000 | 5 | 0 | 1 | 0 | python | 4,670,427 | 10 | false | 0 | 0 | You can search for modules containing "pdf" in their description by running the command help("modules pdf"). | 2 | 9 | 0 | Is there any way to search for a particular package/function using keywords in the Python console?
For example, I may want to search "pdf" for pdf related tasks. | How to search help using python console | 0.099668 | 0 | 0 | 53,692 |
969,121 | 2009-06-09T09:43:00.000 | 1 | 0 | 1 | 1 | python,eclipse,cvs,pydev | 969,236 | 8 | false | 1 | 0 | I tried Eclipse+Subclipse and Eclipse+Bazaar plugin. Both work very well, but I have found that Tortoise versions of those version source control tools are so good that I resigned from Eclipse plugins. On Windows Tortoise XXX are my choice. They integrate with shell (Explorer or TotalCommander), changes icon overlay if... | 4 | 4 | 0 | I tried several Python IDEs (on Windows platform) but finally I found only Eclipse + PyDev meeting my needs. This set of tools is really comfortable and easy to use. I'm currently working on a quite bigger project. I'd like to have a possibility to use CVS or any other version control system which would be installed on... | Eclipse + local CVS + PyDev | 0.024995 | 0 | 0 | 2,673 |
969,121 | 2009-06-09T09:43:00.000 | 4 | 0 | 1 | 1 | python,eclipse,cvs,pydev | 969,642 | 8 | true | 1 | 0 | Last time I tried this, Eclipse did not support direct access to local repositories in the same way that command line cvs does because command line cvs has both client and server functionality whereas Eclipse only has client functionality and needs to go through (e.g.) pserver, so you would probably need to have a cvs ... | 4 | 4 | 0 | I tried several Python IDEs (on Windows platform) but finally I found only Eclipse + PyDev meeting my needs. This set of tools is really comfortable and easy to use. I'm currently working on a quite bigger project. I'd like to have a possibility to use CVS or any other version control system which would be installed on... | Eclipse + local CVS + PyDev | 1.2 | 0 | 0 | 2,673 |
969,121 | 2009-06-09T09:43:00.000 | 0 | 0 | 1 | 1 | python,eclipse,cvs,pydev | 976,961 | 8 | false | 1 | 0 | I recently moved my house and don't have yet an access to internet.
CVS and SVN are the Centralized Version control systems. Rather than having to install them on your local system just for single version control, you could use DVCS like Mercurial or Git.
When you clone a Mercurial Repository, you have literally all v... | 4 | 4 | 0 | I tried several Python IDEs (on Windows platform) but finally I found only Eclipse + PyDev meeting my needs. This set of tools is really comfortable and easy to use. I'm currently working on a quite bigger project. I'd like to have a possibility to use CVS or any other version control system which would be installed on... | Eclipse + local CVS + PyDev | 0 | 0 | 0 | 2,673 |
969,121 | 2009-06-09T09:43:00.000 | 1 | 0 | 1 | 1 | python,eclipse,cvs,pydev | 969,134 | 8 | false | 1 | 0 | If you don't mind a switch to Subversion, Eclipse has its SubClipse plugin. | 4 | 4 | 0 | I tried several Python IDEs (on Windows platform) but finally I found only Eclipse + PyDev meeting my needs. This set of tools is really comfortable and easy to use. I'm currently working on a quite bigger project. I'd like to have a possibility to use CVS or any other version control system which would be installed on... | Eclipse + local CVS + PyDev | 0.024995 | 0 | 0 | 2,673 |
969,849 | 2009-06-09T12:40:00.000 | 1 | 0 | 0 | 0 | python,authentication | 969,860 | 4 | false | 0 | 0 | wrap the calling of your python app in a .bat file and put a shortcut to that .bat file in startup. | 3 | 1 | 0 | I have a web based email application that logs me out after 10 minutes of inactivity ("For security reasons"). I would like to write something that either a) imitates a keystroke b) pings an ip or c) some other option every 9 minutes so that I stay logged in. I am on my personal laptop in an office with a door, so I'm ... | automatic keystroke to stay logged in | 0.049958 | 0 | 0 | 650 |
969,849 | 2009-06-09T12:40:00.000 | 3 | 0 | 0 | 0 | python,authentication | 969,897 | 4 | true | 0 | 0 | You can also use the Scheduled Tasks feature (on the Control Panel) to run it at startup, or you can change your script to ping the IP and exit, and scheduled it to run every 9 minutes. You have nice settings there, for example, you can stop running it at night, so you'll still log out.
You might still need the bat fil... | 3 | 1 | 0 | I have a web based email application that logs me out after 10 minutes of inactivity ("For security reasons"). I would like to write something that either a) imitates a keystroke b) pings an ip or c) some other option every 9 minutes so that I stay logged in. I am on my personal laptop in an office with a door, so I'm ... | automatic keystroke to stay logged in | 1.2 | 0 | 0 | 650 |
969,849 | 2009-06-09T12:40:00.000 | 2 | 0 | 0 | 0 | python,authentication | 971,984 | 4 | false | 0 | 0 | Pinging an IP will not likely keep your session from timing out.
You will likely need to do an HTTP GET and include the session cookie supplied by the server to your browser when you login. Your script may be able to read the cookie from your browser's cookies folder after you have logged in via the browser.
Also, the... | 3 | 1 | 0 | I have a web based email application that logs me out after 10 minutes of inactivity ("For security reasons"). I would like to write something that either a) imitates a keystroke b) pings an ip or c) some other option every 9 minutes so that I stay logged in. I am on my personal laptop in an office with a door, so I'm ... | automatic keystroke to stay logged in | 0.099668 | 0 | 0 | 650 |
969,877 | 2009-06-09T12:48:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 14,879,943 | 1 | false | 1 | 0 | Actually not my answer, but from the OP, that didn't act on S. Lott's comment:
It works now! but I didnt change anything actually, seems like Google need time to update its database for app engine. like 20 mins. | 1 | 1 | 0 | I want to use user service of my domain in google App, but...
Is it possible to solve this problem by my side?
Traceback (most recent call last):
File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 501, in __call__
handler.get(*groups)
File "/base/data/home/apps/myapp2009/1.3340817... | users module errors in Google App Engine | 0.197375 | 0 | 0 | 444 |
970,909 | 2009-06-09T15:49:00.000 | 0 | 0 | 1 | 0 | java,python,multithreading | 971,025 | 6 | false | 1 | 0 | Just a sidestep about point 1 here, because Java Thread priorities might not work as one would expect.
From the SCJP guide:
Because thread-scheduling priority behaviour is not guaranteed, use thread priorities as a way to improve the efficiency of your program, but just be sure your program doesn't depend on that beha... | 1 | 6 | 0 | i have few questions about threads in Python and Java...
Is it possible to give priorities to Python threads, as it is in Java?
How can I kill, stop, suspend and interrupt thread in Python?
Thread groups - what are they really for? Does Python support them too?
Synchronization - in Java we use simply keyword synchorin... | Threads in Java and Python | 0 | 0 | 0 | 2,528 |
971,983 | 2009-06-09T19:18:00.000 | 11 | 0 | 0 | 0 | python,django | 972,004 | 3 | true | 1 | 0 | There's no real rule for this, But one thing I like to do is actually arrange for the index access to redirect to another spot. If you prefer, though, you can just give the index page a plain view.
That said, It's probably a good idea to keep all your code in an actual app, so that you can refactor it more easily, a... | 1 | 20 | 0 | I've been having a look at Django and, from what I've seen, it's pretty darn fantastic. I'm a little confused, however, how I go about implementing a "home page" for my website? Would it be a separate app, or just a view within the project, or what? | Django - Website Home Page | 1.2 | 0 | 0 | 11,919 |
973,473 | 2009-06-10T02:48:00.000 | 1 | 0 | 1 | 1 | python,directory,subdirectory | 35,261,270 | 32 | false | 0 | 0 | use a filter function os.path.isdir over os.listdir()
something like this filter(os.path.isdir,[os.path.join(os.path.abspath('PATH'),p) for p in os.listdir('PATH/')]) | 2 | 824 | 0 | Is there a way to return a list of all the subdirectories in the current directory in Python?
I know you can do this with files, but I need to get the list of directories instead. | Getting a list of all subdirectories in the current directory | 0.00625 | 0 | 0 | 1,160,495 |
973,473 | 2009-06-10T02:48:00.000 | 41 | 0 | 1 | 1 | python,directory,subdirectory | 973,489 | 32 | false | 0 | 0 | If you need a recursive solution that will find all the subdirectories in the subdirectories, use walk as proposed before.
If you only need the current directory's child directories, combine os.listdir with os.path.isdir | 2 | 824 | 0 | Is there a way to return a list of all the subdirectories in the current directory in Python?
I know you can do this with files, but I need to get the list of directories instead. | Getting a list of all subdirectories in the current directory | 1 | 0 | 0 | 1,160,495 |
973,520 | 2009-06-10T03:11:00.000 | 11 | 1 | 0 | 1 | python,shell,zsh,ipython | 1,070,597 | 2 | true | 0 | 0 | I asked this question on the zsh list and this answer worked for me. YMMV.
In genutils.py after the line
if not debug:
Remove the line:
stat = os.system(cmd)
Replace it with:
stat =
subprocess.call(cmd,shell=True,executable='/bin/zsh')
you see, the problem is that that "!" call uses os.system to run it, which ... | 1 | 11 | 0 | I have been in love with zsh for a long time, and more recently I have been discovering the advantages of the ipython interactive interpreter over python itself. Being able to cd, to ls, to run or to ! is indeed very handy. But now it feels weird to have such a clumsy shell when in ipython, and I wonder how I could int... | how to integrate ZSH and (i)python? | 1.2 | 0 | 0 | 8,591 |
974,741 | 2009-06-10T10:18:00.000 | 0 | 0 | 0 | 0 | python,urllib2,wget | 975,759 | 10 | false | 1 | 0 | There shouldn't be a difference really. All urlretrieve does is make a simple HTTP GET request. Have you taken out your data processing code and done a straight throughput comparison of wget vs. pure python? | 5 | 9 | 0 | I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I... | wget Vs urlretrieve of python | 0 | 0 | 1 | 37,225 |
974,741 | 2009-06-10T10:18:00.000 | 0 | 0 | 0 | 0 | python,urllib2,wget | 976,135 | 10 | false | 1 | 0 | Please show us some code. I'm pretty sure that it has to be with the code and not on urlretrieve.
I've worked with it in the past and never had any speed related issues. | 5 | 9 | 0 | I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I... | wget Vs urlretrieve of python | 0 | 0 | 1 | 37,225 |
974,741 | 2009-06-10T10:18:00.000 | 0 | 0 | 0 | 0 | python,urllib2,wget | 2,350,655 | 10 | false | 1 | 0 | You can use wget -k to engage relative links in all urls. | 5 | 9 | 0 | I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I... | wget Vs urlretrieve of python | 0 | 0 | 1 | 37,225 |
974,741 | 2009-06-10T10:18:00.000 | 1 | 0 | 0 | 0 | python,urllib2,wget | 7,782,898 | 10 | false | 1 | 0 | Since python suggests using urllib2 instead of urllib, I take a test between urllib2.urlopen and wget.
The result is, it takes nearly the same time for both of them to download the same file.Sometimes, urllib2 performs even better.
The advantage of wget lies in a dynamic progress bar to show the percent finished and t... | 5 | 9 | 0 | I have a task to download Gbs of data from a website. The data is in form of .gz files, each file being 45mb in size.
The easy way to get the files is use "wget -r -np -A files url". This will donwload data in a recursive format and mirrors the website. The donwload rate is very high 4mb/sec.
But, just to play around I... | wget Vs urlretrieve of python | 0.019997 | 0 | 1 | 37,225 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.