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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,313,053 | 2010-02-22T18:17:00.000 | 2 | 0 | 0 | 1 | python,linux,path | 2,313,168 | 4 | false | 0 | 0 | It's important to remember:
use of the tilde ~ expands the home directory as per Poke's answer
use of the forward slash / is the separator for linux / *nix directories
by default, *nix systems such as linux for example has a wild card globbing in the shell, for instance echo *.* will return back all files that match t... | 1 | 3 | 0 | Using Python, how does one parse/access files with Linux-specific features, like "~/.mozilla/firefox/*.default"? I've tried this, but it doesn't work.
Thanks | Python: How to Access Linux Paths | 0.099668 | 0 | 1 | 7,357 |
2,313,307 | 2010-02-22T18:54:00.000 | 1 | 0 | 0 | 0 | python,mysql,macos | 9,170,459 | 4 | false | 0 | 0 | If the problem is the inability, as so many people have mentioned, that the msqldb module is a problem a simpler way is
1. install the mysql db
2. install the pyodbc module
3. Load and configure the odbc mysql driver
4. perform sql manipulations with pyodbc, which is very mature and full functional.
hope this helps | 1 | 3 | 0 | Is there another way to connect to a MySQL database with what came included in the version of Python (2.5.1) that is bundled with Mac OS 10.5.x? I unfortunately cannot add the the MySQLdb module to the client machines I am working with...I need to work with the stock version of Python that shipped with Leopard. | Python: Access a MySQL db without MySQLdb module | 0.049958 | 1 | 0 | 3,698 |
2,314,178 | 2010-02-22T21:04:00.000 | 1 | 0 | 0 | 0 | python,sql,sql-server | 2,314,282 | 4 | false | 0 | 0 | ODBC + freetds + a python wrapper library for ODBC. | 1 | 26 | 0 | What is the best way to access sql server from python is it DB-API ?
Also could someone provide a such code using the DB-API how to connect to sql server from python and excute query ? | Python & sql server | 0.049958 | 1 | 0 | 28,195 |
2,314,181 | 2010-02-22T21:05:00.000 | 1 | 0 | 1 | 0 | python,operators | 2,314,211 | 5 | false | 0 | 0 | Bit shifting an integer gives another integer. For instance, the number 12 is written in binary as 0b1100. If we bit shift by 1 to the right, we get 0b110 = 6. If we bit shift by 2, we get 0b11 = 3. And lastly, if we bitshift by 3, we get 0b1 = 1 rather than 1.5. This is because the bits that are shifted beyond the reg... | 1 | 3 | 0 | I've never used the >> and << operators, not because I've never needed them, but because I don't know if I could have used them, or where I should have.
100 >> 3 outputs 12 instead of 12.5. Why is this. Perhaps learning where to best use right shift will answer that implicitly, but I'm curious. | Python: Why does right shift >> round down and where should it be used? | 0.039979 | 0 | 0 | 5,773 |
2,314,307 | 2010-02-22T21:22:00.000 | 2 | 0 | 0 | 0 | python,database,logging | 46,617,613 | 5 | false | 0 | 0 | Old question, but dropping this for others. If you want to use python logging, you can add two handlers. One for writing to file, a rotating file handler. This is robust, and can be done regardless if the dB is up or not.
The other one can write to another service/module, like a pymongo integration.
Look up logging.c... | 1 | 48 | 0 | I'm seeking a way to let the python logger module to log to database and falls back to file system when the db is down.
So basically 2 things: How to let the logger log to database and how to make it fall to file logging when the db is down. | python logging to database | 0.07983 | 1 | 0 | 48,780 |
2,315,032 | 2010-02-22T23:18:00.000 | 1 | 0 | 1 | 0 | python | 2,315,052 | 9 | false | 0 | 0 | Put the dates in a set and then iterate from the first date to the last using datetime.timedelta(), checking for containment in the set each time. | 1 | 23 | 0 | In Python how do I find all the missing days in a sorted list of dates? | How do I find missing dates in a list of sorted dates? | 0.022219 | 0 | 0 | 16,151 |
2,315,151 | 2010-02-22T23:43:00.000 | 2 | 0 | 0 | 0 | python,http,asynchronous,cookies | 2,317,612 | 1 | true | 0 | 0 | Using httplib and urllib2, the
requests are synchronous unless I use
thread, in which case the order is not
guaranteed to be respected
How would you know that the order has been respected unless you get your response back from the first connection before you send the response to the second connection? After all,... | 1 | 1 | 0 | I am coding a python (2.6) interface to a web service. I need to communicate via http so that :
Cookies are handled automatically,
The requests are asynchronous,
The order in which the requests are sent is respected (the order in which the responses to these requests are received does not matter).
I have tried what c... | Python: Asynchronous http requests sent in order with automatic handling of cookies? | 1.2 | 0 | 1 | 1,531 |
2,315,187 | 2010-02-22T23:51:00.000 | 3 | 0 | 0 | 0 | python,django,django-comments | 3,269,190 | 4 | false | 1 | 0 | I just ran into this problem.
Just re-implementing the logic in comments app's delete view would couple your implementation to that specific version of the comments app. For example the comment app actual also handles signals when you mark something as deleted and the provided version doesn't do that.
Fortunately the ... | 1 | 7 | 0 | I am using the delete() function from django.contrib.comments.views.moderation module. The staff-member is allowed to delete ANY comment posts, which is completely fine. However, I would also like to give registered non-staff members the privilege to delete their OWN comment posts, and their OWN only. How can I accompl... | Allowing users to delete their own comments in Django | 0.148885 | 0 | 0 | 5,562 |
2,316,368 | 2010-02-23T05:41:00.000 | -1 | 0 | 1 | 1 | python,printing,python-3.x | 68,132,714 | 2 | false | 0 | 0 | With the OS module you can print files in Windows or higher. | 1 | 15 | 0 | I have a Python 3 script that is going to be doing some regex substitution on some Rich Text Files (rtf) and I would like to be able to print out a whole directory's files on Windows, Linux, and Mac.
Is there a way to print to the OS's default printer so that it works in all platforms? | How do I print to the OS's default printer in Python 3 (cross platform)? | -0.099668 | 0 | 0 | 13,805 |
2,317,653 | 2010-02-23T11:27:00.000 | 2 | 0 | 1 | 0 | asp.net,ironpython | 2,323,354 | 2 | true | 0 | 0 | When you compile IronPython code it doesn't get compiled to normal .NET code where you'd have a class at the IL level for each class you have at the source level. Instead it gets compiled into the same form that we compile to internally using the DLR.
For user code this is just a bunch of executable methods. There's ... | 1 | 2 | 0 | when I compile some .py codefiles with no class definitions into dlls , the compiled dll is created with a "DRLCachedCode" class inside. Why is that? | why are some IronPython dlls generated with a DLRCachedCode class inside? | 1.2 | 0 | 0 | 477 |
2,317,921 | 2010-02-23T12:08:00.000 | 2 | 1 | 0 | 0 | php,python,object,ipython | 2,317,942 | 4 | false | 0 | 0 | dir(object) will give you all its attribute names. | 1 | 1 | 0 | Is there a way to get PHP-like print_r(object) funcionality in iPython?
I know I can use '?' to get info about an object, but how do I view the values of the object? | print_r functionality in iPython | 0.099668 | 0 | 0 | 497 |
2,318,044 | 2010-02-23T12:29:00.000 | 0 | 1 | 1 | 0 | python,ruby,module,metaprogramming | 2,318,065 | 3 | false | 0 | 0 | Classes are not added to a global registry in Python by default. You'll need to iterate over all imported modules and look for it. | 1 | 1 | 0 | I've a name of a class stored in var, which I need to create an object from.
However I do not know in which module it is defined (if I did, I would just call getattr(module,var), but I do know it's imported.
Should I go over every module and test if the class is defined there ? How do I do it in python ?
What if I have... | Python equivalent for Ruby's ObjectSpace? | 0 | 0 | 0 | 389 |
2,318,335 | 2010-02-23T13:16:00.000 | 2 | 0 | 0 | 0 | wpf,nltk,ironpython | 2,320,322 | 1 | false | 0 | 1 | It definitely is possible, as long as NLTK doesn't use any C extensions. It will be much easier if you use VS2010 though, because of the dynamic keyword. Look at the Microsoft.Scripting.Hosting library from IronPython, it will get you started towards loading the NLTK code and executing methods on it. | 1 | 5 | 0 | I would like to use NLTK (Natural Language Toolkit) for Python using IronPython and call from an exisiting WPF/c# project.
Is it possible to reference NLTK from within WPF in this way. For example to use Named Entity Recognition from NTLK?
Any advice or guidance appreciated. | NLTK in IronPython from WPF | 0.379949 | 0 | 0 | 1,242 |
2,319,909 | 2010-02-23T16:37:00.000 | 3 | 0 | 0 | 0 | python,m2crypto | 2,321,344 | 2 | true | 0 | 0 | Setting SSL.Connection.clientPostConnectionCheck = None does bypass the WrongHost check, but it also bypasses many other checks that you probably don't want to bypass (such as checking if there is any certificate at all). I would recommend using a try/except combo to catch the WrongHost because there isn't really anyth... | 1 | 3 | 0 | I am using M2Crypto 0.20.2 and python 2.4.3. I connect to the server with the fully qualified domain name. The common name in the server certificate does not use the FQDN so I get this error:
M2Crypto.SSL.Checker.WrongHost: Peer certificate commonName does not match host
How do I override the post connection check of... | M2Crypto: Override Post Connection Check of HostName | 1.2 | 0 | 0 | 2,431 |
2,320,210 | 2010-02-23T17:20:00.000 | 0 | 1 | 1 | 0 | python,unit-testing,testing,dependency-injection | 2,320,900 | 6 | false | 0 | 0 | I know it's the typical use case for mock objects, but that's also an old argument... are Mock objects necessary at all or are they evil ?
I'm on the side of those who believe mocks are evil and would try to avoid changing tested code at all. I even believe such need to modify tested code is a code smell...
If you wish... | 1 | 10 | 0 | In general I want to disable as little code as possible, and I want it to be explicit: I don't want the code being tested to decide whether it's a test or not, I want the test to tell that code "hey, BTW, I'm running a unit test, can you please not make your call to solr, instead can you please stick what you would sen... | In Python, what's a good pattern for disabling certain code during unit tests? | 0 | 0 | 0 | 2,347 |
2,321,813 | 2010-02-23T21:19:00.000 | 0 | 1 | 0 | 0 | python,post,get,webserver,simplehttpserver | 8,673,542 | 3 | false | 1 | 0 | have you considered using CGIHTTPServer instead of SimpleHTTPServer? Then you can toss your scripts in cgi-bin and they'll execute. You have to include content-type header and whatnot but if you're looking for quick and dirty it's real convenient | 1 | 1 | 0 | I know that with the SimpleHTTPServer I can make my directories accessible by web-browsers via Internet. So, I run just one line of the code and, as a result, another person working on another computer can use his/her browser to see content of my directories.
But I wander if I can make more complicated things. For exam... | Is it possible to write dynamic web pages in Python with the Really Simple HTTP Server? | 0 | 0 | 0 | 7,811 |
2,322,176 | 2010-02-23T22:15:00.000 | 1 | 0 | 0 | 0 | python,portability,forward-compatibility | 2,322,212 | 4 | false | 0 | 0 | "2.6 would be better, but it seems like lots of libraries are still porting over to that"
What? What libraries -- that you need -- are "still porting over to that"?
"3.1 would be the best" "but I'm finding that lots of libraries/frameworks don't support"
Correct. You've stated that twice in the question. That's very... | 4 | 3 | 0 | Currently I have Python 3.1.1 installed on my system, same version on my server with WSGI 3.0 running on Apache 2.2.
I want to keep using Python 3.1, but I'm finding that lots of libraries/frameworks don't support it yet, namely Django, Pylons, MySQLdb, etc.
I also checked an account I have on a friend's server, and it... | What version of Python should I be using to develop web applications? | 0.049958 | 0 | 0 | 209 |
2,322,176 | 2010-02-23T22:15:00.000 | 2 | 0 | 0 | 0 | python,portability,forward-compatibility | 2,322,228 | 4 | true | 0 | 0 | Begin with Python 2.5 if you're not sure.
Have a look at Google App Engine (based on Django). It's using Python 2.5 and it's free.
However, you will not be able to call scipy (for example) or any libraries with "C" inside.
You will have the greatest amount of portability with Python2.5. Moreover, python3k is not really... | 4 | 3 | 0 | Currently I have Python 3.1.1 installed on my system, same version on my server with WSGI 3.0 running on Apache 2.2.
I want to keep using Python 3.1, but I'm finding that lots of libraries/frameworks don't support it yet, namely Django, Pylons, MySQLdb, etc.
I also checked an account I have on a friend's server, and it... | What version of Python should I be using to develop web applications? | 1.2 | 0 | 0 | 209 |
2,322,176 | 2010-02-23T22:15:00.000 | 4 | 0 | 0 | 0 | python,portability,forward-compatibility | 2,322,329 | 4 | false | 0 | 0 | For now, Python 3 is not widely deployed in production. Depends on what you use Python for. If it's just for one off scripts, it will be ok either way, if the idea is to use third party modules, C modules and or deploy painlessly, then settle for any of the 2.4+ versions. Many projects strive to keep 2.3 compativility,... | 4 | 3 | 0 | Currently I have Python 3.1.1 installed on my system, same version on my server with WSGI 3.0 running on Apache 2.2.
I want to keep using Python 3.1, but I'm finding that lots of libraries/frameworks don't support it yet, namely Django, Pylons, MySQLdb, etc.
I also checked an account I have on a friend's server, and it... | What version of Python should I be using to develop web applications? | 0.197375 | 0 | 0 | 209 |
2,322,176 | 2010-02-23T22:15:00.000 | 0 | 0 | 0 | 0 | python,portability,forward-compatibility | 6,686,801 | 4 | false | 0 | 0 | For intranet web apps I had to install python 2.5 (due to combination of wiki, bug tracker, and httpd WSGI compatibility).
For custom web apps I standardized on python 3.2.
Thus I have both installed simultaneously. I write for 3.2 and bring specific libraries up to spec as needed. However large packages which I don't... | 4 | 3 | 0 | Currently I have Python 3.1.1 installed on my system, same version on my server with WSGI 3.0 running on Apache 2.2.
I want to keep using Python 3.1, but I'm finding that lots of libraries/frameworks don't support it yet, namely Django, Pylons, MySQLdb, etc.
I also checked an account I have on a friend's server, and it... | What version of Python should I be using to develop web applications? | 0 | 0 | 0 | 209 |
2,322,342 | 2010-02-23T22:47:00.000 | 11 | 0 | 1 | 0 | python | 2,322,387 | 2 | true | 0 | 0 | The only time I know that you have to manually raise StopIteration is when you are implementing a next() method on a class to signal that the iterator is terminated. For generators (functions with yield statements in them), the end of the function or a return statement will properly trigger the StopIteration for you. | 1 | 8 | 0 | Should a Python generator raise an exception when there are no more elements to yield?
Which one? | Should a Python generator raise an exception when there are no more elements to yield? | 1.2 | 0 | 0 | 2,366 |
2,322,355 | 2010-02-23T22:48:00.000 | -1 | 0 | 1 | 0 | python,operators,splat | 5,942,664 | 9 | false | 0 | 0 | I call *args "star args" or "varargs" and **kwargs "keyword args". | 3 | 247 | 0 | What is the correct name for operator *, as in function(*args)? unpack, unzip, something else? | proper name for python * operator? | -0.022219 | 0 | 0 | 139,156 |
2,322,355 | 2010-02-23T22:48:00.000 | 18 | 0 | 1 | 0 | python,operators,splat | 2,322,491 | 9 | false | 0 | 0 | I say "star-args" and Python people seem to know what i mean.
** is trickier - I think just "qargs" since it is usually used as **kw or **kwargs | 3 | 247 | 0 | What is the correct name for operator *, as in function(*args)? unpack, unzip, something else? | proper name for python * operator? | 1 | 0 | 0 | 139,156 |
2,322,355 | 2010-02-23T22:48:00.000 | 124 | 0 | 1 | 0 | python,operators,splat | 2,323,312 | 9 | false | 0 | 0 | I call it "positional expansion", as opposed to ** which I call "keyword expansion". | 3 | 247 | 0 | What is the correct name for operator *, as in function(*args)? unpack, unzip, something else? | proper name for python * operator? | 1 | 0 | 0 | 139,156 |
2,322,868 | 2010-02-24T00:34:00.000 | 3 | 0 | 1 | 0 | python,python-2.6,python-2.x | 2,322,892 | 3 | false | 0 | 0 | As the other people say, just ask for input to get it to hold. However, I would recommend running your Python scripts in a different manner in Windows. Using the IDLE IDE (should have come with your distribution), just open the script you want to run and press F5. Then, not only can you see the output for as long as yo... | 3 | 3 | 0 | I'm new to programming, especially Python. I'm trying to make an application that converts Fahrenheit to Celsius, but I don't know how to make the program stay open. Whenever it reaches the end of the code, it automatically closes before the user can see his or her results. I'm using Python 2.6. | How do I prevent my Python application from automatically closing once reaching the end of code? | 0.197375 | 0 | 0 | 25,629 |
2,322,868 | 2010-02-24T00:34:00.000 | 0 | 0 | 1 | 0 | python,python-2.6,python-2.x | 2,322,884 | 3 | false | 0 | 0 | ask user to enter one more variable and print "Press enter to exit..." | 3 | 3 | 0 | I'm new to programming, especially Python. I'm trying to make an application that converts Fahrenheit to Celsius, but I don't know how to make the program stay open. Whenever it reaches the end of the code, it automatically closes before the user can see his or her results. I'm using Python 2.6. | How do I prevent my Python application from automatically closing once reaching the end of code? | 0 | 0 | 0 | 25,629 |
2,322,868 | 2010-02-24T00:34:00.000 | 10 | 0 | 1 | 0 | python,python-2.6,python-2.x | 2,322,878 | 3 | false | 0 | 0 | Well, I guess you mean the terminal that Windows opens for you when you run a python file is closed too fast. You can add raw_input('Press Enter to exit') right before your program would exit. It tells Python to wait for input before exiting. | 3 | 3 | 0 | I'm new to programming, especially Python. I'm trying to make an application that converts Fahrenheit to Celsius, but I don't know how to make the program stay open. Whenever it reaches the end of the code, it automatically closes before the user can see his or her results. I'm using Python 2.6. | How do I prevent my Python application from automatically closing once reaching the end of code? | 1 | 0 | 0 | 25,629 |
2,323,332 | 2010-02-24T02:47:00.000 | 3 | 0 | 1 | 0 | python,floating-accuracy | 2,323,355 | 4 | false | 0 | 0 | If you want to compare two floats, you can compare on abs(a-b) < epsilon where epsilon is your precision requirement. | 1 | 2 | 0 | Using numpy or python's standard library, either or. How can I take a value with several decimal places and truncate it to 4 decimal places? I only want to compare floating point numbers to their first 4 decimal points. | How to calculate a value to a certain number of decimal places? | 0.148885 | 0 | 0 | 863 |
2,323,371 | 2010-02-24T02:59:00.000 | 1 | 0 | 0 | 0 | python,django,actionscript-3 | 2,323,428 | 1 | true | 1 | 0 | I've used firebug to debug the flex side of things. But I've been using json or XML for communication between the two. Since flash uses the browser to do the network stuff, the request should be visible in the net tab of firebug.
To debug the django side of things, you have a few options.
If you're using the django de... | 1 | 0 | 0 | I love django, and I like flex. Django for it's cool debugging system (those yellow pages helps a lot to find bugs in my code), and flex for it possibilities.
Recently I come across a problem. If I create a form in flex and then communicate with the django server, I can't see any debugging info (when the exception happ... | django+flex: Debugging strategies | 1.2 | 0 | 0 | 111 |
2,325,150 | 2010-02-24T10:19:00.000 | 1 | 0 | 0 | 0 | python,django,permissions,django-admin,admin | 2,325,199 | 1 | true | 1 | 0 | If you make sure that User 2 has no permissions for any model related to the app you want to hide away (so no change, add or delete powers for any of the models in that app), then it won't appear in the admin for User 2. | 1 | 0 | 0 | I'm starting to learn Django and I have a question.
Is there any way to restric views in the administration interface? I see there are "change, "add" and "delete" permissions, but I wanted to restrict views also.
For example: Two users, "User 1" is superuser and "User 2" is in the editor group. User 1 has access to ev... | Django admin - Restrict user view by permission | 1.2 | 0 | 0 | 2,577 |
2,325,938 | 2010-02-24T12:32:00.000 | 0 | 1 | 0 | 0 | python,chat,irc | 2,325,967 | 3 | false | 0 | 0 | My guess is that you are looking for a IRC channel? well this is not related to programming so you should not be posting that question here?
any way quakenet has a python channel | 1 | 1 | 0 | Is there an active Python-Chat? | Is there an active Python-Chat? | 0 | 0 | 0 | 465 |
2,325,971 | 2010-02-24T12:37:00.000 | 1 | 1 | 0 | 0 | asp.net,ironpython | 2,326,011 | 1 | true | 1 | 0 | since iron python compiles to IL I would imagine you can use the same obfuscations tools such as DotFuscator.
Are you using the pyc tool included in iron pythons tool folder? | 1 | 0 | 0 | do you know/have you tried any code protection system which works with IronPython assemblies? Can you list it/them here? | Code protection system which works with IronPython assemblies? | 1.2 | 0 | 0 | 159 |
2,326,359 | 2010-02-24T13:42:00.000 | 3 | 0 | 1 | 0 | python | 2,326,647 | 5 | false | 0 | 0 | You can't add a constant to a tuple because tuples are immutable.
You can however create a new tuple from the old one by incrementing it's values. See jae's answer for the basics of how to do this.
You should note however that you will be creating a lot of new tuples in this loop and this may not be a very efficient ... | 1 | 1 | 0 | I have a list of tuples (each tuple item is a pair of integers) and I would like to add a constant value to each tuple in the list.
For example
[(x0,y0),(x1,y1),...] -> [(x0+xk,y0+yk),(x1+xk,y1+yk)....]
xk,yk are constants
How do I do this
Thanks | Adding a constant tuple value to a list of tuples | 0.119427 | 0 | 0 | 6,851 |
2,326,671 | 2010-02-24T14:29:00.000 | 3 | 0 | 0 | 0 | java,python,ruby-on-rails,django,enterprise | 4,030,459 | 7 | false | 1 | 0 | My company uses Python/Django as a base for our Intramas Platform. An entreprise grade web application platform that is deployed to about a dozen large clients.
Built in features include central contact management, document generator, extra security layers, default GUI for rapid application design (no messing with Dja... | 4 | 34 | 0 | I know that the word “enterprise” gives some people the creeps, but I am curious to know if anyone has experience creating enterprise applications, similar to something like say… Java EE applications, which are highly concurrent, distributed applications with Django? I know Java has its own issues but its kind of viewe... | Anyone using Django in the "Enterprise" | 0.085505 | 0 | 0 | 17,637 |
2,326,671 | 2010-02-24T14:29:00.000 | 11 | 0 | 0 | 0 | java,python,ruby-on-rails,django,enterprise | 9,905,892 | 7 | false | 1 | 0 | My Company uses Django for at least six large scale enterprises such as mercedes, adidas. we often use the Jython wrapper. The advantages are
reduced development cost compared to Java/C#
runs stable via wrappers in IIS or Tomcat/Java environments
protects our software from copycats
Therefore we are well satisfied wit... | 4 | 34 | 0 | I know that the word “enterprise” gives some people the creeps, but I am curious to know if anyone has experience creating enterprise applications, similar to something like say… Java EE applications, which are highly concurrent, distributed applications with Django? I know Java has its own issues but its kind of viewe... | Anyone using Django in the "Enterprise" | 1 | 0 | 0 | 17,637 |
2,326,671 | 2010-02-24T14:29:00.000 | 14 | 0 | 0 | 0 | java,python,ruby-on-rails,django,enterprise | 6,459,735 | 7 | false | 1 | 0 | One of the biggest drawbacks in django is that although in theory the concept of applications being self-contained sounds nice, in practice it really doesn't work that well; even if you find some app that provides functionality that you need - it is not always easy to plug it in and go - you will always need to edit/ha... | 4 | 34 | 0 | I know that the word “enterprise” gives some people the creeps, but I am curious to know if anyone has experience creating enterprise applications, similar to something like say… Java EE applications, which are highly concurrent, distributed applications with Django? I know Java has its own issues but its kind of viewe... | Anyone using Django in the "Enterprise" | 1 | 0 | 0 | 17,637 |
2,326,671 | 2010-02-24T14:29:00.000 | 7 | 0 | 0 | 0 | java,python,ruby-on-rails,django,enterprise | 2,327,568 | 7 | false | 1 | 0 | For the systems you want to replace, you may find that it is desirable to use something more powerful than Django's ORM like SQLAlchemy. It's not a question of scaling, but the fact is that Django's ORM makes it hard to build complex queries and often pushes you to do in Python what should be done by your RDBMS — when ... | 4 | 34 | 0 | I know that the word “enterprise” gives some people the creeps, but I am curious to know if anyone has experience creating enterprise applications, similar to something like say… Java EE applications, which are highly concurrent, distributed applications with Django? I know Java has its own issues but its kind of viewe... | Anyone using Django in the "Enterprise" | 1 | 0 | 0 | 17,637 |
2,326,753 | 2010-02-24T14:40:00.000 | 0 | 0 | 0 | 0 | python,printing,tkinter-canvas | 2,326,802 | 1 | false | 0 | 1 | AFAIK it can only be done using the postscript method from the Canvas. This generates a postscript file with the canvas contents.
Check the documentation for details about this method. | 1 | 1 | 0 | How would I print contents of a Python Tkinter.Canvas widget?
I've read that it's possible to print to a postscript printer from this control but examples are hard to come by.
So, any ideas what is needed to print the contents (including images)?
If you've got a cross-platform method all the better! | How to print contents of a tkinter.Canvas widget? | 0 | 0 | 0 | 1,143 |
2,327,322 | 2010-02-24T15:51:00.000 | 4 | 0 | 1 | 0 | python,coding-style | 2,327,804 | 5 | false | 0 | 0 | One reason this isn't mentioned in PEP 8 or other good Python style guides is that modifying sys.path isn't something you want to do in a real program; it makes your program less robust and portable. A better solution might be to put your package somewhere that would already be in sys.path or to define PYTHONPATH syste... | 3 | 3 | 0 | Just after standard pythonmodule imports?
If I postpone it to the main function and do my specific module imports before it, it gives error (which is quite obvious). Python Style guide no where mentions the correct location for it. | Where should sys.path.append('...') statement go? | 0.158649 | 0 | 0 | 5,554 |
2,327,322 | 2010-02-24T15:51:00.000 | 1 | 0 | 1 | 0 | python,coding-style | 2,327,364 | 5 | false | 0 | 0 | I often use a shell script to launch my python applications: I put my sys.path.insert (append) statement just after the "standard" python module imports in my "launch python script".
Using sys.path.insert(0, ...) gets your "imports" in priority in the path list. | 3 | 3 | 0 | Just after standard pythonmodule imports?
If I postpone it to the main function and do my specific module imports before it, it gives error (which is quite obvious). Python Style guide no where mentions the correct location for it. | Where should sys.path.append('...') statement go? | 0.039979 | 0 | 0 | 5,554 |
2,327,322 | 2010-02-24T15:51:00.000 | 0 | 0 | 1 | 0 | python,coding-style | 2,327,360 | 5 | false | 0 | 0 | I generally do it before importing anything. If you're worried that your module names might conflict with the Python stdlib names, then change your module names! | 3 | 3 | 0 | Just after standard pythonmodule imports?
If I postpone it to the main function and do my specific module imports before it, it gives error (which is quite obvious). Python Style guide no where mentions the correct location for it. | Where should sys.path.append('...') statement go? | 0 | 0 | 0 | 5,554 |
2,327,355 | 2010-02-24T15:54:00.000 | 15 | 0 | 0 | 0 | python,django,mod-wsgi,wsgi,django-wsgi | 2,327,403 | 3 | true | 1 | 0 | wsgi is usually preferred because it decouples your choice of framework from your choice of web server: if tomorrow you want to move, say, from Apache to nginx, or whatever, the move is trivially easy with wsgi, not so easy otherwise.
Furthermore, using wsgi affords you the option to add some middleware that's framewor... | 2 | 7 | 0 | We are deploying django application, I found in the documentation that it is recommended to use WSGI appoach for doing that.
Before deploying I wanted to know, why it is recommended over other two approaches i.e. using mod_python and fastcgi...
Thanks a lot. | It is said best way to deploy django is using wsgi, I am wondering why? | 1.2 | 0 | 0 | 1,155 |
2,327,355 | 2010-02-24T15:54:00.000 | 5 | 0 | 0 | 0 | python,django,mod-wsgi,wsgi,django-wsgi | 2,327,392 | 3 | false | 1 | 0 | We tried mod_python. It's slower and harder to configure. It doesn't offer the daemon feature.
We couldn't get fast_cgi built for our combination of Apache, Red Hat and Python. I'm not sure specifically what was wrong, but we couldn't get it built properly. It wouldn't dispatch requests to Django properly, and we c... | 2 | 7 | 0 | We are deploying django application, I found in the documentation that it is recommended to use WSGI appoach for doing that.
Before deploying I wanted to know, why it is recommended over other two approaches i.e. using mod_python and fastcgi...
Thanks a lot. | It is said best way to deploy django is using wsgi, I am wondering why? | 0.321513 | 0 | 0 | 1,155 |
2,327,813 | 2010-02-24T16:57:00.000 | 9 | 0 | 1 | 0 | python,android,gps,filtering | 2,327,837 | 1 | true | 0 | 0 | Except using rather complicated data signal processing techniques, or by using an accelerometer and dead reckoning (which is highly inaccurate), a GPS device cannot measure its own velocity. Due to this, the velocity data provided by a GPS unit is interpolated using the exact same method you want to use. The two probab... | 1 | 7 | 0 | I am currently developing an application that receives GPS data gathered using and android phone. I need to analyze that data in terms of speed, acceleration, etc...
My question is: Can I trust the speed values returned by the phone? Or should I use the difference in position and time between two points to get the valu... | How to best use GPS data? | 1.2 | 0 | 0 | 1,316 |
2,328,185 | 2010-02-24T17:45:00.000 | 0 | 0 | 0 | 0 | python,django,translation,gettext,django-multilingual | 17,742,639 | 9 | false | 1 | 0 | Another cause can be a wrong directory structure.
Read well the manage command's error message about which directory to create before running the makemassages command for the app translation. (It must be locale for an app, not conf/locale.) Note that the management commands work fine even with the wrong directory struc... | 5 | 26 | 0 | I am making a multilingual Django website. I created a messages file, populated and compiled it. I checked the site (the admin in this case,) in my wanted language (Hebrew) and most phrases appear in Hebrew like they should, but some don't. I checked the source and these still appear as _('Whatever') like they should, ... | Django i18n: Common causes for translations not appearing | 0 | 0 | 0 | 9,733 |
2,328,185 | 2010-02-24T17:45:00.000 | 0 | 0 | 0 | 0 | python,django,translation,gettext,django-multilingual | 18,593,863 | 9 | false | 1 | 0 | I noticed that when I had % in my text, the translated text was not being used. There may be other characters that can cause this problem. I fixed the problem by escaping the % as %%. | 5 | 26 | 0 | I am making a multilingual Django website. I created a messages file, populated and compiled it. I checked the site (the admin in this case,) in my wanted language (Hebrew) and most phrases appear in Hebrew like they should, but some don't. I checked the source and these still appear as _('Whatever') like they should, ... | Django i18n: Common causes for translations not appearing | 0 | 0 | 0 | 9,733 |
2,328,185 | 2010-02-24T17:45:00.000 | 0 | 0 | 0 | 0 | python,django,translation,gettext,django-multilingual | 65,446,782 | 9 | false | 1 | 0 | My answer here, all my translations were working except for 2 DateFields that I was using in a ModelForm.
Turns out that I had a widget in my forms.py that was not working well with the translations.
I just removed it for now so I can enjoy Xmas =D | 5 | 26 | 0 | I am making a multilingual Django website. I created a messages file, populated and compiled it. I checked the site (the admin in this case,) in my wanted language (Hebrew) and most phrases appear in Hebrew like they should, but some don't. I checked the source and these still appear as _('Whatever') like they should, ... | Django i18n: Common causes for translations not appearing | 0 | 0 | 0 | 9,733 |
2,328,185 | 2010-02-24T17:45:00.000 | 37 | 0 | 0 | 0 | python,django,translation,gettext,django-multilingual | 2,381,694 | 9 | true | 1 | 0 | Maybe the translated strings are marked as fuzzy? | 5 | 26 | 0 | I am making a multilingual Django website. I created a messages file, populated and compiled it. I checked the site (the admin in this case,) in my wanted language (Hebrew) and most phrases appear in Hebrew like they should, but some don't. I checked the source and these still appear as _('Whatever') like they should, ... | Django i18n: Common causes for translations not appearing | 1.2 | 0 | 0 | 9,733 |
2,328,185 | 2010-02-24T17:45:00.000 | 8 | 0 | 0 | 0 | python,django,translation,gettext,django-multilingual | 4,087,770 | 9 | false | 1 | 0 | Hi just attach some fixes I had to do in the past:
Restart the webserver!
In the setting file
- USE_I18N = True is needed
django.middleware.locale.LocaleMiddleware among middleware modules (but this is not your case for sure as long as Django will not care about your local at all)
django.core.context_processors.i18n... | 5 | 26 | 0 | I am making a multilingual Django website. I created a messages file, populated and compiled it. I checked the site (the admin in this case,) in my wanted language (Hebrew) and most phrases appear in Hebrew like they should, but some don't. I checked the source and these still appear as _('Whatever') like they should, ... | Django i18n: Common causes for translations not appearing | 1 | 0 | 0 | 9,733 |
2,328,230 | 2010-02-24T17:53:00.000 | 0 | 0 | 1 | 0 | java,python | 2,328,658 | 12 | false | 0 | 0 | Charlie, being a new hire and all, you shouldn't really decide on which technology to code the project. This is a management decision.
In fact, even though team skill can be used to determine the technology of choice for one or other project, there are many other, more important, things to take into account.
Which te... | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 0 | 0 | 1 | 0 | java,python | 3,258,221 | 12 | false | 0 | 0 | My personal preference is to learn new languages on personal projects, and use tools I already understand on professional projects. So if it was me, I'd do the project in Java, and do a few little Python projects at home.
But of course, you learn a lot more a lot faster when you are using a new language "for real" for... | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 1 | 0 | 1 | 0 | java,python | 2,328,518 | 12 | false | 0 | 0 | Generally, if I'm not familiar with a language, I allow at least a month to get somewhat comfortable with it. Two or three months if it's outside my "comfort zone" of C-like languages. Having said that, I think Java and Python are similar enough that you might trim that a bit.
Also, based on your own history, how goo... | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0.016665 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 1 | 0 | 1 | 0 | java,python | 2,328,430 | 12 | false | 0 | 0 | I'd say if you want to avoid possible headaches, do it in Java and learn Python at home, by trying to re-create a similar application to the one you do at work, if you want something which feels real. It's likely that if you arent familiar with Python you arent going to take advantage of its capabilities anyway. Once I... | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0.016665 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 5 | 0 | 1 | 0 | java,python | 2,328,250 | 12 | false | 0 | 0 | My boss's rule of thumb is any time there's a learning curve, it can triple the time to write the application. So, if Java would take you two weeks, then Python may take about 6. | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0.083141 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 7 | 0 | 1 | 0 | java,python | 2,328,364 | 12 | false | 0 | 0 | You have roughly 5 weeks to complete the project. If you're confident the Java version would take 2 weeks, that leaves 3 weeks to flail around with the Python version until you have to give up. I say go for it. Python is relatively easy to pick up. I think three weeks of work is enough to time to know whether you c... | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 1 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 4 | 0 | 1 | 0 | java,python | 2,328,292 | 12 | false | 0 | 0 | It always take longer than you think.
Try writing a small program doing just a bit of what you need. If you are to write a program with a GUI then make small program showing a frame with Hello World and an Ok-button and see how hard that is. | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0.066568 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 0 | 0 | 1 | 0 | java,python | 2,328,316 | 12 | false | 0 | 0 | Are you just programming or are you designing/architecting?
If you are coding according to a design that an experienced Python resource has layed-out then I'd give myself 3-4 times as long since you've described this as a small, fairly simple project.
If you are designing/architecting this yourself then you're taking... | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 2 | 0 | 1 | 0 | java,python | 2,328,426 | 12 | false | 0 | 0 | If you Google for "Pythonic", you'll find a lot of discussion about how to do things in ways that fit well in Python, will be easy to understand by other Python users, and so on. It always takes a while to progress from code that simply works in a language to using that language well -- and in the case of Python, that ... | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0.033321 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 3 | 0 | 1 | 0 | java,python | 2,328,275 | 12 | false | 0 | 0 | Python is like baby java, you'll pick it up in a breeze. | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0.049958 | 0 | 0 | 670 |
2,328,230 | 2010-02-24T17:53:00.000 | 2 | 0 | 1 | 0 | java,python | 2,328,330 | 12 | false | 0 | 0 | Well I would say how fast you pick up Python also depends on what other languages you know(or comfortable) apart from Java. If the only language you know is Java then I don't think the switch from Java to Python would be intuitive or smooth. To start with Java is statically typed and Python is dynamically typed, and it... | 11 | 13 | 0 | I'm a relatively new hire, and I'm starting on a small, fairly simple project. The language that this project will be implemented in is still to be determined. The question basically boils down to - Java or Python?
Here's the dilemma: My manager would prefer it to be done in Python. I don't object to that, but I have ... | How much leeway do I have to leave myself to learn a new language? | 0.033321 | 0 | 0 | 670 |
2,328,767 | 2010-02-24T19:15:00.000 | 4 | 0 | 0 | 0 | python,django | 2,328,803 | 3 | false | 1 | 0 | Use forms for all data validation. Bulk loading, batch processing, web services, everything.
At first, it seems odd to read a CSV file, populate a Form, and then have the Form validate the data and build the database object. But that's the way it's supposed to work. Use the Forms for all validation no matter what ... | 2 | 2 | 0 | In other words, what did you not know when you started with Django that you wish someone had told you?
I've dabbled some in Django but nothing really serious. However, I'm hoping to change that, and I'm wondering if there's any gotchas/shortcomings/whatever that I need to be aware of as I go. | Any potential gotchas or things to be aware of for a newcomer to Django? | 0.26052 | 0 | 0 | 145 |
2,328,767 | 2010-02-24T19:15:00.000 | 4 | 0 | 0 | 0 | python,django | 2,328,793 | 3 | false | 1 | 0 | You can't process data in templates. There are a fair number of questions in SO from people trying to do "real" processing in the templates. The Django template language is -- intentionally -- not JSP or ASP or PHP. It just does presentation and retrieval of values computed in view functions.
If you can't figure out... | 2 | 2 | 0 | In other words, what did you not know when you started with Django that you wish someone had told you?
I've dabbled some in Django but nothing really serious. However, I'm hoping to change that, and I'm wondering if there's any gotchas/shortcomings/whatever that I need to be aware of as I go. | Any potential gotchas or things to be aware of for a newcomer to Django? | 0.26052 | 0 | 0 | 145 |
2,329,417 | 2010-02-24T20:51:00.000 | 0 | 1 | 0 | 0 | python,optimization | 2,330,250 | 9 | false | 0 | 0 | I think there was a somewhat similar if not exactly the same type of question asked here. Reading (and writing) line by line is slow, but you can read a bigger chunk into memory at once, go through that line by line skipping lines you don't want, then writing this as a single chunk to a new file. Repeat until done. Fin... | 2 | 25 | 0 | I am working with a very large (~11GB) text file on a Linux system. I am running it through a program which is checking the file for errors. Once an error is found, I need to either fix the line or remove the line entirely. And then repeat...
Eventually once I'm comfortable with the process, I'll automate it entirel... | Fastest Way to Delete a Line from Large File in Python | 0 | 0 | 0 | 16,660 |
2,329,417 | 2010-02-24T20:51:00.000 | 1 | 1 | 0 | 0 | python,optimization | 2,329,515 | 9 | false | 0 | 0 | If the lines are variable length then I don't believe that there is a better algorithm than reading the file line by line and writing out all lines, except for the one(s) that you do not want.
You can identify these lines by checking some criteria, or by keeping a running tally of lines read and suppressing the writing... | 2 | 25 | 0 | I am working with a very large (~11GB) text file on a Linux system. I am running it through a program which is checking the file for errors. Once an error is found, I need to either fix the line or remove the line entirely. And then repeat...
Eventually once I'm comfortable with the process, I'll automate it entirel... | Fastest Way to Delete a Line from Large File in Python | 0.022219 | 0 | 0 | 16,660 |
2,329,627 | 2010-02-24T21:20:00.000 | 2 | 0 | 0 | 0 | python,ajax,django,session,reverse-ajax | 2,329,704 | 2 | true | 1 | 0 | A database table for this would put a load on your server, as you said, but might be useful if you want to keep a record of these requests for whatever reason.
Using something like memcached or an AMQP server might give you better performance. If you like you could even use a higher-performance key-value-store such as ... | 1 | 0 | 0 | I want to make it that one user on the site can chat request another user on my Django site. I want the requestee to get a realtime box that say: "Do you want to chat?"
How does the following client polling approach sound:
user1 clicks on users2 nickname, generating a POST request to some /message/requests, which creat... | Client polling (reverse AJAX) for chat requests in Django? | 1.2 | 0 | 0 | 1,063 |
2,330,278 | 2010-02-24T22:51:00.000 | 3 | 0 | 0 | 0 | python,mysql,database,stored-procedures,sqlalchemy | 2,338,360 | 1 | true | 0 | 0 | SQLAlchemy doesn't have any good way to convert inserts, updates and deletes to stored procedure calls. It probably wouldn't be that hard to add the capability to have instead_{update,insert,delete} extensions on mappers, but no one has bothered yet. I consider the requirement to have simple DML statements go through s... | 1 | 4 | 0 | I am developing a Python web app using sqlalchemy to communicate with mysql database. So far I have mostly been using sqlalchemy's ORM layer to speak with the database. The greatest benefit to me of ORM has been the speed of development, not having to write all these sql queries and then map them to models.
Recently, h... | Keeping ORM with stored procedures | 1.2 | 1 | 0 | 1,754 |
2,330,344 | 2010-02-24T23:02:00.000 | 13 | 0 | 0 | 0 | python,sqlite | 2,330,380 | 8 | false | 0 | 0 | You're not obliged to call close() on the cursor; it can be garbage collected like any other object.
But even if waiting for garbage collection sounds OK, I think it would be good style still to ensure that a resource such as a database cursor gets closed whether or not there is an exception. | 3 | 48 | 0 | Here is the scenario. In your function you're executing statements using a cursor, but one of them fails and an exception is thrown. Your program exits out of the function before closing the cursor it was working with. Will the cursor float around taking up space? Do I have to close the cursor?
Additionally, the Py... | In Python with sqlite is it necessary to close a cursor? | 1 | 1 | 0 | 27,863 |
2,330,344 | 2010-02-24T23:02:00.000 | 7 | 0 | 0 | 0 | python,sqlite | 2,416,354 | 8 | false | 0 | 0 | I haven't seen any effect for the sqlite3.Cursor.close() operation yet.
After closing, you can still call fetch(all|one|many) which will return the remaining results from the previous execute statement. Even running Cursor.execute() still works ... | 3 | 48 | 0 | Here is the scenario. In your function you're executing statements using a cursor, but one of them fails and an exception is thrown. Your program exits out of the function before closing the cursor it was working with. Will the cursor float around taking up space? Do I have to close the cursor?
Additionally, the Py... | In Python with sqlite is it necessary to close a cursor? | 1 | 1 | 0 | 27,863 |
2,330,344 | 2010-02-24T23:02:00.000 | 0 | 0 | 0 | 0 | python,sqlite | 71,683,829 | 8 | false | 0 | 0 | Yes, we should close our cursor. I once encountered an error when I used my cursor to configure my connection object: 'PRAGMA synchronous=off' and 'PRAGMA journal_mode=off' for faster insertion. Once I closed the cursor, the error went away. I forgot what type of error I encountered. | 3 | 48 | 0 | Here is the scenario. In your function you're executing statements using a cursor, but one of them fails and an exception is thrown. Your program exits out of the function before closing the cursor it was working with. Will the cursor float around taking up space? Do I have to close the cursor?
Additionally, the Py... | In Python with sqlite is it necessary to close a cursor? | 0 | 1 | 0 | 27,863 |
2,330,393 | 2010-02-24T23:11:00.000 | 3 | 0 | 1 | 0 | python,macos,title,menubar | 2,330,448 | 2 | false | 0 | 0 | Since your program is interpreted by Python, then what actually is run is Python itself - the interpreter program. You would have to have your Python script merged with Python into a single executable and that would be able to have a separate name. For windows there is py2exe, that does that, but I have no idea if ther... | 1 | 9 | 0 | I have been building a large python program for a while, and would like to know how I would go about setting the title of the program? On a mac the title of program, which has focus, is shown in the top left corner of the screen, next the apple menu. Currently this only shows the word "Python", but I would of course li... | How to set the program title in python | 0.291313 | 0 | 0 | 12,479 |
2,330,587 | 2010-02-24T23:53:00.000 | 9 | 0 | 1 | 0 | python,ctypes | 2,330,623 | 3 | false | 0 | 0 | Use the 'value' attribute of c_long object.
c_long(1).value
or
i = c_long(1)
print i.value | 1 | 33 | 0 | int(c_long(1)) doesn't work. | How to convert ctypes' c_long to Python's int? | 1 | 0 | 0 | 27,835 |
2,330,857 | 2010-02-25T01:00:00.000 | 0 | 1 | 0 | 0 | python | 2,330,884 | 3 | false | 0 | 0 | For a simple-to-code method, I suggest using ast.parse() or eval() to create a dictionary from your string, and then accessing the fields as usual. The difference between the two functions above is that ast.parse can only evaluate base types, and is therefore more secure if someone can give you a string that could cont... | 1 | 1 | 0 | i have a string
'''
{"session_key":"3.KbRiifBOxY_0ouPag6__.3600.1267063200-16423986","uid":164
23386,"expires":12673200,"secret":"sm7WM_rRtjzXeOT_jDoQ__","sig":"6a6aeb66
64a1679bbeed4282154b35"}
'''
how to get the value .
thanks | which is the best way to get the value of 'session_key','uid','expires' | 0 | 0 | 1 | 115 |
2,334,402 | 2010-02-25T13:54:00.000 | 0 | 0 | 0 | 0 | python,django,django-multilingual | 2,336,824 | 2 | true | 1 | 0 | Maybe you don't have to override anything. You can just check on the first page, (or maybe every page) if the user already has a language cookie and otherwise redirect him to the set_language redirect view. In that way you could force the language to Hebrew.
If the user decides to change back to English, he can do it ... | 1 | 0 | 0 | I'm developing a multilingual Django website. It has two languages, English and Hebrew. I want the default language for every first-time visitor to be Hebrew, regardless of what his browser's Accept-Language is.
Of course, if he changes language to English (and thus gets the language cookie or the key in the session), ... | Customizing the language-guessing algorithm in Django | 1.2 | 0 | 0 | 269 |
2,334,754 | 2010-02-25T14:41:00.000 | 1 | 0 | 0 | 1 | python,windows,dll,distutils,dllexport | 2,334,890 | 1 | false | 0 | 0 | You can pass ['-Wl,--export-all-symbols'] as extra_link_args if you're using Mingw's GCC. There's probably a similar setting for Visual, somewhere in the IDE.
This works only if distutils chooses to use "gcc -mdll" as a linker instead of "dllwrap". It does so if your ld version is later than 2.10.90, which should be th... | 1 | 0 | 0 | I'm abusing distutils to compile an extension module for Python, but rather than using the Python C API I'm using ctypes to talk to the resulting shared library.
This works fine in Linux because it automatically exports all symbols in a shared library, but in Windows distutils provides a .def to export only the Python ... | Can distutils use a custom .def to expose extra symbols when it compiles a Windows .dll? | 0.197375 | 0 | 0 | 207 |
2,335,384 | 2010-02-25T15:56:00.000 | 2 | 1 | 0 | 0 | python,django,email | 2,335,399 | 5 | false | 1 | 0 | So how does PHP do it? By magic?
If you don't have an SMTP server, sign up for a GMail account and use that. | 1 | 8 | 0 | As far as I read, Django only supports sending mails using SMTP.
I would like to send Emails from my script in Django, but do not want to setup SMTP server (it's too complex for me, I'm a linux newbie).
Is it possible, to send mails in Django in the same way like I do it in PHP, without providing SMTP login, password a... | Send Email in Django without SMTP server. Like php mail() function does | 0.07983 | 0 | 0 | 7,844 |
2,336,822 | 2010-02-25T19:10:00.000 | 3 | 0 | 0 | 0 | python,amazon-simpledb | 2,336,902 | 1 | true | 0 | 0 | I've found boto to be effective and straight forward and I've never had any trouble with queries with limits. Although I've never used the sixapart module. | 1 | 4 | 0 | I'm writing a python script to select, insert, update, and delete data in SimpleDB.
I've been using the simpledb module written by sixapart so far, and it's working pretty well.
I've found one potential bug/feature that is problematic for me when running select queries with "limit", and I'm thinking of trying it with t... | What's the best module to access SimpleDB in python? | 1.2 | 1 | 0 | 833 |
2,338,951 | 2010-02-26T01:32:00.000 | 0 | 0 | 1 | 1 | python,windows,py2exe | 2,338,973 | 4 | false | 0 | 0 | Not really understand your requirement, but you can try start /MIN. type start /? on the command line to see its help page. | 1 | 6 | 0 | Could someone explain to me how can I run my py2exe program, a console program, without the terminal on Windows?
I'm trying to make a program that re-sizes windows and it supposed to start with windows, so I want it hide out but still running... | How can I run a py2exe program in windows without the terminal? | 0 | 0 | 0 | 3,511 |
2,339,436 | 2010-02-26T04:08:00.000 | -3 | 0 | 0 | 0 | python,django,url,friendly-url,slug | 2,340,258 | 3 | false | 1 | 0 | With all due respect to Stackoverflow, this is the wrong way to do it. You shouldn't need to have two elements in the URL that identify the page. The ID is irrelevant - it's junk. You should be able to uniquely identify a page from the slug alone. | 1 | 6 | 0 | I'm creating a video site. I want my direct urls to a video to look like example.com/watch/this-is-a-slug-1 where 1 is the video id. I don't want the slug to matter though. example.com/watch/this-is-another-slug-1 should point to the same page. On SO, /questions/id is the only part of the url that matters. How can I do... | How can I make URLs in Django similar to stackoverflow? | -0.197375 | 0 | 0 | 826 |
2,339,725 | 2010-02-26T05:46:00.000 | 1 | 0 | 0 | 1 | python,linux,django,ubuntu | 2,339,784 | 4 | false | 0 | 0 | The problem with a cron job is that it will start every so often regardless of whether the previous instance is finished. What I would recommend is to have your script start a new instance of itself after a certain amount of time, then exit. | 1 | 4 | 0 | Hi I have a Django script that I need to run,
I think the commands could be called through bash.
Thing is the script causes memory leaks after a long a period of time, so I would like to create an external cron job which calls the Python script. So the script would terminate and restart while retaking the lost memory.
... | Creating a Cron Job - Linux / Python | 0.049958 | 0 | 0 | 8,197 |
2,339,742 | 2010-02-26T05:51:00.000 | 0 | 0 | 0 | 0 | python,http,post,cgi,get | 2,790,879 | 3 | true | 0 | 0 | Yes, there is only one transmission of data between server and client.
The context of the passage was referring to communication between web server and cgi application. Server communication between the web server and the cgi application using POST happens in two separate transfers. The request for the python script is ... | 2 | 2 | 0 | I found the quoted text in Programming Python 3rd edition by Mark Lutz from Chapter 16: Server-Side Scripting (page 987):
Forms also include a method option to specify the encoding style to be used to send data over a socket to the target server machine. Here, we use the post style, which contacts the server and then ... | HTTP POST Requests require multiple transmissions? | 1.2 | 0 | 1 | 372 |
2,339,742 | 2010-02-26T05:51:00.000 | 1 | 0 | 0 | 0 | python,http,post,cgi,get | 2,339,754 | 3 | false | 0 | 0 | Simple POST request is in single step. but when you are uploading a file, than the form is posted in multiple parts. In that case, the content type application/x-www-form-urlencoded is changed to multipart/form-data. | 2 | 2 | 0 | I found the quoted text in Programming Python 3rd edition by Mark Lutz from Chapter 16: Server-Side Scripting (page 987):
Forms also include a method option to specify the encoding style to be used to send data over a socket to the target server machine. Here, we use the post style, which contacts the server and then ... | HTTP POST Requests require multiple transmissions? | 0.066568 | 0 | 1 | 372 |
2,340,150 | 2010-02-26T07:47:00.000 | 6 | 0 | 1 | 1 | python,windows,ruby,default | 2,340,173 | 7 | true | 0 | 0 | Microsoft makes it pretty obvious they want you to use their version of everything. So what is in it for them to have Python or any other language as part of their Windows operating system?
They want you to program for Microsoft Internet Explorer using Microsoft Active Server Pages with Microsoft Visual Basic on M... | 4 | 2 | 0 | Or any other normal scripting language for that matter. I know there is VBScript and JScript. But I don't really like those for any kind of computing.
I would really love to have python or ruby (or perl) interpreter installed with windows by default so when I write small console applications I wouldn't need to distribu... | Why isn't Python installed on Windows by default? | 1.2 | 0 | 0 | 2,554 |
2,340,150 | 2010-02-26T07:47:00.000 | 1 | 0 | 1 | 1 | python,windows,ruby,default | 2,340,241 | 7 | false | 0 | 0 | Firstly, Windows doesn't need them to run, and to be honest, most people buying Windows have no knowledge of - let alone interest in - scripting languages.
It then comes down to ownership and support. There's nothing ships as part of a default Windows installation which isn't owned, designed and developed by Microsoft.... | 4 | 2 | 0 | Or any other normal scripting language for that matter. I know there is VBScript and JScript. But I don't really like those for any kind of computing.
I would really love to have python or ruby (or perl) interpreter installed with windows by default so when I write small console applications I wouldn't need to distribu... | Why isn't Python installed on Windows by default? | 0.028564 | 0 | 0 | 2,554 |
2,340,150 | 2010-02-26T07:47:00.000 | 2 | 0 | 1 | 1 | python,windows,ruby,default | 2,340,169 | 7 | false | 0 | 0 | You could create your own Windows Installation-Disc with the wished script or programming language installed on default..
Perhaps search on SuperUser.com (or Google) for this matter. | 4 | 2 | 0 | Or any other normal scripting language for that matter. I know there is VBScript and JScript. But I don't really like those for any kind of computing.
I would really love to have python or ruby (or perl) interpreter installed with windows by default so when I write small console applications I wouldn't need to distribu... | Why isn't Python installed on Windows by default? | 0.057081 | 0 | 0 | 2,554 |
2,340,150 | 2010-02-26T07:47:00.000 | 1 | 0 | 1 | 1 | python,windows,ruby,default | 2,340,164 | 7 | false | 0 | 0 | Because Windows doesn't need those languages to run, by default ?
(While, for instance, many basic Linux utilities depend on some script-languages, like Perl)
I would add that JScript and VBScript have been implemted by Microsoft -- so Microsoft can distribute their implementation ; on the other hand, there is no Micro... | 4 | 2 | 0 | Or any other normal scripting language for that matter. I know there is VBScript and JScript. But I don't really like those for any kind of computing.
I would really love to have python or ruby (or perl) interpreter installed with windows by default so when I write small console applications I wouldn't need to distribu... | Why isn't Python installed on Windows by default? | 0.028564 | 0 | 0 | 2,554 |
2,341,011 | 2010-02-26T10:52:00.000 | 2 | 0 | 1 | 0 | python,svn,pre-commit-hook | 2,341,097 | 2 | false | 0 | 0 | The preferred tab usage in Python is no tab usage at all (use four spaces for indentation). If that is your coding style then the problem may be reduced to checking if there are any tabs in the code. And this can be easily done with simple regexp, even with 'grep', so there is no even need to run the interpreter.
The '... | 1 | 4 | 0 | The Python interpreter can be started with -tt to raise a TabError exception if the interpreted file has inconsistent tab usage.
I'm trying to write a pre-commit hook for SVN that rejects files that raise this exception. I can pass the file being committed to python -tt but my problem is that the file is also executed,... | SVN pre-commit hook to reject Python files with inconsistent tab usage | 0.197375 | 0 | 0 | 1,290 |
2,342,033 | 2010-02-26T13:50:00.000 | 0 | 0 | 0 | 0 | python,ruby-on-rails,model-view-controller | 2,342,211 | 4 | false | 1 | 0 | It depends on how you are planning on implementing the scraper. If you are going to have a UI where you click a button to scrape a screen then it is going to be in all three (M, V, and C). If it is going to be a background process (like mentioned before) it should be in M and C. | 3 | 1 | 0 | In a MVC patterned framework where would a screen-scraping module most logically be located? In the model or the controller? Or is it completely outside of this pattern? | In a MVC patterned framework where would a screen-scraping module be located? | 0 | 0 | 0 | 643 |
2,342,033 | 2010-02-26T13:50:00.000 | 0 | 0 | 0 | 0 | python,ruby-on-rails,model-view-controller | 2,342,064 | 4 | false | 1 | 0 | In a sense, the screen-scraper is the user of the application -- I'd think it would be a piece outside the MVC that interacts with the controller, just like a web page sends information to the controller. This would make it easy to put a web page over it if the interface changes. | 3 | 1 | 0 | In a MVC patterned framework where would a screen-scraping module most logically be located? In the model or the controller? Or is it completely outside of this pattern? | In a MVC patterned framework where would a screen-scraping module be located? | 0 | 0 | 0 | 643 |
2,342,033 | 2010-02-26T13:50:00.000 | 0 | 0 | 0 | 0 | python,ruby-on-rails,model-view-controller | 2,342,101 | 4 | false | 1 | 0 | I presume the scraper is only used to collect data.
if the data is scraped and stored, this process does not simply drop into either M V or C. You could run this scrapping process as a cron job on intervals you define, store the data and then define models to access the data.
i wouldn't recommend calling the scrapping ... | 3 | 1 | 0 | In a MVC patterned framework where would a screen-scraping module most logically be located? In the model or the controller? Or is it completely outside of this pattern? | In a MVC patterned framework where would a screen-scraping module be located? | 0 | 0 | 0 | 643 |
2,343,053 | 2010-02-26T16:24:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,django-south | 2,344,046 | 3 | true | 1 | 0 | You seem to be very confused, unfortunately. Of course Django reads the code in models.py - otherwise what would be the point of it? Django uses that code initially to define the model SQL when doing syncdb, but it doesn't modify existing database tables in subsequent calls to syncdb - hence the need for South.
But nat... | 3 | 0 | 0 | I added some models in my models.py and I want to add an admin class to use a wysiwyg-editor in text-fields.
Well, I know that Django itself doesn't support migrations and I've used South, but it doesn't work either.
South doesn't "see" the change.
... | How to add an Admin class to a model after syncdb? | 1.2 | 0 | 0 | 187 |
2,343,053 | 2010-02-26T16:24:00.000 | 1 | 0 | 0 | 0 | python,django,django-models,django-south | 2,343,100 | 3 | false | 1 | 0 | I'm fairly sure that if you follow the steps as outlined in the tutorial to create an admin app it'll just work. Migration isn't an issue as the admin app creates new tables rather than altering the existing one. | 3 | 0 | 0 | I added some models in my models.py and I want to add an admin class to use a wysiwyg-editor in text-fields.
Well, I know that Django itself doesn't support migrations and I've used South, but it doesn't work either.
South doesn't "see" the change.
... | How to add an Admin class to a model after syncdb? | 0.066568 | 0 | 0 | 187 |
2,343,053 | 2010-02-26T16:24:00.000 | 2 | 0 | 0 | 0 | python,django,django-models,django-south | 2,343,087 | 3 | false | 1 | 0 | syncdb and South are only concerned with descendants of Model in apps listed in INSTALLED_APPS. Everything else is handled by Django directly. | 3 | 0 | 0 | I added some models in my models.py and I want to add an admin class to use a wysiwyg-editor in text-fields.
Well, I know that Django itself doesn't support migrations and I've used South, but it doesn't work either.
South doesn't "see" the change.
... | How to add an Admin class to a model after syncdb? | 0.132549 | 0 | 0 | 187 |
2,343,311 | 2010-02-26T16:58:00.000 | 3 | 0 | 1 | 0 | python,import,packages | 2,343,376 | 2 | false | 0 | 0 | Your problem is that your top package is not in your sys.path. | 1 | 0 | 0 | I am about at wits end with what should be an extremely simple issue. Here is the format of a simple example that I wrote to try to fix my problem. I have a folder top with __all__ = ["p1","p2"] in __init__.py . I then have sub-folders p1 and p2 with __init__.py in both of them with __all__ again defined with the names... | Python sub-package references | 0.291313 | 0 | 0 | 1,581 |
2,344,081 | 2010-02-26T18:56:00.000 | 0 | 1 | 0 | 0 | c++,python,boost,nlp | 7,779,679 | 5 | false | 0 | 0 | IMO go for C/C++ simply because of the 'familiar' factor. Though LOC's will be more in C/C++ you will save time in understanding and testing. | 2 | 3 | 0 | We are working on Arabic Natural Language Processing project, we have limited our choices to either write the code in Python or C++ (and Boost library). We are thinking of these points:
Python
Slower than C++ (There is ongoing work to make Python faster)
Better UTF8 support
Faster in writing tests and trying differen... | NLP project, python or C++ | 0 | 0 | 0 | 4,180 |
2,344,081 | 2010-02-26T18:56:00.000 | 2 | 1 | 0 | 0 | c++,python,boost,nlp | 2,344,099 | 5 | false | 0 | 0 | Familiar code, every programmer knows C or C-like code
Many devs are familiar with C or C-like code, it doesn't make them C++ compliant.
Unexperienced C++ devs can do a lot of harm to such a complex project and you would have to take extra care.
I can't speak for python but I heard it's more beginner-friendly.
I'd say... | 2 | 3 | 0 | We are working on Arabic Natural Language Processing project, we have limited our choices to either write the code in Python or C++ (and Boost library). We are thinking of these points:
Python
Slower than C++ (There is ongoing work to make Python faster)
Better UTF8 support
Faster in writing tests and trying differen... | NLP project, python or C++ | 0.07983 | 0 | 0 | 4,180 |
2,345,257 | 2010-02-26T22:24:00.000 | 2 | 0 | 0 | 0 | python,django,persistence | 2,345,334 | 2 | false | 1 | 0 | Consider running it in another process. You could have your Django application submit samples via a socket that the classifier process listens on, or you could run a queue and have Django submit requests to the queue. | 1 | 6 | 0 | I have a Python-based maximum entropy classifier. It's large, stored as a Pickle, and takes about a minute to unserialize. It's also not thread safe. However, it runs fast and can classify a sample (a simple Python dictionary) in a few milliseconds.
I'd like to create a basic Django web app, so users can submit samples... | Creating a Persistent Data Object In Django | 0.197375 | 0 | 0 | 5,288 |
2,345,607 | 2010-02-26T23:57:00.000 | 0 | 0 | 1 | 1 | python,windows,python-idle | 29,289,580 | 7 | false | 0 | 0 | Just add IDLE's path to your PATH environment variable.
For example I created an environment variable called IDLE_PATH and set the value to C:\Python27\Lib\idlelib
Then in my PATH variable I added ;%IDLE_PATH%; and open a new cmd prompt or in console2 just open a new tab and run idle <file_name> to open the file, you w... | 2 | 10 | 0 | I've tried many variations of this command: idle.py -e filepath, but it simply starts IDLE like normal, not opening any extra windows for editing, and not throwing any errors.
So how can I do the equivalent of opening IDLE, file>open>filepath via the command line (or perhaps even a Python module)? | starting Python IDLE from command line to edit scripts | 0 | 0 | 0 | 58,831 |
2,345,607 | 2010-02-26T23:57:00.000 | 2 | 0 | 1 | 1 | python,windows,python-idle | 39,559,184 | 7 | false | 0 | 0 | first make sure you have location of idle in path
I am using "python3.5".So mine looks like this:
C:\Program Files\Python35\Lib\idlelib.Yours may differ.
use this following command:idle -r file_name.py to run the file
or just idle file_name.py to edit
or start idle -r file_name.py ^&exit | 2 | 10 | 0 | I've tried many variations of this command: idle.py -e filepath, but it simply starts IDLE like normal, not opening any extra windows for editing, and not throwing any errors.
So how can I do the equivalent of opening IDLE, file>open>filepath via the command line (or perhaps even a Python module)? | starting Python IDLE from command line to edit scripts | 0.057081 | 0 | 0 | 58,831 |
2,348,443 | 2010-02-27T18:22:00.000 | 4 | 0 | 1 | 0 | python,django,python-imaging-library | 2,348,473 | 1 | true | 0 | 0 | Unfortunately file-likes from network functions such as urllib2.urlopen() don't support all the necessary methods, so you'll need to read the data into a StringIO or cStringIO in order to be able to pass them to Image.open(). | 1 | 2 | 0 | I'm trying to download images from URLs and pass them to PIL.
I would like to use as few resources as possible, especially RAM. What would the best way of dealing with this? I've had suggestions to use cStringIO. | Python PIL and StringIO | 1.2 | 0 | 0 | 990 |
2,348,927 | 2010-02-27T20:53:00.000 | 4 | 0 | 1 | 0 | python,configuration-files | 2,348,941 | 4 | false | 0 | 0 | The approach you describe is ok. If you want to add support for user config files, you can use execfile(os.path.expanduser("~/.yourprogram/config.py")). | 3 | 23 | 0 | I am developing a project that requires a single configuration file whose data is used by multiple modules.
My question is: what is the common approach to that? should i read the configuration file from each
of my modules (files) or is there any other way to do it?
I was thinking to have a module named config.py that r... | python single configuration file | 0.197375 | 0 | 1 | 6,382 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.