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
101,569
2008-09-19T12:47:00.000
3
0
1
0
python,algorithm,diff
101,623
10
false
0
0
You need to make your question more concrete. If you've already read the fingerprinting papers, you already know the principles at work, so describing common approaches here would not be beneficial. If you haven't, you should also check out papers on "duplicate detection" and various web spam detection related papers that have come out of Stanford, Google, Yahoo, and MS in recent years. Are you having specific problems with coding the described algorithms? Trouble getting started? The first thing I'd probably do is separate the tokenization (the process of extracting "words" or other sensible sequences) from the duplicate detection logic, so that it is easy to plug in different parsers for different languages and keep the duplicate detection piece the same.
2
10
0
I need to write a module to detect similar documents. I have read many papers of fingerprints of documents techniques and others, but I do not know how to write code or implement such a solution. The algorithm should work for Chinese, Japanese, English and German language or be language independent. How can I accomplish this?
Algorithm to detect similar documents in python script
0.059928
0
0
13,411
102,535
2008-09-19T14:58:00.000
2
0
1
0
python,generator
102,701
16
false
0
0
I use generators when our web server is acting as a proxy: The client requests a proxied url from the server The server begins to load the target url The server yields to return the results to the client as soon as it gets them
1
229
0
I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving.
What can you use generator functions for?
0.024995
0
0
95,625
104,983
2008-09-19T19:53:00.000
3
0
1
0
python,multithreading,thread-local
105,058
6
false
0
0
Just like in every other language, every thread in Python has access to the same variables. There's no distinction between the 'main thread' and child threads. One difference with Python is that the Global Interpreter Lock means that only one thread can be running Python code at a time. This isn't much help when it comes to synchronising access, however, as all the usual pre-emption issues still apply, and you have to use threading primitives just like in other languages. It does mean you need to reconsider if you were using threads for performance, however.
3
123
0
In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to avoid this sharing? I have seen many warnings about synchronizing access to shared data among threads by using locks but I have yet to see a really good example of the problem. Thanks in advance!
What is "thread local storage" in Python, and why do I need it?
0.099668
0
0
68,654
104,983
2008-09-19T19:53:00.000
1
0
1
0
python,multithreading,thread-local
70,450,414
6
false
0
0
Worth mentioning threading.local() is not a singleton. You can use more of them per thread. It is not one storage.
3
123
0
In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to avoid this sharing? I have seen many warnings about synchronizing access to shared data among threads by using locks but I have yet to see a really good example of the problem. Thanks in advance!
What is "thread local storage" in Python, and why do I need it?
0.033321
0
0
68,654
104,983
2008-09-19T19:53:00.000
1
0
1
0
python,multithreading,thread-local
60,241,832
6
false
0
0
I may be wrong here. If you know otherwise please expound as this would help explain why one would need to use thread local(). This statement seems off, not wrong: "If you want to atomically modify anything that another thread has access to, you have to protect it with a lock." I think this statement is ->effectively<- right but not entirely accurate. I thought the term "atomic" meant that the Python interpreter created a byte-code chunk that left no room for an interrupt signal to the CPU. I thought atomic operations are chunks of Python byte code that does not give access to interrupts. Python statements like "running = True" is atomic. You do not need to lock CPU from interrupts in this case (I believe). The Python byte code breakdown is safe from thread interruption. Python code like "threads_running[5] = True" is not atomic. There are two chunks of Python byte code here; one to de-reference the list() for an object and another byte code chunk to assign a value to an object, in this case a "place" in a list. An interrupt can be raised -->between<- the two byte-code ->chunks<-. That is were bad stuff happens. How does thread local() relate to "atomic"? This is why the statement seems misdirecting to me. If not can you explain?
3
123
0
In Python specifically, how do variables get shared between threads? Although I have used threading.Thread before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to avoid this sharing? I have seen many warnings about synchronizing access to shared data among threads by using locks but I have yet to see a really good example of the problem. Thanks in advance!
What is "thread local storage" in Python, and why do I need it?
0.033321
0
0
68,654
105,095
2008-09-19T20:07:00.000
1
0
1
0
python,multithreading,locking
105,127
9
false
0
0
You still need to use locks (your code could be interrupted at any time to execute another thread and this can cause data inconsistencies). The problem with GIL is that it prevents Python code from using more cores at the same time (or multiple processors if they are available).
2
79
0
If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all? If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect? sorry if this is a dumb question, but it is something I have always wondered about Python on multi-processor/core machines. same thing would apply to any other language implementation that has a GIL.
Are locks unnecessary in multi-threaded Python code because of the GIL?
0.022219
0
0
10,397
105,095
2008-09-19T20:07:00.000
25
0
1
0
python,multithreading,locking
105,145
9
false
0
0
No - the GIL just protects python internals from multiple threads altering their state. This is a very low-level of locking, sufficient only to keep python's own structures in a consistent state. It doesn't cover the application level locking you'll need to do to cover thread safety in your own code. The essence of locking is to ensure that a particular block of code is only executed by one thread. The GIL enforces this for blocks the size of a single bytecode, but usually you want the lock to span a larger block of code than this.
2
79
0
If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all? If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect? sorry if this is a dumb question, but it is something I have always wondered about Python on multi-processor/core machines. same thing would apply to any other language implementation that has a GIL.
Are locks unnecessary in multi-threaded Python code because of the GIL?
1
0
0
10,397
106,725
2008-09-20T01:39:00.000
1
0
1
1
python,tkinter,packaging
106,731
7
false
0
0
py2exe is the best way to do this. It's a bit of a PITA to use, but the end result works very well.
2
61
0
I need to package my Python application, its dependencies and Python into a single MSI installer. The end result should desirably be: Python is installed in the standard location the package and its dependencies are installed in a separate directory (possibly site-packages) the installation directory should contain the Python uncompressed and a standalone executable is not required
How to bundle a Python application including dependencies?
0.028564
0
0
58,009
106,725
2008-09-20T01:39:00.000
5
0
1
1
python,tkinter,packaging
114,717
7
false
0
0
My company uses the free InnoSetup tool. It is a moderately complex program that has tons of flexibility for building installers for windows. I believe that it creates .exe and not .msi files, however. InnoSetup is not python specific but we have created an installer for one of our products that installs python along with dependencies to locations specified by the user at install time.
2
61
0
I need to package my Python application, its dependencies and Python into a single MSI installer. The end result should desirably be: Python is installed in the standard location the package and its dependencies are installed in a separate directory (possibly site-packages) the installation directory should contain the Python uncompressed and a standalone executable is not required
How to bundle a Python application including dependencies?
0.141893
0
0
58,009
106,766
2008-09-20T01:56:00.000
7
1
0
0
python,linux,unit-testing
106,780
6
false
0
0
You have two levels of testing. Filtering and Modifying content. These are "low-level" operations that don't really require physical file I/O. These are the tests, decision-making, alternatives, etc. The "Logic" of the application. File system operations. Create, copy, rename, delete, backup. Sorry, but those are proper file system operations that -- well -- require a proper file system for testing. For this kind of testing, we often use a "Mock" object. You can design a "FileSystemOperations" class that embodies the various file system operations. You test this to be sure it does basic read, write, copy, rename, etc. There's no real logic in this. Just methods that invoke file system operations. You can then create a MockFileSystem which dummies out the various operations. You can use this Mock object to test your other classes. In some cases, all of your file system operations are in the os module. If that's the case, you can create a MockOS module with mock version of the operations you actually use. Put your MockOS module on the PYTHONPATH and you can conceal the real OS module. For production operations you use your well-tested "Logic" classes plus your FileSystemOperations class (or the real OS module.)
3
23
0
A common task in programs I've been working on lately is modifying a text file in some way. (Hey, I'm on Linux. Everything's a file. And I do large-scale system admin.) But the file the code modifies may not exist on my desktop box. And I probably don't want to modify it if it IS on my desktop. I've read about unit testing in Dive Into Python, and it's pretty clear what I want to do when testing an app that converts decimal to Roman Numerals (the example in DintoP). The testing is nicely self-contained. You don't need to verify that the program PRINTS the right thing, you just need to verify that the functions are returning the right output to a given input. In my case, however, we need to test that the program is modifying its environment correctly. Here's what I've come up with: 1) Create the "original" file in a standard location, perhaps /tmp. 2) Run the function that modifies the file, passing it the path to the file in /tmp. 3) Verify that the file in /tmp was changed correctly; pass/fail unit test accordingly. This seems kludgy to me. (Gets even kludgier if you want to verify that backup copies of the file are created properly, etc.) Has anyone come up with a better way?
Unit Testing File Modifications
1
0
0
4,799
106,766
2008-09-20T01:56:00.000
2
1
0
0
python,linux,unit-testing
106,772
6
false
0
0
When I touch files in my code, I tend to prefer to mock the actual reading and writing of the file... so then I can give my classes exact contents I want in the test, and then assert that the test is writing back the contents I expect. I've done this in Java, and I imagine it is quite simple in Python... but it may require designing your classes/functions in such a way that it is EASY to mock the use of an actual file. For this, you can try passing in streams and then just pass in a simple string input/output stream which won't write to a file, or have a function that does the actual "write this string to a file" or "read this string from a file", and then replace that function in your tests.
3
23
0
A common task in programs I've been working on lately is modifying a text file in some way. (Hey, I'm on Linux. Everything's a file. And I do large-scale system admin.) But the file the code modifies may not exist on my desktop box. And I probably don't want to modify it if it IS on my desktop. I've read about unit testing in Dive Into Python, and it's pretty clear what I want to do when testing an app that converts decimal to Roman Numerals (the example in DintoP). The testing is nicely self-contained. You don't need to verify that the program PRINTS the right thing, you just need to verify that the functions are returning the right output to a given input. In my case, however, we need to test that the program is modifying its environment correctly. Here's what I've come up with: 1) Create the "original" file in a standard location, perhaps /tmp. 2) Run the function that modifies the file, passing it the path to the file in /tmp. 3) Verify that the file in /tmp was changed correctly; pass/fail unit test accordingly. This seems kludgy to me. (Gets even kludgier if you want to verify that backup copies of the file are created properly, etc.) Has anyone come up with a better way?
Unit Testing File Modifications
0.066568
0
0
4,799
106,766
2008-09-20T01:56:00.000
1
1
0
0
python,linux,unit-testing
106,781
6
false
0
0
You might want to setup the test so that it runs inside a chroot jail, so you have all the environment the test needs, even if paths and file locations are hardcoded in the code [not really a good practice, but sometimes one gets the file locations from other places...] and then check the results via the exit code.
3
23
0
A common task in programs I've been working on lately is modifying a text file in some way. (Hey, I'm on Linux. Everything's a file. And I do large-scale system admin.) But the file the code modifies may not exist on my desktop box. And I probably don't want to modify it if it IS on my desktop. I've read about unit testing in Dive Into Python, and it's pretty clear what I want to do when testing an app that converts decimal to Roman Numerals (the example in DintoP). The testing is nicely self-contained. You don't need to verify that the program PRINTS the right thing, you just need to verify that the functions are returning the right output to a given input. In my case, however, we need to test that the program is modifying its environment correctly. Here's what I've come up with: 1) Create the "original" file in a standard location, perhaps /tmp. 2) Run the function that modifies the file, passing it the path to the file in /tmp. 3) Verify that the file in /tmp was changed correctly; pass/fail unit test accordingly. This seems kludgy to me. (Gets even kludgier if you want to verify that backup copies of the file are created properly, etc.) Has anyone come up with a better way?
Unit Testing File Modifications
0.033321
0
0
4,799
106,896
2008-09-20T03:07:00.000
10
0
1
0
python,class,project-structure
8,098,533
6
false
0
0
I find myself splitting things up when I get annoyed with the bigness of files and when the desirable structure of relatedness starts to emerge naturally. Often these two stages seem to coincide. It can be very annoying if you split things up too early, because you start to realise that a totally different ordering of structure is required. On the other hand, when any .java or .py file is getting to more than about 700 lines I start to get annoyed constantly trying to remember where "that particular bit" is. With Python/Jython circular dependency of import statements also seems to play a role: if you try to split too many cooperating basic building blocks into separate files this "restriction"/"imperfection" of the language seems to force you to group things, perhaps in rather a sensible way. As to splitting into packages, I don't really know, but I'd say probably the same rule of annoyance and emergence of happy structure works at all levels of modularity.
4
294
0
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.
Possibilities for Python classes organized across files?
1
0
0
104,646
106,896
2008-09-20T03:07:00.000
29
0
1
0
python,class,project-structure
7,879,007
6
false
0
0
I happen to like the Java model for the following reason. Placing each class in an individual file promotes reuse by making classes easier to see when browsing the source code. If you have a bunch of classes grouped into a single file, it may not be obvious to other developers that there are classes there that can be reused simply by browsing the project's directory structure. Thus, if you think that your class can possibly be reused, I would put it in its own file.
4
294
0
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.
Possibilities for Python classes organized across files?
1
0
0
104,646
106,896
2008-09-20T03:07:00.000
41
0
1
0
python,class,project-structure
106,909
6
false
0
0
Since there is no artificial limit, it really depends on what's comprehensible. If you have a bunch of fairly short, simple classes that are logically grouped together, toss in a bunch of 'em. If you have big, complex classes or classes that don't make sense as a group, go one file per class. Or pick something in between. Refactor as things change.
4
294
0
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.
Possibilities for Python classes organized across files?
1
0
0
104,646
106,896
2008-09-20T03:07:00.000
7
0
1
0
python,class,project-structure
106,903
6
false
0
0
I would say to put as many classes as can be logically grouped in that file without making it too big and complex.
4
294
0
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organizing classes.
Possibilities for Python classes organized across files?
1
0
0
104,646
107,405
2008-09-20T06:38:00.000
1
1
0
0
python,python-2.7,http,http-headers,content-type
779,985
11
false
0
0
As an aside, when using the httplib (at least on 2.5.2), trying to read the response of a HEAD request will block (on readline) and subsequently fail. If you do not issue read on the response, you are unable to send another request on the connection, you will need to open a new one. Or accept a long delay between requests.
2
117
0
What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if http://somedomain/foo/ will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download the content. Does anyone know of an easy way of doing this?
How do you send a HEAD HTTP request in Python 2?
0.01818
0
1
72,799
107,405
2008-09-20T06:38:00.000
1
1
0
0
python,python-2.7,http,http-headers,content-type
2,630,687
11
false
0
0
I have found that httplib is slightly faster than urllib2. I timed two programs - one using httplib and the other using urllib2 - sending HEAD requests to 10,000 URL's. The httplib one was faster by several minutes. httplib's total stats were: real 6m21.334s user 0m2.124s sys 0m16.372s And urllib2's total stats were: real 9m1.380s user 0m16.666s sys 0m28.565s Does anybody else have input on this?
2
117
0
What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if http://somedomain/foo/ will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download the content. Does anyone know of an easy way of doing this?
How do you send a HEAD HTTP request in Python 2?
0.01818
0
1
72,799
107,705
2008-09-20T09:17:00.000
68
0
0
1
python,stdout,buffered
107,720
16
false
0
0
Yes, it is. You can disable it on the commandline with the "-u" switch. Alternatively, you could call .flush() on sys.stdout on every write (or wrap it with an object that does this automatically)
3
621
0
Is output buffering enabled by default in Python's interpreter for sys.stdout? If the answer is positive, what are all the ways to disable it? Suggestions so far: Use the -u command line switch Wrap sys.stdout in an object that flushes after every write Set PYTHONUNBUFFERED env var sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) Is there any other way to set some global flag in sys/sys.stdout programmatically during execution?
Disable output buffering
1
0
0
341,073
107,705
2008-09-20T09:17:00.000
12
0
0
1
python,stdout,buffered
107,721
16
false
0
0
Yes, it is enabled by default. You can disable it by using the -u option on the command line when calling python.
3
621
0
Is output buffering enabled by default in Python's interpreter for sys.stdout? If the answer is positive, what are all the ways to disable it? Suggestions so far: Use the -u command line switch Wrap sys.stdout in an object that flushes after every write Set PYTHONUNBUFFERED env var sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) Is there any other way to set some global flag in sys/sys.stdout programmatically during execution?
Disable output buffering
1
0
0
341,073
107,705
2008-09-20T09:17:00.000
3
0
0
1
python,stdout,buffered
17,047,064
16
false
0
0
(I've posted a comment, but it got lost somehow. So, again:) As I noticed, CPython (at least on Linux) behaves differently depending on where the output goes. If it goes to a tty, then the output is flushed after each '\n' If it goes to a pipe/process, then it is buffered and you can use the flush() based solutions or the -u option recommended above. Slightly related to output buffering: If you iterate over the lines in the input with for line in sys.stdin: ... then the for implementation in CPython will collect the input for a while and then execute the loop body for a bunch of input lines. If your script is about to write output for each input line, this might look like output buffering but it's actually batching, and therefore, none of the flush(), etc. techniques will help that. Interestingly, you don't have this behaviour in pypy. To avoid this, you can use while True: line=sys.stdin.readline() ...
3
621
0
Is output buffering enabled by default in Python's interpreter for sys.stdout? If the answer is positive, what are all the ways to disable it? Suggestions so far: Use the -u command line switch Wrap sys.stdout in an object that flushes after every write Set PYTHONUNBUFFERED env var sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) Is there any other way to set some global flag in sys/sys.stdout programmatically during execution?
Disable output buffering
0.037482
0
0
341,073
108,822
2008-09-20T17:34:00.000
1
0
0
1
python,google-app-engine
8,444,988
19
false
1
0
Yes you can: Go to Datastore Admin, and then select the Entitiy type you want to delete and click Delete. Mapreduce will take care of deleting!
3
45
0
I would like to wipe out all data for a specific kind in Google App Engine. What is the best way to do this? I wrote a delete script (hack), but since there is so much data is timeout's out after a few hundred records.
Delete all data for a kind in Google App Engine
0.010526
0
0
29,003
108,822
2008-09-20T17:34:00.000
0
0
0
1
python,google-app-engine
2,245,189
19
false
1
0
You can use the task queues to delete chunks of say 100 objects. Deleting objects in GAE shows how limited the Admin capabilities are in GAE. You have to work with batches on 1000 entities or less. You can use the bulkloader tool that works with csv's but the documentation does not cover java. I am using GAE Java and my strategy for deletions involves having 2 servlets, one for doing the actually delete and another to load the task queues. When i want to do a delete, I run the queue loading servlet, it loads the queues and then GAE goes to work executing all the tasks in the queue. How to do it: Create a servlet that deletes a small number of objects. Add the servlet to your task queues. Go home or work on something else ;) Check the datastore every so often ... I have a datastore with about 5000 objects that i purge every week and it takes about 6 hours to clean out, so i run the task on Friday night. I use the same technique to bulk load my data which happens to be about 5000 objects, with about a dozen properties.
3
45
0
I would like to wipe out all data for a specific kind in Google App Engine. What is the best way to do this? I wrote a delete script (hack), but since there is so much data is timeout's out after a few hundred records.
Delete all data for a kind in Google App Engine
0
0
0
29,003
108,822
2008-09-20T17:34:00.000
3
0
0
1
python,google-app-engine
109,018
19
false
1
0
Unfortunately, there's no way to easily do a bulk delete. Your best bet is to write a script that deletes a reasonable number of entries per invocation, and then call it repeatedly - for example, by having your delete script return a 302 redirect whenever there's more data to delete, then fetching it with "wget --max-redirect=10000" (or some other large number).
3
45
0
I would like to wipe out all data for a specific kind in Google App Engine. What is the best way to do this? I wrote a delete script (hack), but since there is so much data is timeout's out after a few hundred records.
Delete all data for a kind in Google App Engine
0.031568
0
0
29,003
110,186
2008-09-21T03:41:00.000
6
0
0
1
python,django,google-app-engine
2,462,266
11
false
1
0
This question has been fully answered. Which is good. But one thing perhaps is worth mentioning. The google app engine has a plugin for the eclipse ide which is a joy to work with. If you already do your development with eclipse you are going to be so happy about that. To deploy on the google app engine's web site all I need to do is click one little button - with the airplane logo - super.
4
126
0
Looking to do a very small, quick 'n dirty side project. I like the fact that the Google App Engine is running on Python with Django built right in - gives me an excuse to try that platform... but my question is this: Has anyone made use of the app engine for anything other than a toy problem? I see some good example apps out there, so I would assume this is good enough for the real deal, but wanted to get some feedback. Any other success/failure notes would be great.
Feedback on using Google App Engine?
1
0
0
10,614
110,186
2008-09-21T03:41:00.000
36
0
0
1
python,django,google-app-engine
566,481
11
false
1
0
I am using GAE to host several high-traffic applications. Like on the order of 50-100 req/sec. It is great, I can't recommend it enough. My previous experience with web development was with Ruby (Rails/Merb). Learning Python was easy. I didn't mess with Django or Pylons or any other framework, just started from the GAE examples and built what I needed out of the basic webapp libraries that are provided. If you're used to the flexibility of SQL the datastore can take some getting used to. Nothing too traumatic! The biggest adjustment is moving away from JOINs. You have to shed the idea that normalizing is crucial. Ben
4
126
0
Looking to do a very small, quick 'n dirty side project. I like the fact that the Google App Engine is running on Python with Django built right in - gives me an excuse to try that platform... but my question is this: Has anyone made use of the app engine for anything other than a toy problem? I see some good example apps out there, so I would assume this is good enough for the real deal, but wanted to get some feedback. Any other success/failure notes would be great.
Feedback on using Google App Engine?
1
0
0
10,614
110,186
2008-09-21T03:41:00.000
23
0
0
1
python,django,google-app-engine
110,299
11
false
1
0
One of the compelling reasons I have come across for using Google App Engine is its integration with Google Apps for your domain. Essentially it allows you to create custom, managed web applications that are restricted to the (controlled) logins of your domain. Most of my experience with this code was building a simple time/task tracking application. The template engine was simple and yet made a multi-page application very approachable. The login/user awareness api is similarly useful. I was able to make a public page/private page paradigm without too much issue. (a user would log in to see the private pages. An anonymous user was only shown the public page.) I was just getting into the datastore portion of the project when I got pulled away for "real work". I was able to accomplish a lot (it still is not done yet) in a very little amount of time. Since I had never used Python before, this was particularly pleasant (both because it was a new language for me, and also because the development was still fast despite the new language). I ran into very little that led me to believe that I wouldn't be able to accomplish my task. Instead I have a fairly positive impression of the functionality and features. That is my experience with it. Perhaps it doesn't represent more than an unfinished toy project, but it does represent an informed trial of the platform, and I hope that helps.
4
126
0
Looking to do a very small, quick 'n dirty side project. I like the fact that the Google App Engine is running on Python with Django built right in - gives me an excuse to try that platform... but my question is this: Has anyone made use of the app engine for anything other than a toy problem? I see some good example apps out there, so I would assume this is good enough for the real deal, but wanted to get some feedback. Any other success/failure notes would be great.
Feedback on using Google App Engine?
1
0
0
10,614
110,186
2008-09-21T03:41:00.000
12
0
0
1
python,django,google-app-engine
110,225
11
false
1
0
The "App Engine running Django" idea is a bit misleading. App Engine replaces the entire Django model layer so be prepared to spend some time getting acclimated with App Engine's datastore which requires a different way of modeling and thinking about data.
4
126
0
Looking to do a very small, quick 'n dirty side project. I like the fact that the Google App Engine is running on Python with Django built right in - gives me an excuse to try that platform... but my question is this: Has anyone made use of the app engine for anything other than a toy problem? I see some good example apps out there, so I would assume this is good enough for the real deal, but wanted to get some feedback. Any other success/failure notes would be great.
Feedback on using Google App Engine?
1
0
0
10,614
110,803
2008-09-21T11:27:00.000
-1
0
0
0
python,django
1,030,155
10
false
1
0
for everyone's information, muhuk's solution fails under python2.6 as it raises an exception stating 'object.__ init __()' accepts no argument... edit: ho! apparently it might've been me misusing the the mixin... I didnt pay attention and declared it as the last parent and because of that the call to init ended up in the object parent rather than the next parent as it noramlly would with diamond diagram inheritance! so please disregard my comment :)
1
36
0
In my app i need to save changed values (old and new) when model gets saved. Any examples or working code? I need this for premoderation of content. For example, if user changes something in model, then administrator can see all changes in separate table and then decide to apply them or not.
Dirty fields in django
-0.019997
0
0
28,215
111,945
2008-09-21T20:11:00.000
8
0
0
0
python,http,put
114,648
14
false
0
0
I needed to solve this problem too a while back so that I could act as a client for a RESTful API. I settled on httplib2 because it allowed me to send PUT and DELETE in addition to GET and POST. Httplib2 is not part of the standard library but you can easily get it from the cheese shop.
1
225
0
I need to upload some data to a server using HTTP PUT in python. From my brief reading of the urllib2 docs, it only does HTTP POST. Is there any way to do an HTTP PUT in python?
Is there any way to do HTTP PUT in python
1
0
1
174,987
112,263
2008-09-21T21:45:00.000
2
0
0
0
python,tkinter,geometry,pack
112,337
4
true
0
1
The answer to your specific question is no. You can't have two states or otherwise use pack two different ways in the same parent. However, what I think you want to accomplish is simple. Use the built-in features of the canvas to create an image item that is part of the canvas, then pack things into the canvas as if it were a frame. You can accomplish a similar thing by creating a label widget with an image, then pack your other widgets into the label. One advantage to using a canvas is you can easily tile an image to fill the whole canvas with a repeating background image so as the window grows the image will continue to fill the window (of course you can just use a sufficiently large original image...)
2
2
0
I want to put a Canvas with an image in my window, and then I want to pack widgets on top of it, so the Canvas acts as a background. Is it possible to have two states for the pack manager: one for one set of widgets and another for another set?
How do I overlap widgets with the Tkinter pack geometry manager?
1.2
0
0
3,016
112,263
2008-09-21T21:45:00.000
0
0
0
0
python,tkinter,geometry,pack
112,432
4
false
0
1
Not without swapping widget trees in and out, which I don't think can be done cleanly with Tk. Other toolkits can do this a little more elegantly. COM/VB/MFC can do this with an ActiveX control - you can hide/show multiple ActiveX controls in the same region. Any of the containers will let you do this by changing the child around. If you're doing a windows-specific program you may be able to accomplish it this way. QT will also let you do this in a similar manner. GTK is slightly harder.
2
2
0
I want to put a Canvas with an image in my window, and then I want to pack widgets on top of it, so the Canvas acts as a background. Is it possible to have two states for the pack manager: one for one set of widgets and another for another set?
How do I overlap widgets with the Tkinter pack geometry manager?
0
0
0
3,016
112,483
2008-09-21T23:10:00.000
1
0
0
0
python,qt,gtk,desktop
302,298
5
false
0
1
If you consider Qt, consider also throwing in kdelibs dependency, then you'll have marble widget, which handles maps in neat way. Thanks for advertizing Marble. But you are incorrect: The Marble Widget doesn't depend on kdelibs at all. It just depends on Qt (>=4.3). Additionally Marble also has just received Python bindings. I think that the given problem can be solved using Marble. Would just take a few days of work at max. If you have questions about Marble, feel free to ask us on our mailing list or IRC.
3
1
0
I'm specifically looking for one that lets me display a map of US states with each one as it's own "object" in the sense that I can control the color, on click, and on mouseover of each one individually. GTK is my personal preference, but at this point I'd settle for just about anything. The application itself will be written in Python, FWIW.
Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?
0.039979
0
0
906
112,483
2008-09-21T23:10:00.000
2
0
0
0
python,qt,gtk,desktop
146,015
5
false
0
1
If you consider Qt, consider also throwing in kdelibs dependency, then you'll have marble widget, which handles maps in neat way. If you stick only to Qt, then QGraphicsView is a framework to go. (note: kdelibs != running whole kde desktop)
3
1
0
I'm specifically looking for one that lets me display a map of US states with each one as it's own "object" in the sense that I can control the color, on click, and on mouseover of each one individually. GTK is my personal preference, but at this point I'd settle for just about anything. The application itself will be written in Python, FWIW.
Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?
0.07983
0
0
906
112,483
2008-09-21T23:10:00.000
0
0
0
0
python,qt,gtk,desktop
122,701
5
false
0
1
Quick tip, if you color each state differently you can identify which one to pick from the color under mouse cursor rather than doing a complex point in polygon routine.
3
1
0
I'm specifically looking for one that lets me display a map of US states with each one as it's own "object" in the sense that I can control the color, on click, and on mouseover of each one individually. GTK is my personal preference, but at this point I'd settle for just about anything. The application itself will be written in Python, FWIW.
Does anyone know of a widget for a desktop toolkit(GTK, Qt, WX) for displaying a map of US states?
0
0
0
906
112,532
2008-09-21T23:28:00.000
8
0
1
0
python,list,dictionary
112,557
16
false
0
0
One of the best ways to do this is to use a directed graph to store your dictionary. It takes a little bit of setting up, but once done it is fairly easy to then do the type of searches you are talking about. The nodes in the graph correspond to a letter in your word, so each node will have one incoming link and up to 26 (in English) outgoing links. You could also use a hybrid approach where you maintain a sorted list containing your dictionary and use the directed graph as an index into your dictionary. Then you just look up your prefix in your directed graph and then go to that point in your dictionary and spit out all words matching your search criteria.
4
7
0
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string? Ex: User: "abd" Program:abdicate, abdomen, abduct... Thanks! Edit: I'm using python, but I assume that this is a fairly language-independent problem.
List all words in a dictionary that start with
1
0
0
7,082
112,532
2008-09-21T23:28:00.000
1
0
1
0
python,list,dictionary
112,541
16
false
0
0
Try using regex to search through your list of words, e.g. /^word/ and report all matches.
4
7
0
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string? Ex: User: "abd" Program:abdicate, abdomen, abduct... Thanks! Edit: I'm using python, but I assume that this is a fairly language-independent problem.
List all words in a dictionary that start with
0.012499
0
0
7,082
112,532
2008-09-21T23:28:00.000
1
0
1
0
python,list,dictionary
112,562
16
false
0
0
If you need to be really fast, use a tree: build an array and split the words in 26 sets based on the first letter, then split each item in 26 based on the second letter, then again. So if your user types "abd" you would look for Array[0][1][3] and get a list of all the words starting like that. At that point your list should be small enough to pass over to the client and use javascript to filter.
4
7
0
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string? Ex: User: "abd" Program:abdicate, abdomen, abduct... Thanks! Edit: I'm using python, but I assume that this is a fairly language-independent problem.
List all words in a dictionary that start with
0.012499
0
0
7,082
112,532
2008-09-21T23:28:00.000
0
0
1
0
python,list,dictionary
112,843
16
false
0
0
If your dictionary is really big, i'd suggest indexing with a python text index (PyLucene - note that i've never used the python extension for lucene) The search would be efficient and you could even return a search 'score'. Also, if your dictionary is relatively static you won't even have the overhead of re-indexing very often.
4
7
0
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string? Ex: User: "abd" Program:abdicate, abdomen, abduct... Thanks! Edit: I'm using python, but I assume that this is a fairly language-independent problem.
List all words in a dictionary that start with
0
0
0
7,082
112,970
2008-09-22T03:04:00.000
2
0
1
0
python,file
112,993
6
false
0
0
According to Mr Van Rossum, although open() is currently an alias for file() you should use open() because this might change in the future.
3
140
0
What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5)
Python - When to use file vs open
0.066568
0
0
89,995
112,970
2008-09-22T03:04:00.000
4
0
1
0
python,file
112,990
6
false
0
0
Only ever use open() for opening files. file() is actually being removed in 3.0, and it's deprecated at the moment. They've had a sort of strange relationship, but file() is going now, so there's no need to worry anymore. The following is from the Python 2.6 docs. [bracket stuff] added by me. When opening a file, it’s preferable to use open() instead of invoking this [file()] constructor directly. file is more suited to type testing (for example, writing isinstance(f, file)
3
140
0
What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5)
Python - When to use file vs open
0.132549
0
0
89,995
112,970
2008-09-22T03:04:00.000
33
0
1
0
python,file
112,989
6
false
0
0
Two reasons: The python philosophy of "There ought to be one way to do it" and file is going away. file is the actual type (using e.g. file('myfile.txt') is calling its constructor). open is a factory function that will return a file object. In python 3.0 file is going to move from being a built-in to being implemented by multiple classes in the io library (somewhat similar to Java with buffered readers, etc.)
3
140
0
What's the difference between file and open in Python? When should I use which one? (Say I'm in 2.5)
Python - When to use file vs open
1
0
0
89,995
114,283
2008-09-22T11:11:00.000
2
0
0
0
python,django
114,373
3
false
1
0
You could overload the get_form method of your model admin and add an extra checkbox to the generated form that has to be ticket. Alternatively you can override change_view and intercept the request.
2
9
0
I want to emulate the delete confirmation page behavior before saving certain models in the admin. In my case if I change one object, certain others should be deleted as they depend upon the object's now out-of-date state. I understand where to implement the actual cascaded updates (inside the parent model's save method), but I don't see a quick way to ask the user for confirmation (and then rollback if they decide not to save). I suppose I could implement some weird confirmation logic directly inside the save method (sort of a two phase save) but that seems...ugly. Any thoughts, even general pointers into the django codebase? Thanks!
Where can a save confirmation page be hooked into the Django admin? (similar to delete confirmation)
0.132549
0
0
2,618
114,283
2008-09-22T11:11:00.000
1
0
0
0
python,django
114,348
3
false
1
0
I'm by no means a Django expert, so this answer might misguide you. Start looking somewhere around django.contrib.admin.options.ModelAdmin, especially render_change_form and response_change. I guess you would need to subclass ModelAdmin for your model and provide required behavior around those methods.
2
9
0
I want to emulate the delete confirmation page behavior before saving certain models in the admin. In my case if I change one object, certain others should be deleted as they depend upon the object's now out-of-date state. I understand where to implement the actual cascaded updates (inside the parent model's save method), but I don't see a quick way to ask the user for confirmation (and then rollback if they decide not to save). I suppose I could implement some weird confirmation logic directly inside the save method (sort of a two phase save) but that seems...ugly. Any thoughts, even general pointers into the django codebase? Thanks!
Where can a save confirmation page be hooked into the Django admin? (similar to delete confirmation)
0.066568
0
0
2,618
116,139
2008-09-22T17:08:00.000
0
0
1
0
python,ms-word,openxml,docx
116,199
10
false
0
0
You should be able to use the MSWord ActiveX interface to extract the text to search (or, possibly, do the search). I have no idea how you access ActiveX from Python though.
4
51
0
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".
How can I search a word in a Word 2007 .docx file?
0
0
0
47,992
116,139
2008-09-22T17:08:00.000
35
0
1
0
python,ms-word,openxml,docx
116,217
10
true
0
0
More exactly, a .docx document is a Zip archive in OpenXML format: you have first to uncompress it. I downloaded a sample (Google: some search term filetype:docx) and after unzipping I found some folders. The word folder contains the document itself, in file document.xml.
4
51
0
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".
How can I search a word in a Word 2007 .docx file?
1.2
0
0
47,992
116,139
2008-09-22T17:08:00.000
4
0
1
0
python,ms-word,openxml,docx
116,194
10
false
0
0
A docx is just a zip archive with lots of files inside. Maybe you can look at some of the contents of those files? Other than that you probably have to find a lib that understands the word format so that you can filter out things you're not interested in. A second choice would be to interop with word and do the search through it.
4
51
0
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".
How can I search a word in a Word 2007 .docx file?
0.07983
0
0
47,992
116,139
2008-09-22T17:08:00.000
2
0
1
0
python,ms-word,openxml,docx
116,197
10
false
0
0
a docx file is essentially a zip file with an xml inside it. the xml contains the formatting but it also contains the text.
4
51
0
I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify documents as having or not having "some special phrase".
How can I search a word in a Word 2007 .docx file?
0.039979
0
0
47,992
116,657
2008-09-22T18:35:00.000
7
0
1
1
python,macos,packaging
116,901
1
false
0
0
I don't know the correct way to do it, but this manual method is the approach I've used for simple scripts which seems to have preformed suitably. I'll assume that whatever directory I'm in, the Python files for my program are in the relative src/ directory, and that the file I want to execute (which has the proper shebang and execute permissions) is named main.py. $ mkdir -p MyApplication.app/Contents/MacOS $ mv src/* MyApplication.app/Contents/MacOS $ cd MyApplication.app/Contents/MacOS $ mv main.py MyApplication At this point we have an application bundle which, as far as I know, should work on any Mac OS system with Python installed (which I think it has by default). It doesn't have an icon or anything, that requires adding some more metadata to the package which is unnecessary for my purposes and I'm not familiar with. To create the drag-and-drop installer is quite simple. Use Disk Utility to create a New Disk Image of approximately the size you require to store your application. Open it up, copy your application and an alias of /Applications to the drive, then use View Options to position them as you want. The drag-and-drop message is just a background of the disk image, which you can also specify in View Options. I haven't done it before, but I'd assume that after you whip up an image in your editor of choice you could copy it over, set it as the background and then use chflags hidden to prevent it from cluttering up your nice window. I know these aren't the clearest, simplest or most detailed instructions out there, but I hope somebody may find them useful.
1
25
0
I want to create a mac osx application from python package and then put it in a disk image. Because I load some resources out of the package, the package should not reside in a zip file. The resulting disk image should display the background picture to "drag here -> applications" for installation.
How do you create an osx application/dmg from a python package?
1
0
0
16,311
117,800
2008-09-22T21:37:00.000
1
0
0
0
python,django,autofield
118,331
8
false
1
0
The auto fields depend, to an extent, on the database driver being used. You'll have to look at the objects actually created for the specific database to see what's happening.
1
25
0
For our Django App, we'd like to get an AutoField to start at a number other than 1. There doesn't seem to be an obvious way to do this. Any ideas?
How to get Django AutoFields to start at a higher number
0.024995
0
0
14,912
118,221
2008-09-22T23:28:00.000
0
0
1
0
python
118,228
4
false
0
0
What platform are you running under? GObject is the basis of the GTK GUI that's widely-used under Linux, and it supports event loops with prioritizable events like this.
2
2
0
I need to allow other Python applications to register callback functions for events in my application. These need to have priorities associated with them (so a callback with a priority of 10 runs before a callback with a priority of 1) and callback functions need to be able to signal errors to the dispatcher. These are all lightweight callbacks running in the same process, so I don't need to send signals across process boundaries. Is there a good Python library to handle this, or do I need to write my own?
What's the best dispatcher/callback library in Python?
0
0
0
1,912
118,221
2008-09-22T23:28:00.000
0
0
1
0
python
1,140,282
4
false
0
0
Try Twisted for anything network-related. Its perspective broker is quite nice to use.
2
2
0
I need to allow other Python applications to register callback functions for events in my application. These need to have priorities associated with them (so a callback with a priority of 10 runs before a callback with a priority of 1) and callback functions need to be able to signal errors to the dispatcher. These are all lightweight callbacks running in the same process, so I don't need to send signals across process boundaries. Is there a good Python library to handle this, or do I need to write my own?
What's the best dispatcher/callback library in Python?
0
0
0
1,912
118,643
2008-09-23T01:33:00.000
3
0
1
0
python,accessibility
236,957
11
false
0
0
I use eclipse with the pydev extensions since it's an IDE I have a lot of experience with. I also appreciate the smart indentation it offers for coding if statements, loops, etc. I have configured the pindent.py script as an external tool that I can run on the currently focused python module which makes my life easier so I can see what is closed where with out having to constantly check indentation.
3
83
0
I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter and then convert that format into a properly indented representation that the Python interpreter could use?
Is there a way to convert indentation in Python code to braces?
0.054491
0
0
11,197
118,643
2008-09-23T01:33:00.000
4
0
1
0
python,accessibility
11,996,920
11
false
0
0
Searching an accessible Python IDE, found this and decided to answer. Under Windows with JAWS: Go to Settings Center by pressing JawsKey+6 (on the number row above the letters) in your favorite text editor. If JAWS prompts to create a new configuration file, agree. In the search field, type "indent" There will be only one result: "Say indent characters". Turn this on. Enjoy! The only thing that is frustrating for us is that we can't enjoy code examples on websites (since indent speaking in browsers is not too comfortable — it generates superfluous speech). Happy coding from another Python beginner).
3
83
0
I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter and then convert that format into a properly indented representation that the Python interpreter could use?
Is there a way to convert indentation in Python code to braces?
0.072599
0
0
11,197
118,643
2008-09-23T01:33:00.000
1
0
1
0
python,accessibility
453,806
11
false
0
0
There are various answers explaining how to do this. But I would recommend not taking this route. While you could use a script to do the conversion, it would make it hard to work on a team project. My recommendation would be to configure your screen reader to announce the tabs. This isn't as annoying as it sounds, since it would only say "indent 5" rather than "tab tab tab tab tab". Furthermore, the indentation would only be read whenever it changed, so you could go through an entire block of code without hearing the indentation level. In this way hearing the indentation is no more verbose than hearing the braces. As I don't know which operating system or screen reader you use I unfortunately can't give the exact steps for achieving this.
3
83
0
I am a totally blind programmer who would like to learn Python. Unfortunately the fact that code blocks are represented with different levels of indentation is a major stumbling block. I was wondering if there were any tools available that would allow me to write code using braces or some other code block delimiter and then convert that format into a properly indented representation that the Python interpreter could use?
Is there a way to convert indentation in Python code to braces?
0.01818
0
0
11,197
118,654
2008-09-23T01:37:00.000
5
0
0
0
.net,python,ironpython
118,680
9
false
1
0
If BeautifulSoup doesn't work on IronPython, it's because IronPython doesn't implement the whole Python language (the same way CPython does). BeautifulSoup is pure-python, no C-extensions, so the only problem is the compatibility of IronPython with CPython in terms of Python source code.There shouldn't be one, but if there is, the error will be obvious ("no module named ...", "no method named ...", etc.). Google says that only one of BS's tests fails with IronPython. it probably works, and that test may be fixed by now. I wouldn't know. Try it out and see, would be my advice, unless anybody has anything more concrete.
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
0.110656
0
0
8,742
118,654
2008-09-23T01:37:00.000
-2
0
0
0
.net,python,ironpython
119,713
9
false
1
0
If you have the complete standard library and the real re module (google for IronPython community edition) it might work. But IronPython is an incredible bad python implementation, I wouldn't count on that. Besides, give html5lib a try. That parser parses with the same rules firefox parses documents.
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
-0.044415
0
0
8,742
118,654
2008-09-23T01:37:00.000
8
0
0
0
.net,python,ironpython
118,713
9
false
1
0
I've tested and used BeautifulSoup with both IPy 1.1 and 2.0 (forget which beta, but this was a few months back). Leave a comment if you are still having trouble and I'll dig out my test code and post it.
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
1
0
0
8,742
118,654
2008-09-23T01:37:00.000
0
0
0
0
.net,python,ironpython
118,671
9
false
1
0
I haven't tested it, but I'd say it'll most likely work with the latest IPy2. As for distribution, it's very simple. Use the -X:SaveAssemblies option to compile your Python code down to a binary and then ship it with your other DLLs and the IPy dependencies.
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
0
0
0
8,742
118,654
2008-09-23T01:37:00.000
1
0
0
0
.net,python,ironpython
287,247
9
false
1
0
We are distributing a 40k line IronPython application. We have not been able to compile the whole thing into a single binary distributable. Instead we have been distributing it as a zillion tiny dlls, one for each IronPython module. This works fine though. However, on the newer release, IronPython 2.0, we have a recent spike which seems to be able to compile everything into a single binary file. This also results in faster application start-up too (module importing is faster.) Hopefully this spike will migrate into our main tree in the next few days. To do the distribution we are using WiX, which is a Microsoft internal tool for creating msi installs, that has been open-sourced (or made freely available, at least.) It has given us no problems, even though our install has some quite fiddly requirements. I will definitely look at using WiX to distribute other IronPython projects in the future.
5
21
0
Does beautiful soup work with iron python? If so with which version of iron python? How easy is it to distribute a windows desktop app on .net 2.0 using iron python (mostly c# calling some python code for parsing html)?
Iron python, beautiful soup, win32 app
0.022219
0
0
8,742
118,813
2008-09-23T02:38:00.000
3
0
1
1
python,macos,osx-leopard,macports
2,621,262
7
false
0
0
The current Macports installer does the .profile PATH modification automatically.
3
19
0
I want to use the macports version of python instead of the one that comes with Leopard.
How do I uninstall python from OSX Leopard so that I can use the MacPorts version?
0.085505
0
0
22,721
118,813
2008-09-23T02:38:00.000
29
0
1
1
python,macos,osx-leopard,macports
118,824
7
false
0
0
Don't. Apple ships various system utilities that rely on the system Python (and particularly the Python "framework" build); removing it will cause you problems. Instead, modify your PATH environ variable in your ~/.bash_profile to put /opt/local/bin first.
3
19
0
I want to use the macports version of python instead of the one that comes with Leopard.
How do I uninstall python from OSX Leopard so that I can use the MacPorts version?
1
0
0
22,721
118,813
2008-09-23T02:38:00.000
4
0
1
1
python,macos,osx-leopard,macports
118,821
7
false
0
0
Instead of uninstalling the built-in Python, install the MacPorts version and then modify your $PATH to have the MacPorts version first. For example, if MacPorts installs /usr/local/bin/python, then modify your .bashrc to include PATH=/usr/local/bin:$PATH at the end.
3
19
0
I want to use the macports version of python instead of the one that comes with Leopard.
How do I uninstall python from OSX Leopard so that I can use the MacPorts version?
0.113791
0
0
22,721
119,198
2008-09-23T04:53:00.000
2
0
1
0
c#,python
119,386
8
false
1
0
Never stop learning! That said, how can you compare the two? How good is Python support in .Net? Is there C# support in Google App Engine? It really depends what your target system is. Therefore, the more languages you have the better equipped you will be to tackle different challenges.
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.049958
0
0
5,513
119,198
2008-09-23T04:53:00.000
1
0
1
0
c#,python
119,208
8
false
1
0
Both are useful for different purposes. C# is a pretty good all-rounder, python's dynamic nature makes it more suitable for RAD experiences such as site building. I don't think your career will suffer if you were competant in both. To get going with Python consider an IDE with Python support such as Eclipse+PyDev or ActiveIDE's Komodo. (I found a subscription to Safari Bookshelf online really invaluable too!)
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.024995
0
0
5,513
119,198
2008-09-23T04:53:00.000
1
0
1
0
c#,python
119,215
8
false
1
0
What's better is inherently subjective. If you like Python's syntax - learn it. It will probably be harder to find a Python job, C# and .NET in general seem to be more popular, but this may change. I also think it's worth to know at least one scripting language, even if your main job doesn't require it. Python is not a bad candidate.
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.024995
0
0
5,513
119,198
2008-09-23T04:53:00.000
3
0
1
0
c#,python
119,224
8
false
1
0
It can't hurt to learn Python, especially considering some of the heavy weights (Google) are really getting behind it. As for the actual use, it all depends on the application. Use the best tool for the job.
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.07486
0
0
5,513
119,198
2008-09-23T04:53:00.000
0
0
1
0
c#,python
30,671,567
8
false
1
0
I have been thinking about this same question myself. I believe however there is still a lot of stuff C# can offer that I want to get good at before I job into Python. Because Python is easier to learn it. One advantage I have found in languages is not the language itself but the materials available to learning them. For example let's say you could make a 3D game in JavaScript, but you would be more likely to find resources to do so in C++. Or you could make phone apps in PHP but C# or Java would have more material out there to help you with the phone apps. For me personally I know when I become good at programming in C# I will be able to branch off into other languages. This is the main reason I have chosen to devote most of my time to that one language. I also am learning a little bit of Java and C++ just practice thinking in other languages. I think in the future however Python will become more popular because coding is becoming more popular and Python is the easiest of mainstream languages right now.
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0
0
0
5,513
119,198
2008-09-23T04:53:00.000
1
0
1
0
c#,python
119,205
8
false
1
0
Depends on what you will use it for. If you're making enterprise Windows forms applications, I don't think switching to Python would be a good idea. Also, it is possible to still use Python on the .NET CLR with IronPython.
6
3
0
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Is it good to switch from c# to python?
0.024995
0
0
5,513
120,250
2008-09-23T10:35:00.000
3
0
1
0
python,memory-management,short
120,454
6
false
0
0
Armin's suggestion of the array module is probably best. Two possible alternatives: You can create an extension module yourself that provides the data structure that you're after. If it's really just something like a collection of shorts, then that's pretty simple to do. You can cheat and manipulate bits, so that you're storing one number in the lower half of the Python int, and another one in the upper half. You'd write some utility functions to convert to/from these within your data structure. Ugly, but it can be made to work. It's also worth realising that a Python integer object is not 4 bytes - there is additional overhead. So if you have a really large number of shorts, then you can save more than two bytes per number by using a C short in some way (e.g. the array module). I had to keep a large set of integers in memory a while ago, and a dictionary with integer keys and values was too large (I had 1GB available for the data structure IIRC). I switched to using a IIBTree (from ZODB) and managed to fit it. (The ints in a IIBTree are real C ints, not Python integers, and I hacked up an automatic switch to a IOBTree when the number was larger than 32 bits).
2
27
0
Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')?
Short Integers in Python
0.099668
0
0
53,804
120,250
2008-09-23T10:35:00.000
3
0
1
0
python,memory-management,short
60,190,871
6
false
0
0
You can use NumyPy's int as np.int8 or np.int16.
2
27
0
Python allocates integers automatically based on the underlying system architecture. Unfortunately I have a huge dataset which needs to be fully loaded into memory. So, is there a way to force Python to use only 2 bytes for some integers (equivalent of C++ 'short')?
Short Integers in Python
0.099668
0
0
53,804
120,657
2008-09-23T12:28:00.000
1
0
0
1
python,windows,subprocess,command-line-arguments
120,992
6
false
0
0
"escaping the ampersand with ^" Are you sure ^ is an escape character to Windows? Shouldn't you use \?
3
5
0
I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command that contains ampersands in it's path. I've attempted quoting the command, escaping the ampersand with ^ and neither works. I'm now out of ideas. Any suggestions? To clarify from current responses: I am using the subprocess module I am passing the command line + arguments in as a list The issue is with the path to the command itself, not any of the arguments I've tried quoting the command. It causes a [Error 123] The filename, directory name, or volume label syntax is incorrect error I'm using no shell argument (so shell=false) In case it matters, I'm grabbing a pipe to stderr for processing it, but ignoring stdout and stdin It is only for use on Windows currently, and works as expected in all other cases that I've tested so far. The command that is failing is: p = subprocess.Popen(prog, stderr = subprocess.PIPE, bufsize=-1) when the first element of the list 'prog' contains any ampersands. Quoting this first string does not work.
Python subprocess issue with ampersands
0.033321
0
0
5,909
120,657
2008-09-23T12:28:00.000
0
0
0
1
python,windows,subprocess,command-line-arguments
120,782
6
false
0
0
To answer my own question: Quoting the actual command when passing the parameters as a list doesn't work correctly (command is first item of list) so to solve the issue I turned the list into a space separated string and passed that into subprocess instead. Better solutions still welcomed.
3
5
0
I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command that contains ampersands in it's path. I've attempted quoting the command, escaping the ampersand with ^ and neither works. I'm now out of ideas. Any suggestions? To clarify from current responses: I am using the subprocess module I am passing the command line + arguments in as a list The issue is with the path to the command itself, not any of the arguments I've tried quoting the command. It causes a [Error 123] The filename, directory name, or volume label syntax is incorrect error I'm using no shell argument (so shell=false) In case it matters, I'm grabbing a pipe to stderr for processing it, but ignoring stdout and stdin It is only for use on Windows currently, and works as expected in all other cases that I've tested so far. The command that is failing is: p = subprocess.Popen(prog, stderr = subprocess.PIPE, bufsize=-1) when the first element of the list 'prog' contains any ampersands. Quoting this first string does not work.
Python subprocess issue with ampersands
0
0
0
5,909
120,657
2008-09-23T12:28:00.000
1
0
0
1
python,windows,subprocess,command-line-arguments
120,705
6
false
0
0
A proper answer will need more information than that. What are you actually doing? How does it fail? Are you using the subprocess module? Are you passing a list of arguments and shell=False (or no shell argument) or are you actually invoking the shell?
3
5
0
I'm currently having a major issue with a python script. The script runs arbitrary commands through a handler to convert incorrect error reporting into correct error reporting. The issue I'm having is getting the script to work correctly on windows with a command that contains ampersands in it's path. I've attempted quoting the command, escaping the ampersand with ^ and neither works. I'm now out of ideas. Any suggestions? To clarify from current responses: I am using the subprocess module I am passing the command line + arguments in as a list The issue is with the path to the command itself, not any of the arguments I've tried quoting the command. It causes a [Error 123] The filename, directory name, or volume label syntax is incorrect error I'm using no shell argument (so shell=false) In case it matters, I'm grabbing a pipe to stderr for processing it, but ignoring stdout and stdin It is only for use on Windows currently, and works as expected in all other cases that I've tested so far. The command that is failing is: p = subprocess.Popen(prog, stderr = subprocess.PIPE, bufsize=-1) when the first element of the list 'prog' contains any ampersands. Quoting this first string does not work.
Python subprocess issue with ampersands
0.033321
0
0
5,909
121,439
2008-09-23T14:39:00.000
11
0
0
0
python,django,templates,stack-trace
122,482
5
false
1
0
As @zacherates says, you really don't want to display a stacktrace to your users. The easiest approach to this problem is what Django does by default if you have yourself and your developers listed in the ADMINS setting with email addresses; it sends an email to everyone in that list with the full stack trace (and more) everytime there is a 500 error with DEBUG = False.
2
25
0
I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False. With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-and-paste the errors and easily email them to the developers. Any thoughts on how best to approach this issue?
How do I include a stacktrace in my Django 500.html page?
1
0
0
10,099
121,439
2008-09-23T14:39:00.000
1
0
0
0
python,django,templates,stack-trace
121,487
5
false
1
0
You could call sys.exc_info() in a custom exception handler. But I don't recommend that. Django can send you emails for exceptions.
2
25
0
I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False. With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-and-paste the errors and easily email them to the developers. Any thoughts on how best to approach this issue?
How do I include a stacktrace in my Django 500.html page?
0.039979
0
0
10,099
122,327
2008-09-23T17:04:00.000
13
0
1
0
python,installation
122,387
22
false
0
0
An additional note to the get_python_lib function mentioned already: on some platforms different directories are used for platform specific modules (eg: modules that require compilation). If you pass plat_specific=True to the function you get the site packages for platform specific packages.
1
1,238
0
How do I find the location of my site-packages directory?
How do I find the location of my Python site-packages directory?
1
0
0
1,306,364
123,198
2008-09-23T19:23:00.000
-4
0
1
0
python,file,copy,filesystems,file-copying
69,868,767
21
false
0
0
shutil.copy(src, dst, *, follow_symlinks=True)
1
3,318
0
How do I copy a file in Python?
How to copy files?
-1
0
0
2,844,364
124,604
2008-09-23T23:50:00.000
11
1
1
0
python,perl,raku
124,804
8
false
0
0
In my opinion, Python's syntax is much cleaner, simpler, and consistent. You can define nested data structures the same everywhere, whether you plan to pass them to a function (or return them from one) or use them directly. I like Perl a lot, but as soon as I learned enough Python to "get" it, I never turned back. In my experience, random snippets of Python tend to be more readable than random snippets of Perl. The difference really comes down to the culture around each language, where Perl users often appreciate cleverness while Python users more often prefer clarity. That's not to say you can't have clear Perl or devious Python, but those are much less common. Both are fine languages and solve many of the same problems. I personally lean toward Python, if for no other reason in that it seems to be gaining momentum while Perl seems to be losing users to Python and Ruby. Note the abundance of weasel words in the above. Honestly, it's really going to come down to personal preference.
4
26
0
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python?
1
0
0
3,114
124,604
2008-09-23T23:50:00.000
25
1
1
0
python,perl,raku
124,797
8
false
0
0
There is no advantage to be gained by switching from Perl to Python. There is also no advantage to be gained by switching from Python to Perl. They are both equally capable. Choose your tools based on what you know and the problem you are trying to solve rather than on some sort of notion that one is somehow inherently better than the other. The only real advantage is if you are switching from a language you don't know to a language you do know, in which case your productivity will likely go up.
4
26
0
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python?
1
0
0
3,114
124,604
2008-09-23T23:50:00.000
4
1
1
0
python,perl,raku
127,627
8
false
0
0
You have not said why you want to move away from Perl*. If my crystal ball is functioning today then it is because you do not fully know the language and so it frustrates you. Stick with Perl and study the language well. If you do then one day you will be a guru and know why your question is irrelevant. Enlightment comes to those to seek it. You called it "Perl5" but there is no such language. :P
4
26
0
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python?
0.099668
0
0
3,114
124,604
2008-09-23T23:50:00.000
4
1
1
0
python,perl,raku
4,294,670
8
false
0
0
IMO python's regexing, esp. when you try to represent something like perl's /e operator as in s/whatever/somethingelse/e, becomes quite slow. So in doubt, you may need to stay with Perl5 :-)
4
26
0
Coming from a Perl 5 background, what are the advantages of moving to Perl 6 or Python?
I know Perl 5. What are the advantages of learning Perl 6, rather than moving to Python?
0.099668
0
0
3,114
125,034
2008-09-24T02:15:00.000
1
0
1
0
python,attributes,readonly
125,053
6
false
0
0
There is no real way to do this. There are ways to make it more 'difficult', but there's no concept of completely hidden, inaccessible class attributes. If the person using your class can't be trusted to follow the API docs, then that's their own problem. Protecting people from doing stupid stuff just means that they will do far more elaborate, complicated, and damaging stupid stuff to try to do whatever they shouldn't have been doing in the first place.
1
8
0
In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods on the instance. I want the syntax to be concise. What is the best way? (I give my current best answer below...)
What is the easiest, most concise way to make selected attributes in an instance be readonly?
0.033321
0
0
395
125,222
2008-09-24T03:15:00.000
3
0
1
0
python,linux,ms-word
125,235
15
false
0
0
I'm not sure if you're going to have much luck without using COM. The .doc format is ridiculously complex, and is often called a "memory dump" of Word at the time of saving! At Swati, that's in HTML, which is fine and dandy, but most word documents aren't so nice!
1
28
0
for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux? Is there any library?
extracting text from MS word files in python
0.039979
0
0
64,780
125,703
2008-09-24T06:30:00.000
148
0
1
0
python,file,text
125,759
8
false
0
0
Unfortunately there is no way to insert into the middle of a file without re-writing it. As previous posters have indicated, you can append to a file or overwrite part of it using seek but if you want to add stuff at the beginning or the middle, you'll have to rewrite it. This is an operating system thing, not a Python thing. It is the same in all languages. What I usually do is read from the file, make the modifications and write it out to a new file called myfile.txt.tmp or something like that. This is better than reading the whole file into memory because the file may be too large for that. Once the temporary file is completed, I rename it the same as the original file. This is a good, safe way to do it because if the file write crashes or aborts for any reason, you still have your untouched original file.
1
209
0
I'm using Python, and would like to insert a string into a text file without deleting or copying the file. How can I do that?
How to modify a text file?
1
0
0
481,640
126,131
2008-09-24T09:05:00.000
8
0
0
0
javascript,python,html
126,250
2
false
1
0
The big complication here is emulating the full browser environment outside of a browser. You can use stand alone javascript interpreters like Rhino and SpiderMonkey to run javascript code but they don't provide a complete browser like environment to full render a web page. If I needed to solve a problem like this I would first look at how the javascript is rendering the page, it's quite possible it's fetching data via AJAX and using that to render the page. I could then use python libraries like simplejson and httplib2 to directly fetch the data and use that, negating the need to access the DOM object. However, that's only one possible situation, I don't know the exact problem you are solving. Other options include the selenium one mentioned by Łukasz, some kind of webkit embedded craziness, some kind of IE win32 scripting craziness or, finally, a pyxpcom based solution (with added craziness). All these have the drawback of requiring pretty much a fully running web browser for python to play with, which might not be an option depending on your environment.
1
18
0
Is there any python module for rendering a HTML page with javascript and get back a DOM object? I want to parse a page which generates almost all of its content using javascript.
Python library for rendering HTML and javascript
1
0
1
34,652
126,356
2008-09-24T10:14:00.000
1
0
0
0
python,facebook,turbogears
130,332
2
false
1
0
pyFacebook is Django-centric because it includes a Django example. I did not intend to irk, but am merely looking for a TurboGears example using pyFacebook.
2
2
0
I have a TurboGears application I'd like to run through Facebook, and am looking for an example TurboGears project using pyFacebook or minifb.py. pyFacebook is Django-centric, and I can probably figure it out, but this is, after all, the lazy web.
Example Facebook Application using TurboGears -- pyFacebook
0.099668
0
0
1,667
126,356
2008-09-24T10:14:00.000
3
0
0
0
python,facebook,turbogears
126,399
2
false
1
0
Why is pyFacebook django centric? Looks like it works perfectly fine with all kinds of WSGI apps or Python applications in general. No need to use Django.
2
2
0
I have a TurboGears application I'd like to run through Facebook, and am looking for an example TurboGears project using pyFacebook or minifb.py. pyFacebook is Django-centric, and I can probably figure it out, but this is, after all, the lazy web.
Example Facebook Application using TurboGears -- pyFacebook
0.291313
0
0
1,667
126,787
2008-09-24T12:21:00.000
2
1
0
0
python
126,843
2
true
1
0
As the author of one of the reloader mechanisms (the one in werkzeug) I can tell you that it doesn't work. What all the reloaders do is forking one time and restarting the child process if a monitor thread notices that one module changed on the file system. Inline reload()ing doesn't work because references to the reloaded module are not updated.
1
2
0
Almost every Python web framework has a simple server that runs a wsgi application and automatically reloads the imported modules every time the source gets changed. I know I can look at the code and see how it's done, but that may take some time and I'm asking just out of curiosity. Does anyone have any idea how this is implemented?
Checking for code changes in all imported python modules
1.2
0
0
304
127,454
2008-09-24T14:20:00.000
4
0
1
0
python
127,651
7
false
0
0
Build something cool in Python and share it with others. Small values of cool are still cool. Not everyone gets to write epic, world-changing software. Every problem solved well using Python is a way of showing how cool Python is.
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
0.113791
0
0
1,114
127,454
2008-09-24T14:20:00.000
0
0
1
0
python
127,787
7
false
0
0
Start by contributing to a Python project that you use and enjoy. This can be as simple as answering questions on the mailing list or IRC channel, offering to help with documentation and test writing or fixing bugs.
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
0
0
0
1,114
127,454
2008-09-24T14:20:00.000
1
0
1
0
python
127,501
7
false
0
0
If you aren't up to actually working on the Python core, there are still many ways to contribute.. 2 that immediately come to mind is: work on documentation.. it can ALWAYS be improved. Take your favorite modules and check out the documentation and add where you can. Reporting descriptive bugs is very helpful to the development process.
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
0.028564
0
0
1,114
127,454
2008-09-24T14:20:00.000
7
0
1
0
python
127,601
7
true
0
0
Add to the docs. it is downright crappy Help out other users on the dev and user mailing lists. TEST PYTHON. bugs in programming languages are real bad. And I have seen someone discover atleast 1 bug in python Frequent the #python channel on irc.freenode.net
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
1.2
0
0
1,114
127,454
2008-09-24T14:20:00.000
3
0
1
0
python
127,493
7
false
0
0
I guess one way would be to help with documentation (translation, updating), until you are aware enough about the language. Also following the devs and users mail groups would give you a pretty good idea of what is being done and needs to be done by the community.
5
13
0
I'm a pretty inexperienced programmer (can make tk apps, text processing, sort of understand oop), but Python is so awesome that I would like to help the community. What's the best way for a beginner to contribute?
Contributing to Python
0.085505
0
0
1,114
128,466
2008-09-24T17:19:00.000
1
0
0
0
python,django
138,666
5
false
1
0
Only simplest sites are easy to upgrade. Expect real pain if your site happen to be for non-ASCII part of the world (read: anywhere outside USA and UK). The most painful change in Django was switching from bytestrings to unicode objects internally - now you have to find all places where you use bytestrings and change this to unicode. Worst case is the template rendering, you'll never know you forgot to change one variable until you get UnicodeError. Other notable thing: manipulators (oldforms) have gone and you have no other way than to rewrite all parts with forms (newforms). If this is your case and your project is larger than 2-3 apps, I'd be rather reluctant to upgrade until really necessary.
4
8
0
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
What's the best way to upgrade from Django 0.96 to 1.0?
0.039979
0
0
896
128,466
2008-09-24T17:19:00.000
2
0
0
0
python,django
129,187
5
false
1
0
Just upgrade your app. The switch from 0.96 to 1.0 was huge, but in terms of Backwards Incompatible changes I doubt your app even has 10% of them. I was on trunk before Django 1.0 so I the transition for me was over time but even then the only major things I had to change were newforms, newforms-admin, str() to unicode() and maxlength to max_length Most of the other changes were new features or backend rewrites or stuff that as someone who was building basic websites did not even get near.
4
8
0
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
What's the best way to upgrade from Django 0.96 to 1.0?
0.07983
0
0
896
128,466
2008-09-24T17:19:00.000
1
0
0
0
python,django
410,942
5
false
1
0
We upgraded in a multi step process and I'm quite happy with that. The application in Question was about 100.000 LoC and running several core business functions with lot's of interfacing to legacy systems. We worked like that: Update to django 0.97-post unicode merge. Fix all the unicode issues refactor the application into reusable apps, add tests. That left us with 40.000 LoC in the main application/Project Upgrade to django 0.97-post autoexcape merge. Fix auto escaping in the reusable apps created in 3. Then fix the remaining auto-escaping issues in the mian application. Upgrade to 1.0. What was left was mostly fixing the admin stuff. The whole thing took about 6 months where we where running a legacy production branch on our servers while porting an other branch to 1.0. While doing so we also where adding features to the production branch. The final merge was much less messy than expected and took about a week for 4 coders merging, reviewing, testing and fixing. We then rolled out, and for about a week got bitten by previously unexpected bugs. All in all I'm quite satisfied with the outcome. We have a much better codebase now for further development.
4
8
0
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
What's the best way to upgrade from Django 0.96 to 1.0?
0.039979
0
0
896
128,466
2008-09-24T17:19:00.000
7
0
0
0
python,django
128,496
5
true
1
0
Although this depends on what you're doing, most applications should be able to just upgrade and then fix everything that breaks. In my experience, the main things that I've had to fix after an upgrade are Changes to some of the funky stuff with models, such as the syntax for following foreign keys. A small set of template changes, most notably auto-escaping. Anything that depends on the specific structure of Django's internals. This shouldn't be an issue unless you're doing stuff like dynamically modifying Django internals to change their behavior in a way that's necessary/convenient for your project. To summarize, unless you're doing a lot of really weird and/or complex stuff, a simple upgrade should be relatively painless and only require a few changes.
4
8
0
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
What's the best way to upgrade from Django 0.96 to 1.0?
1.2
0
0
896
128,689
2008-09-24T17:53:00.000
0
1
0
0
python,crud,turbogears
158,626
4
false
1
0
After doing some more digging and hacking it turns out to not be terribly hard to drop the Cakewalk interface into an application. It's not pretty without a lot of work, but it works right away.
1
3
0
Are there any good packages or methods for doing extensive CRUD (create-retrieve-update-delete) interfaces in the Turbogears framework. The FastDataGrid widget is too much of a black box to be useful and CRUDTemplate looks like more trouble than rolling my own. Ideas? Suggestions?
Doing CRUD in Turbogears
0
0
0
1,363
130,763
2008-09-25T00:22:00.000
2
0
0
1
python,windows,windows-vista,uac
22,821,704
11
false
0
0
You can make a shortcut somewhere and as the target use: python yourscript.py then under properties and advanced select run as administrator. When the user executes the shortcut it will ask them to elevate the application.
1
113
0
I want my Python script to copy files on Vista. When I run it from a normal cmd.exe window, no errors are generated, yet the files are NOT copied. If I run cmd.exe "as administator" and then run my script, it works fine. This makes sense since User Account Control (UAC) normally prevents many file system actions. Is there a way I can, from within a Python script, invoke a UAC elevation request (those dialogs that say something like "such and such app needs admin access, is this OK?") If that's not possible, is there a way my script can at least detect that it is not elevated so it can fail gracefully?
Request UAC elevation from within a Python script?
0.036348
0
0
126,138