Available Count
int64
1
31
AnswerCount
int64
1
35
GUI and Desktop Applications
int64
0
1
Users Score
int64
-17
588
Q_Score
int64
0
6.79k
Python Basics and Environment
int64
0
1
Score
float64
-1
1.2
Networking and APIs
int64
0
1
Question
stringlengths
15
7.24k
Database and SQL
int64
0
1
Tags
stringlengths
6
76
CreationDate
stringlengths
23
23
System Administration and DevOps
int64
0
1
Q_Id
int64
469
38.2M
Answer
stringlengths
15
7k
Data Science and Machine Learning
int64
0
1
ViewCount
int64
13
1.88M
is_accepted
bool
2 classes
Web Development
int64
0
1
Other
int64
1
1
Title
stringlengths
15
142
A_Id
int64
518
72.2M
5
17
0
6
242
1
1
0
I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl. I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends?
0
python,bash,shell
2008-10-16T17:11:00.000
0
209,470
I will give here my opinion based on experience: For shell: shell can very easily spawn read-only code. Write it and when you come back to it, you will never figure out what you did again. It's very easy to accomplish this. shell can do A LOT of text processing, splitting, etc in one line with pipes. it is the best glue language when it comes to integrate the call of programs in different programming languages. For python: if you want portability to windows included, use python. python can be better when you must manipulate just more than text, such as collections of numbers. For this, I recommend python. I usually choose bash for most of the things, but when I have something that must cross windows boundaries, I just use python.
0
115,137
false
0
1
How to implement common bash idioms in Python?
20,313,297
5
17
0
2
242
1
0.023525
0
I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl. I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends?
0
python,bash,shell
2008-10-16T17:11:00.000
0
209,470
Your best bet is a tool that is specifically geared towards your problem. If it's processing text files, then Sed, Awk and Perl are the top contenders. Python is a general-purpose dynamic language. As with any general purpose language, there's support for file-manipulation, but that isn't what it's core purpose is. I would consider Python or Ruby if I had a requirement for a dynamic language in particular. In short, learn Sed and Awk really well, plus all the other goodies that come with your flavour of *nix (All the Bash built-ins, grep, tr and so forth). If it's text file processing you're interested in, you're already using the right stuff.
0
115,137
false
0
1
How to implement common bash idioms in Python?
209,665
5
17
0
3
242
1
0.035279
0
I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl. I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends?
0
python,bash,shell
2008-10-16T17:11:00.000
0
209,470
I have built semi-long shell scripts (300-500 lines) and Python code which does similar functionality. When many external commands are being executed, I find the shell is easier to use. Perl is also a good option when there is lots of text manipulation.
0
115,137
false
0
1
How to implement common bash idioms in Python?
210,429
5
17
0
16
242
1
1
0
I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl. I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends?
0
python,bash,shell
2008-10-16T17:11:00.000
0
209,470
In the beginning there was sh, sed, and awk (and find, and grep, and...). It was good. But awk can be an odd little beast and hard to remember if you don't use it often. Then the great camel created Perl. Perl was a system administrator's dream. It was like shell scripting on steroids. Text processing, including regular expressions were just part of the language. Then it got ugly... People tried to make big applications with Perl. Now, don't get me wrong, Perl can be an application, but it can (can!) look like a mess if you're not really careful. Then there is all this flat data business. It's enough to drive a programmer nuts. Enter Python, Ruby, et al. These are really very good general purpose languages. They support text processing, and do it well (though perhaps not as tightly entwined in the basic core of the language). But they also scale up very well, and still have nice looking code at the end of the day. They also have developed pretty hefty communities with plenty of libraries for most anything. Now, much of the negativeness towards Perl is a matter of opinion, and certainly some people can write very clean Perl, but with this many people complaining about it being too easy to create obfuscated code, you know some grain of truth is there. The question really becomes then, are you ever going to use this language for more than simple bash script replacements. If not, learn some more Perl.. it is absolutely fantastic for that. If, on the other hand, you want a language that will grow with you as you want to do more, may I suggest Python or Ruby. Either way, good luck!
0
115,137
false
0
1
How to implement common bash idioms in Python?
210,290
5
17
0
7
242
1
1
0
I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl. I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends?
0
python,bash,shell
2008-10-16T17:11:00.000
0
209,470
One reason I love Python is that it is much better standardized than the POSIX tools. I have to double and triple check that each bit is compatible with other operating systems. A program written on a Linux system might not work the same on a BSD system of OSX. With Python, I just have to check that the target system has a sufficiently modern version of Python. Even better, a program written in standard Python will even run on Windows!
0
115,137
false
0
1
How to implement common bash idioms in Python?
16,726,383
1
7
0
1
62
0
0.028564
0
How do I get the inverse of a matrix in python? I've implemented it myself, but it's pure python, and I suspect there are faster modules out there to do it.
0
python,algorithm,matrix,linear-algebra,matrix-inverse
2008-10-17T05:30:00.000
0
211,160
If you hate numpy, get out RPy and your local copy of R, and use it instead. (I would also echo to make you you really need to invert the matrix. In R, for example, linalg.solve and the solve() function don't actually do a full inversion, since it is unnecessary.)
1
125,109
false
0
1
Python Inverse of a Matrix
213,717
3
11
0
2
8
1
0.036348
0
Me and some friends are writing a MORPG in Java, and we would like to use a scripting language to, eg. to create quests. We have non experience with scripting in Java. We have used Python, but we are very inexperienced with it. One of us also have used Javascript. What scripting language should we use? What scripting language should we not use?
0
java,javascript,python,scripting-language
2008-10-17T09:23:00.000
0
211,536
Short version Don’t use a scripting language! Instead focus on configurability (which is something that a non-programmer can do well). Longer version One oft-used argument in favour of having a scripting language is that it allows for lesser programmers to more trivial tasks. Don't belive this, it will not save you any time, since trivial tasks are already accomplished by real programmers in no time. Aim for configurability instead of scripting, and you will have a much lower risk of bleeding over complex algorithms and concepts into the incapable hands of game designers. :) Lack of hotswapping (edit-and-continue) would have been a reason to implement a scripting language in an MMOG (you don’t want to reload the whole game for a minor code change), but using Java, with built-in hotswap, you really have no reason for adding a scripting language on top. I have spent years pondering these questions; in the day I implemented a complete scripting language, IDE, VM, debugger, etc for an MMOG myself. Since, I have grown wiser. If you still choose to go down the infinitely crappy path of no return, keep the following in mind. Pick a mature language which has been around for a while. Auto testing, debugging and editing will suck bigtime until you make your own tools/plugins/start hacking around in the VM. To date, I have never seen a DSL that improved the situation (getting a more maintainable product). Myself, I integrated Python into my indie game engine, but eventually came to my senses and ripped it out. "Stackless Python" is just a way of saying "unmaintainable but fast". Please, anyone correct me if I'm wrong?
0
1,679
false
1
1
Scripting in Java
838,738
3
11
0
0
8
1
0
0
Me and some friends are writing a MORPG in Java, and we would like to use a scripting language to, eg. to create quests. We have non experience with scripting in Java. We have used Python, but we are very inexperienced with it. One of us also have used Javascript. What scripting language should we use? What scripting language should we not use?
0
java,javascript,python,scripting-language
2008-10-17T09:23:00.000
0
211,536
I am a big fan of Python/Jython due to the clean syntax - which may suit you if you have some python experience. Otherwise Groovy which is based on Java syntax and may be an easier learning curve if most of your developers are Java guys. It also has the advantage of closer ties with the Java language and libraries. Beanshell is good if you have simple scripting in mind - it doesn't support classes. However I don't think it has had any support over the last few years (the JSR seemed to kill it off...) so is perhaps a bad choice if support is important to you.
0
1,679
false
1
1
Scripting in Java
211,883
3
11
0
9
8
1
1
0
Me and some friends are writing a MORPG in Java, and we would like to use a scripting language to, eg. to create quests. We have non experience with scripting in Java. We have used Python, but we are very inexperienced with it. One of us also have used Javascript. What scripting language should we use? What scripting language should we not use?
0
java,javascript,python,scripting-language
2008-10-17T09:23:00.000
0
211,536
I'm responsible for a fairly large hybrid Java/Jython system. We use java for core API development, then wire Java objects together using Jython. This is in a scientific computing environment where we need to be able to put together ad-hoc data analysis scripts quickly. If I were starting this system from scratch today, I would not choose Jython as the scripting language. I like Python fine, but I frequently encounter awkward mismatches between the Python type system and the Java type system. For example, if you just want a hashtable, should you use a Python dictionary or a Java HashMap? The decision might be different depending on whether you are just using the data structure locally in Python code or passing it across the Java boundary. Jython does a certain amount of type coercion for you, but it's not perfect. It's annoying to even have to think about issues like this when the purpose of using a scripting language in the first place is to enhance your productivity. I assume JavaScript or JRuby would have similar issues. Today I would choose a scripting language that is specifically targeted to the JVM and leverages the Java type system. The obvious candidates are Groovy and Beanshell; Groovy seems to have been picking up momentum lately so I'd look most closely at it.
0
1,679
false
1
1
Scripting in Java
215,096
3
11
0
3
13
1
0.054491
0
I am looking for a python webserver which is multithreaded instead of being multi-process (as in case of mod_python for apache). I want it to be multithreaded because I want to have an in memory object cache that will be used by various http threads. My webserver does a lot of expensive stuff and computes some large arrays which needs to be cached in memory for future use to avoid recomputing. This is not possible in a multi-process web server environment. Storing this information in memcache is also not a good idea as the arrays are large and storing them in memcache would lead to deserialization of data coming from memcache apart from the additional overhead of IPC. I implemented a simple webserver using BaseHttpServer, it gives good performance but it gets stuck after a few hours time. I need some more matured webserver. Is it possible to configure apache to use mod_python under a thread model so that I can do some object caching?
0
python,apache,webserver,mod-python
2008-10-17T19:12:00.000
0
213,483
Its hard to give a definitive answer without knowing what kind of site you are working on and what kind of load you are expecting. Sub second performance may be a serious requirement or it may not. If you really need to save that last millisecond then you absolutely need to keep your arrays in memory. However as others have suggested it is more than likely that you don't and could get by with something else. Your usage pattern of the data in the array may affect what kinds of choices you make. You probably don't need access to the entire set of data from the array all at once so you could break your data up into smaller chunks and put those chunks in the cache instead of the one big lump. Depending on how often your array data needs to get updated you might make a choice between memcached, local db (berkley, sqlite, small mysql installation, etc) or a remote db. I'd say memcached for fairly frequent updates. A local db for something in the frequency of hourly and remote for the frequency of daily. One thing to consider also is what happens after a cache miss. If 50 clients all of a sudden get a cache miss and all of them at the same time decide to start regenerating those expensive arrays your box(es) will quickly be reduced to 8086's. So you have to take in to consideration how you will handle that. Many articles out there cover how to recover from cache misses. Hope this is helpful.
0
12,249
false
0
1
A good multithreaded python webserver?
213,742
3
11
0
7
13
1
1
0
I am looking for a python webserver which is multithreaded instead of being multi-process (as in case of mod_python for apache). I want it to be multithreaded because I want to have an in memory object cache that will be used by various http threads. My webserver does a lot of expensive stuff and computes some large arrays which needs to be cached in memory for future use to avoid recomputing. This is not possible in a multi-process web server environment. Storing this information in memcache is also not a good idea as the arrays are large and storing them in memcache would lead to deserialization of data coming from memcache apart from the additional overhead of IPC. I implemented a simple webserver using BaseHttpServer, it gives good performance but it gets stuck after a few hours time. I need some more matured webserver. Is it possible to configure apache to use mod_python under a thread model so that I can do some object caching?
0
python,apache,webserver,mod-python
2008-10-17T19:12:00.000
0
213,483
Consider reconsidering your design. Maintaining that much state in your webserver is probably a bad idea. Multi-process is a much better way to go for stability. Is there another way to share state between separate processes? What about a service? Database? Index? It seems unlikely that maintaining a huge array of data in memory and relying on a single multi-threaded process to serve all your requests is the best design or architecture for your app.
0
12,249
false
0
1
A good multithreaded python webserver?
213,572
3
11
0
2
13
1
0.036348
0
I am looking for a python webserver which is multithreaded instead of being multi-process (as in case of mod_python for apache). I want it to be multithreaded because I want to have an in memory object cache that will be used by various http threads. My webserver does a lot of expensive stuff and computes some large arrays which needs to be cached in memory for future use to avoid recomputing. This is not possible in a multi-process web server environment. Storing this information in memcache is also not a good idea as the arrays are large and storing them in memcache would lead to deserialization of data coming from memcache apart from the additional overhead of IPC. I implemented a simple webserver using BaseHttpServer, it gives good performance but it gets stuck after a few hours time. I need some more matured webserver. Is it possible to configure apache to use mod_python under a thread model so that I can do some object caching?
0
python,apache,webserver,mod-python
2008-10-17T19:12:00.000
0
213,483
web.py has made me happy in the past. Consider checking it out. But it does sound like an architectural redesign might be the proper, though more expensive, solution.
0
12,249
false
0
1
A good multithreaded python webserver?
215,292
2
4
0
5
3
0
1.2
1
I have noticed that my particular instance of Trac is not running quickly and has big lags. This is at the very onset of a project, so not much is in Trac (except for plugins and code loaded into SVN). Setup Info: This is via a SELinux system hosted by WebFaction. It is behind Apache, and connections are over SSL. Currently the .htpasswd file is what I use to control access. Are there any recommend ways to improve the performance of Trac?
0
python,performance,trac
2008-10-17T21:02:00.000
0
213,838
It's hard to say without knowing more about your setup, but one easy win is to make sure that Trac is running in something like mod_python, which keeps the Python runtime in memory. Otherwise, every HTTP request will cause Python to run, import all the modules, and then finally handle the request. Using mod_python (or FastCGI, whichever you prefer) will eliminate that loading and skip straight to the good stuff. Also, as your Trac database grows and you get more people using the site, you'll probably outgrow the default SQLite database. At that point, you should think about migrating the database to PostgreSQL or MySQL, because they'll be able to handle concurrent requests much faster.
0
2,997
true
0
1
How to improve Trac's performance
214,162
2
4
0
3
3
0
0.148885
1
I have noticed that my particular instance of Trac is not running quickly and has big lags. This is at the very onset of a project, so not much is in Trac (except for plugins and code loaded into SVN). Setup Info: This is via a SELinux system hosted by WebFaction. It is behind Apache, and connections are over SSL. Currently the .htpasswd file is what I use to control access. Are there any recommend ways to improve the performance of Trac?
0
python,performance,trac
2008-10-17T21:02:00.000
0
213,838
We've had the best luck with FastCGI. Another critical factor was to only use https for authentication but use http for all other traffic -- I was really surprised how much that made a difference.
0
2,997
false
0
1
How to improve Trac's performance
215,084
3
5
0
0
1
0
0
0
We've been using Trac for task/defect tracking and things were going well enough, but this morning it started serving up a 500 error. Looking in the Apache error_log, I get a stack trace that culminates in: PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 13] Permission denied: '/.python-eggs' The Python egg cache directory is currently set to: /.python-eggs Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory So I explicitly set PYTHON_EGG_CACHE to /srv/trac/plugin-cache. I restarted Apache. Yet I get the same error (it still says "egg cache directory current set to: \n\n /.python_eggs.") How should I proceed? Is the simplest thing to do to reinstall Trac? If I go that route, what steps do I need to take to ensure that I don't lose existing data?
0
python,configuration,trac,python-egg-cache
2008-10-18T16:51:00.000
1
215,267
I found that using the PythonOption directive in the site config did not work, but SetEnv did. The environment variable route will also work though.
0
2,011
false
0
1
How do you fix a Trac installation that begins giving errors relating to PYTHON_EGG_CACHE?
406,119
3
5
0
0
1
0
0
0
We've been using Trac for task/defect tracking and things were going well enough, but this morning it started serving up a 500 error. Looking in the Apache error_log, I get a stack trace that culminates in: PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 13] Permission denied: '/.python-eggs' The Python egg cache directory is currently set to: /.python-eggs Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory So I explicitly set PYTHON_EGG_CACHE to /srv/trac/plugin-cache. I restarted Apache. Yet I get the same error (it still says "egg cache directory current set to: \n\n /.python_eggs.") How should I proceed? Is the simplest thing to do to reinstall Trac? If I go that route, what steps do I need to take to ensure that I don't lose existing data?
0
python,configuration,trac,python-egg-cache
2008-10-18T16:51:00.000
1
215,267
I had the same problem. In my case the directory wasn't there so I created and chown'ed it over to the apache user (apache on my centos 4.3 box). Then made sure it had read-write permissions on the directory. You could get by with giving rw rights to the directory if the group that owns the directory contains the apache user. A simple ps aux|grep httpd should show you what account your server is running under if you don't know it. If you have trouble finding the directory remember the -a on the ls command since it is a "hidden" directory.
0
2,011
false
0
1
How do you fix a Trac installation that begins giving errors relating to PYTHON_EGG_CACHE?
219,233
3
5
0
1
1
0
0.039979
0
We've been using Trac for task/defect tracking and things were going well enough, but this morning it started serving up a 500 error. Looking in the Apache error_log, I get a stack trace that culminates in: PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the Python egg cache: [Errno 13] Permission denied: '/.python-eggs' The Python egg cache directory is currently set to: /.python-eggs Perhaps your account does not have write access to this directory? You can change the cache directory by setting the PYTHON_EGG_CACHE environment variable to point to an accessible directory So I explicitly set PYTHON_EGG_CACHE to /srv/trac/plugin-cache. I restarted Apache. Yet I get the same error (it still says "egg cache directory current set to: \n\n /.python_eggs.") How should I proceed? Is the simplest thing to do to reinstall Trac? If I go that route, what steps do I need to take to ensure that I don't lose existing data?
0
python,configuration,trac,python-egg-cache
2008-10-18T16:51:00.000
1
215,267
I have wrestled many a battle with PYTHON_EGG_CACHE and I never figured out the correct way of setting it - apache's envvars, httpd.conf (SetEnv and PythonOption), nothing worked. In the end I just unpacked all python eggs manually, there were only two or three anyway - problem gone. I never understood why on earth people zip up files weighting no more than a few kilobytes in the first place...
0
2,011
false
0
1
How do you fix a Trac installation that begins giving errors relating to PYTHON_EGG_CACHE?
215,401
1
10
0
8
133
1
1
0
Which are the most advanced frameworks and tools there are available for python for practicing Behavior Driven Development? Especially finding similar tools as rspec and mocha for ruby would be great.
0
python,testing,bdd
2008-10-23T20:30:00.000
0
231,371
The Pyccuracy project is an effort to provide a domain-specific language for BDD in Python. Unlike doctest, which works at the API level, it encodes higher-level operations such as loading a web page and submitting a form. I haven't used it but it looks somewhat promising if that is what you're looking for.
0
46,233
false
0
1
Practicing BDD with python
812,490
4
8
0
3
62
0
0.07486
0
I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base? When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python? When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup? How do you handle/prevent typing errors (typos)? Are UnitTest's used as a substitute for static type checking? As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed.
0
python,development-environment
2008-10-25T13:30:00.000
0
236,407
My general rule of thumb is to use dynamic languages for small non-mission-critical projects and statically-typed languages for big projects. I find that code written in a dynamic language such as python gets "tangled" more quickly. Partly that is because it is much quicker to write code in a dynamic language and that leads to shortcuts and worse design, at least in my case. Partly it's because I have IntelliJ for quick and easy refactoring when I use Java, which I don't have for python.
0
19,675
false
0
1
How can I use Python for large scale development?
236,570
4
8
0
2
62
0
0.049958
0
I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base? When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python? When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup? How do you handle/prevent typing errors (typos)? Are UnitTest's used as a substitute for static type checking? As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed.
0
python,development-environment
2008-10-25T13:30:00.000
0
236,407
The usual answer to that is testing testing testing. You're supposed to have an extensive unit test suite and run it often, particularly before a new version goes online. Proponents of dynamically typed languages make the case that you have to test anyway because even in a statically typed language conformance to the crude rules of the type system covers only a small part of what can potentially go wrong.
0
19,675
false
0
1
How can I use Python for large scale development?
236,470
4
8
0
24
62
0
1.2
0
I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base? When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python? When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup? How do you handle/prevent typing errors (typos)? Are UnitTest's used as a substitute for static type checking? As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed.
0
python,development-environment
2008-10-25T13:30:00.000
0
236,407
Since nobody pointed out pychecker, pylint and similar tools, I will: pychecker and pylint are tools that can help you find incorrect assumptions (about function signatures, object attributes, etc.) They won't find everything that a compiler might find in a statically typed language -- but they can find problems that such compilers for such languages can't find, too. Python (and any dynamically typed language) is fundamentally different in terms of the errors you're likely to cause and how you would detect and fix them. It has definite downsides as well as upsides, but many (including me) would argue that in Python's case, the ease of writing code (and the ease of making it structurally sound) and of modifying code without breaking API compatibility (adding new optional arguments, providing different objects that have the same set of methods and attributes) make it suitable just fine for large codebases.
0
19,675
true
0
1
How can I use Python for large scale development?
236,537
4
8
0
40
62
0
1
0
I would be interested to learn about large scale development in Python and especially in how do you maintain a large code base? When you make incompatibility changes to the signature of a method, how do you find all the places where that method is being called. In C++/Java the compiler will find it for you, how do you do it in Python? When you make changes deep inside the code, how do you find out what operations an instance provides, since you don't have a static type to lookup? How do you handle/prevent typing errors (typos)? Are UnitTest's used as a substitute for static type checking? As you can guess I almost only worked with statically typed languages (C++/Java), but I would like to try my hands on Python for larger programs. But I had a very bad experience, a long time ago, with the clipper (dBase) language, which was also dynamically typed.
0
python,development-environment
2008-10-25T13:30:00.000
0
236,407
I had some experience with modifying "Frets On Fire", an open source python "Guitar Hero" clone. as I see it, python is not really suitable for a really large scale project. I found myself spending a large part of the development time debugging issues related to assignment of incompatible types, things that static typed laguages will reveal effortlessly at compile-time. also, since types are determined on run-time, trying to understand existing code becomes harder, because you have no idea what's the type of that parameter you are currently looking at. in addition to that, calling functions using their name string with the __getattr__ built in function is generally more common in Python than in other programming languages, thus getting the call graph to a certain function somewhat hard (although you can call functions with their name in some statically typed languages as well). I think that Python really shines in small scale software, rapid prototype development, and gluing existing programs together, but I would not use it for large scale software projects, since in those types of programs maintainability becomes the real issue, and in my opinion python is relatively weak there.
0
19,675
false
0
1
How can I use Python for large scale development?
236,445
2
12
0
-3
1,205
0
-0.049958
0
What's the best cross-platform way to get file creation and modification dates/times, that works on both Linux and Windows?
0
python,file
2008-10-25T21:54:00.000
1
237,079
os.stat does include the creation time. There's just no definition of st_anything for the element of os.stat() that contains the time. So try this: os.stat('feedparser.py')[8] Compare that with your create date on the file in ls -lah They should be the same.
0
1,083,080
false
0
1
How do I get file creation and modification date/times?
367,166
2
12
0
13
1,205
0
1
0
What's the best cross-platform way to get file creation and modification dates/times, that works on both Linux and Windows?
0
python,file
2008-10-25T21:54:00.000
1
237,079
os.stat returns a named tuple with st_mtime and st_ctime attributes. The modification time is st_mtime on both platforms; unfortunately, on Windows, ctime means "creation time", whereas on POSIX it means "change time". I'm not aware of any way to get the creation time on POSIX platforms.
0
1,083,080
false
0
1
How do I get file creation and modification date/times?
237,093
1
6
0
3
12
1
0.099668
0
Any python libs for parsing apache config files or if not python anyone aware of such thing in other languages (perl, php, java, c#)? As i'll be able to rewrite them in python.
0
python,parsing,apache-config
2008-10-25T23:36:00.000
0
237,209
Red Hat's Emerging Technologies group has Augeas (written in C, but with Python bindings available), a generic system configuration tool with "lenses" for reading and writing several different configuration file formats. I would consider investigating the availability of a lens for Apache.
0
11,646
false
0
1
Any python libs for parsing apache config files?
237,599
1
5
0
4
9
0
0.158649
0
I have a third-party product, a terminal emulator, which provides a DLL that can be linked to a C program to basically automate the driving of this product (send keystrokes, detect what's on the screen and so forth). I want to drive it from a scripting language (I'm comfortable with Python and slightly less so with Perl) so that we don't have to compile and send out executables to our customers whenever there's a problem found. We also want the customers to be able to write their own scripts using ours as baselines and they won't entertain the idea of writing and compiling C code. What's a good way of getting Python/Perl to interface to a Windows DLL. My first thought was to write a server program and have a Python script communicate with it via TCP but there's got to be an easier solution.
0
python,perl,dll
2008-10-27T03:42:00.000
1
239,020
For Python, you could compile an extension which links to the DLL, so that in Python you could just import it like a normal module. You could do this by hand, by using a library like Boost.Python, or by using a tool such as SWIG (which also supports Perl and other scripting languages) to generate a wrapper automatically.
0
3,922
false
0
1
How can I call a DLL from a scripting language?
239,098
2
13
0
0
48
1
0
0
I'm looking for Python code that removes C and C++ comments from a string. (Assume the string contains an entire C source file.) I realize that I could .match() substrings with a Regex, but that doesn't solve nesting /*, or having a // inside a /* */. Ideally, I would prefer a non-naive implementation that properly handles awkward cases.
0
c++,python,c,regex,comments
2008-10-27T20:47:00.000
0
241,327
You don't really need a parse tree to do this perfectly, but you do in effect need the token stream equivalent to what is produced by the compiler's front end. Such a token stream must necessarilyy take care of all the weirdness such as line-continued comment start, comment start in string, trigraph normalization, etc. If you have the token stream, deleting the comments is easy. (I have a tool that produces exactly such token streams, as, guess what, the front end of a real parser that produces a real parse tree :). The fact that the tokens are individually recognized by regular expressions suggests that you can, in principle, write a regular expression that will pick out the comment lexemes. The real complexity of the set regular expressions for the tokenizer (at least the one we wrote) suggests you can't do this in practice; writing them individually was hard enough. If you don't want to do it perfectly, well, then, most of the RE solutions above are just fine. Now, why you would want strip comments is beyond me, unless you are building a code obfuscator. In this case, you have to have it perfectly right.
0
43,080
false
0
1
Remove C and C++ comments using Python?
1,078,406
2
13
0
4
48
1
0.061461
0
I'm looking for Python code that removes C and C++ comments from a string. (Assume the string contains an entire C source file.) I realize that I could .match() substrings with a Regex, but that doesn't solve nesting /*, or having a // inside a /* */. Ideally, I would prefer a non-naive implementation that properly handles awkward cases.
0
c++,python,c,regex,comments
2008-10-27T20:47:00.000
0
241,327
The regular expression cases will fall down in some situations, like where a string literal contains a subsequence which matches the comment syntax. You really need a parse tree to deal with this.
0
43,080
false
0
1
Remove C and C++ comments using Python?
242,110
8
14
0
3
8
0
0.042831
0
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record." The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages that deal mostly with product information and documentation (i.e. a simpler version of www.linksys.com). As an open-source programmer, I'd like to use Python with TurboGears and build it from scratch, but I can't really find a way to prove to the president that TurboGears has a huge enterprise track record. Zope seems to have a lot of enterprise usage, but it looks a bit bloated to me. Django could be an option, but doesn't seem as flexible as TurboGears. I'd rather not use PHP, but Drupal has a very nice resume with the "right" names under it (AOL, Sony, MTV); plus it could save me building many of the CMS components from scratch. Rails might be another option, but I'm not too familiar with it (and as a Python/PHP programmer, Ruby's syntax drives me crazy). What would the S.O. community suggest for a project like this? I'm sure many of you have faced the same dilemma. What ended up working/not working for you? As I said before, my first choice would be Python, second would be PHP, third would be Rails. Thank you, Seth
0
python,frameworks,content-management-system,enterprise
2008-10-27T22:19:00.000
0
241,575
The first thing that comes to mind here is that you're approaching this all wrong. It seems like you're looking for a pet project for yourself and trying to decide what you'd like to do best. You didn't specify the scope of who is going to be managing this site.. which is the real question. Is it just you? Is it the management team? Is it each division? Making a huge decision like this takes a lot of time and thought. We spend a lot of time just helping our clients choose the right CMS for their needs. There are a lot out there and a decision like this is not something to be taken lightly. A lot are good in the right situation and HORRIBLE in others. Also, what is right for you as the developer isn't necessarily right for your end user. As someone up there suggested, you need a lot more research into what the requirements are before anyone (including the developer community) can make any suggestions about what is best to use.
0
4,065
false
1
1
Framework/CMS suggestions for enterprise website & intranet (I've got to convince the president its solid!)
241,773
8
14
0
0
8
0
0
0
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record." The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages that deal mostly with product information and documentation (i.e. a simpler version of www.linksys.com). As an open-source programmer, I'd like to use Python with TurboGears and build it from scratch, but I can't really find a way to prove to the president that TurboGears has a huge enterprise track record. Zope seems to have a lot of enterprise usage, but it looks a bit bloated to me. Django could be an option, but doesn't seem as flexible as TurboGears. I'd rather not use PHP, but Drupal has a very nice resume with the "right" names under it (AOL, Sony, MTV); plus it could save me building many of the CMS components from scratch. Rails might be another option, but I'm not too familiar with it (and as a Python/PHP programmer, Ruby's syntax drives me crazy). What would the S.O. community suggest for a project like this? I'm sure many of you have faced the same dilemma. What ended up working/not working for you? As I said before, my first choice would be Python, second would be PHP, third would be Rails. Thank you, Seth
0
python,frameworks,content-management-system,enterprise
2008-10-27T22:19:00.000
0
241,575
CMS for a medium-big company is not about Software. It is about proccesses and policies. Very true! Association with prestigious names is not necessarily an indicator of pleasing end results. I like Sony products, yes, but on the various occasions on which I have sought support from Sony sites I have felt like banging my head against a brick wall! Those head-cracking sites may not have been Drupal-oriented, I have no idea, but the point is: don't be sucked in by big names alone. An issue you should expect is: preconceptions of what may be achieved (or constrained) by a system. Allow yourself some learning time with Plone — ideally, for a large project such as this, invest in expert advice — and you'll realise that traditional-ish ideas of what a system can or should accomplish are mostly exceeded by Plone's capabilities. Gauge user requirements with a very open mind (not based on simplicities such as "I'd like a system that's equal to system x") then come to plone.org | Support | Chat Room to further discuss your requirements.
0
4,065
false
1
1
Framework/CMS suggestions for enterprise website & intranet (I've got to convince the president its solid!)
294,729
8
14
0
3
8
0
0.042831
0
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record." The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages that deal mostly with product information and documentation (i.e. a simpler version of www.linksys.com). As an open-source programmer, I'd like to use Python with TurboGears and build it from scratch, but I can't really find a way to prove to the president that TurboGears has a huge enterprise track record. Zope seems to have a lot of enterprise usage, but it looks a bit bloated to me. Django could be an option, but doesn't seem as flexible as TurboGears. I'd rather not use PHP, but Drupal has a very nice resume with the "right" names under it (AOL, Sony, MTV); plus it could save me building many of the CMS components from scratch. Rails might be another option, but I'm not too familiar with it (and as a Python/PHP programmer, Ruby's syntax drives me crazy). What would the S.O. community suggest for a project like this? I'm sure many of you have faced the same dilemma. What ended up working/not working for you? As I said before, my first choice would be Python, second would be PHP, third would be Rails. Thank you, Seth
0
python,frameworks,content-management-system,enterprise
2008-10-27T22:19:00.000
0
241,575
I agree with Will's, braveterry's and Divamatrix's comments. Fully. There are tons of questions/issues/risks/considerations to take in order to succesfully launch a CMS solution for a medium/big enterprise. I will not repeat what Will and braveterry had said, instead of it I will offer a different point of view: CMS for a medium-big company is not about Software. It is about proccesses and policies. Which framework/tool to use must be dependent on exact requirements (kind of content, sources for content, who will be responsible to capture and create content, what are their abilities, who will be approving content updates, which departments will have a voice on what goes into the home page?, under which policies will be selected the content for the home page?, what will be the puropose for the home page? (marketing? sales? technical? branding?). If the answers to these questions (there are lot more) are not clear to you or even if you do not get why are SO important. Then I think you need to contract a seasoned consulting firm. PS: This gives me the idea to publish some sort of paper about this topic but that would take some days as I currently do not have the time to prepare it.
0
4,065
false
1
1
Framework/CMS suggestions for enterprise website & intranet (I've got to convince the president its solid!)
241,785
8
14
0
1
8
0
0.014285
0
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record." The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages that deal mostly with product information and documentation (i.e. a simpler version of www.linksys.com). As an open-source programmer, I'd like to use Python with TurboGears and build it from scratch, but I can't really find a way to prove to the president that TurboGears has a huge enterprise track record. Zope seems to have a lot of enterprise usage, but it looks a bit bloated to me. Django could be an option, but doesn't seem as flexible as TurboGears. I'd rather not use PHP, but Drupal has a very nice resume with the "right" names under it (AOL, Sony, MTV); plus it could save me building many of the CMS components from scratch. Rails might be another option, but I'm not too familiar with it (and as a Python/PHP programmer, Ruby's syntax drives me crazy). What would the S.O. community suggest for a project like this? I'm sure many of you have faced the same dilemma. What ended up working/not working for you? As I said before, my first choice would be Python, second would be PHP, third would be Rails. Thank you, Seth
0
python,frameworks,content-management-system,enterprise
2008-10-27T22:19:00.000
0
241,575
No matter what you choose, don't use Typo3. It is a huge unhackable mess with its own idiotic template "script" language, near impossible to learn quickly, hard to teach to your enterprise users and damn ugly. No wonder there are shops which earn a living just doing Typo3 consulting. It is somewhat popular but don't think there is any decent documentation.
0
4,065
false
1
1
Framework/CMS suggestions for enterprise website & intranet (I've got to convince the president its solid!)
241,593
8
14
0
2
8
0
0.028564
0
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record." The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages that deal mostly with product information and documentation (i.e. a simpler version of www.linksys.com). As an open-source programmer, I'd like to use Python with TurboGears and build it from scratch, but I can't really find a way to prove to the president that TurboGears has a huge enterprise track record. Zope seems to have a lot of enterprise usage, but it looks a bit bloated to me. Django could be an option, but doesn't seem as flexible as TurboGears. I'd rather not use PHP, but Drupal has a very nice resume with the "right" names under it (AOL, Sony, MTV); plus it could save me building many of the CMS components from scratch. Rails might be another option, but I'm not too familiar with it (and as a Python/PHP programmer, Ruby's syntax drives me crazy). What would the S.O. community suggest for a project like this? I'm sure many of you have faced the same dilemma. What ended up working/not working for you? As I said before, my first choice would be Python, second would be PHP, third would be Rails. Thank you, Seth
0
python,frameworks,content-management-system,enterprise
2008-10-27T22:19:00.000
0
241,575
You'd like to build an Enterprise Class CMS from scratch? Just for one project? Are you crazy? Unless plan to go into the CMS business and have thousands and thousands of hours of development time there absolutely is no point to create a new one. There are excellent CMS's already out there. Drupal and Plone are the best in my opinion. I like Plone because its delightful to use. It's used by CIA, NASA, Akami, Novell and Ebay. Best wishes, Tony
0
4,065
false
1
1
Framework/CMS suggestions for enterprise website & intranet (I've got to convince the president its solid!)
243,952
8
14
0
9
8
0
1
0
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record." The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages that deal mostly with product information and documentation (i.e. a simpler version of www.linksys.com). As an open-source programmer, I'd like to use Python with TurboGears and build it from scratch, but I can't really find a way to prove to the president that TurboGears has a huge enterprise track record. Zope seems to have a lot of enterprise usage, but it looks a bit bloated to me. Django could be an option, but doesn't seem as flexible as TurboGears. I'd rather not use PHP, but Drupal has a very nice resume with the "right" names under it (AOL, Sony, MTV); plus it could save me building many of the CMS components from scratch. Rails might be another option, but I'm not too familiar with it (and as a Python/PHP programmer, Ruby's syntax drives me crazy). What would the S.O. community suggest for a project like this? I'm sure many of you have faced the same dilemma. What ended up working/not working for you? As I said before, my first choice would be Python, second would be PHP, third would be Rails. Thank you, Seth
0
python,frameworks,content-management-system,enterprise
2008-10-27T22:19:00.000
0
241,575
This is a contradictory statement: "The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages". "Enterprise Class" and "isn't too complicated" do not belong in the same sentence. Seriously. "Enterprise Class" stuff is complicated because "enterprise class" tasks and environments are complicated. Mind, just because something is deployed within an enterprise doesn't mean it requires an "enterprise class" tool. But those that DO have "enterprise class" requirements ARE complicated because the problem domain and deployment environment are complicated. So, you need to be more clear on your specs than "buzzword compliant", "my boss has heard of it", "never breaks", etc. CMS seems deceptively simple, but it's not. If it's geeks managing stuff for geeks, that's one thing, but CMSs tend to have great impact on non-technical end users which can dramatically complicate user interfaces, security, workflows, support, etc. Think "marketing wants to maintain the website", and that they're going to let their junior intern do it. So, seriously, without REAL requirements it's hard to suggest anything. And without REAL requirements, and a solid understanding of your user base, you most certainly should NOT just "roll your own".
0
4,065
false
1
1
Framework/CMS suggestions for enterprise website & intranet (I've got to convince the president its solid!)
241,637
8
14
0
2
8
0
0.028564
0
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record." The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages that deal mostly with product information and documentation (i.e. a simpler version of www.linksys.com). As an open-source programmer, I'd like to use Python with TurboGears and build it from scratch, but I can't really find a way to prove to the president that TurboGears has a huge enterprise track record. Zope seems to have a lot of enterprise usage, but it looks a bit bloated to me. Django could be an option, but doesn't seem as flexible as TurboGears. I'd rather not use PHP, but Drupal has a very nice resume with the "right" names under it (AOL, Sony, MTV); plus it could save me building many of the CMS components from scratch. Rails might be another option, but I'm not too familiar with it (and as a Python/PHP programmer, Ruby's syntax drives me crazy). What would the S.O. community suggest for a project like this? I'm sure many of you have faced the same dilemma. What ended up working/not working for you? As I said before, my first choice would be Python, second would be PHP, third would be Rails. Thank you, Seth
0
python,frameworks,content-management-system,enterprise
2008-10-27T22:19:00.000
0
241,575
"They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record."" There's no proof of those features. None. Is there some incumbent technology that they want you to use? If so, you might be swimming upstream. If you're fighting for your preferred technology, you probably can't win their hearts and minds without a serious proof of concept or pilot project or something. If they're willing to listen, they'd be more willing to listen if you had a demo that showed how rock-solid your preferred approach is. if there is no incumbent, then they're just wringing their hands. In this case, you'll need some evidence they actually believe -- a pilot project or a proof of concept. There's no Proof in this industry. For every technology you can find a proponent and an opponent. Even crap technology has proponents. Forget proof. Just pick something that you can use very rapidly. Get something up and running so quickly, with such high quality that you're obviously right and the rest of your opinions must be equally right. For this reason, flexibility has no value. Go with Django and get something to run ASAP.
0
4,065
false
1
1
Framework/CMS suggestions for enterprise website & intranet (I've got to convince the president its solid!)
241,831
8
14
0
2
8
0
0.028564
0
Dear stack overflow community, I've been given the task of overhauling a couple of websites for a large corporation I'm working for, as well as developing an internal intranet site for content management and document storage within the organization. My "problem" is this: They want me to use a framework/set of languages/technologies that I can prove to them are "stable, enterprise-ready technologies with a proven track record." The spec's "big picture" really isn't too complicated: Implement an enterprise-class CMS for management of each division's web pages that deal mostly with product information and documentation (i.e. a simpler version of www.linksys.com). As an open-source programmer, I'd like to use Python with TurboGears and build it from scratch, but I can't really find a way to prove to the president that TurboGears has a huge enterprise track record. Zope seems to have a lot of enterprise usage, but it looks a bit bloated to me. Django could be an option, but doesn't seem as flexible as TurboGears. I'd rather not use PHP, but Drupal has a very nice resume with the "right" names under it (AOL, Sony, MTV); plus it could save me building many of the CMS components from scratch. Rails might be another option, but I'm not too familiar with it (and as a Python/PHP programmer, Ruby's syntax drives me crazy). What would the S.O. community suggest for a project like this? I'm sure many of you have faced the same dilemma. What ended up working/not working for you? As I said before, my first choice would be Python, second would be PHP, third would be Rails. Thank you, Seth
0
python,frameworks,content-management-system,enterprise
2008-10-27T22:19:00.000
0
241,575
"Enterprise" is a marketing term. It has pretty much zero technical meaning. If your boss wants to hear Enterprise, then he will, but this won't mean that a given system is suitable for your needs. Beware of lists of companies that use a given suite of software. "Ebay uses Plone", and "Ebay runs on Plone" are two very different statements. Mostly, if you're doing "Enterprise" CMS (for whatever that term is worth) you should expect to have a learning curve that will only just begin to flatten out by the end of a significant project. For your project, I'd suggest you try to figure out what you really need. If you think TurboGears (or any other framework) is a good fit, discuss some risk management strategies with your boss. Maybe a small pilot to start with. Adopting a new technology is risky. Many "large corporation" web sites are mission-critical these days. For what it's worth. I like Plone, but I've only ever used it for non-corporate stuff. I don't personally know of any "Enterprise" implementations. At work I use Tridion, and I know of numerous implementations at that level. (If you're looking for a choice that will let you work in Python, Tridion isn't a good fit.)
0
4,065
false
1
1
Framework/CMS suggestions for enterprise website & intranet (I've got to convince the president its solid!)
1,384,018
6
7
0
2
20
0
0.057081
0
which would you recommend? which is faster, reliable? apache mod_python or nginx/lighttpd FastCGI?
0
python,django,apache,fastcgi
2008-10-28T23:16:00.000
0
245,237
I'm using it with nginx. not sure if it's really faster, but certainly less RAM/CPU load. Also it's easier to run several Django processes and have nginx map each URL prefix to a different socket. still not taking full advantage of nginx's memcached module, but first tests show huge speed advantage.
0
5,251
false
1
1
Running Django with FastCGI or with mod_python
245,464
6
7
0
2
20
0
0.057081
0
which would you recommend? which is faster, reliable? apache mod_python or nginx/lighttpd FastCGI?
0
python,django,apache,fastcgi
2008-10-28T23:16:00.000
0
245,237
There's also mod_wsgi, it seems to be faster than mod_python and the daemon mode operates similar to FastCGI
0
5,251
false
1
1
Running Django with FastCGI or with mod_python
245,484
6
7
0
2
20
0
0.057081
0
which would you recommend? which is faster, reliable? apache mod_python or nginx/lighttpd FastCGI?
0
python,django,apache,fastcgi
2008-10-28T23:16:00.000
0
245,237
Personally I've had it working with FastCGI for some time now (6 months or so) and the response times 'seem' quicker when loading a page that way vs mod___python. The critical reason for me though is that I couldn't see an obvious way to do multiple sites from the same apache / mod_python install whereas FastCGI was a relative no-brainer. I've not conducted any particularly thorough experiments though :-) [Edit] Speaking from experience though, setting up FastCGI can be a bit of a pain the first time around. I keep meaning to write a guide..!
0
5,251
false
1
1
Running Django with FastCGI or with mod_python
245,259
6
7
0
5
20
0
0.141893
0
which would you recommend? which is faster, reliable? apache mod_python or nginx/lighttpd FastCGI?
0
python,django,apache,fastcgi
2008-10-28T23:16:00.000
0
245,237
Nginx with mod_wsgi
0
5,251
false
1
1
Running Django with FastCGI or with mod_python
258,159
6
7
0
21
20
0
1.2
0
which would you recommend? which is faster, reliable? apache mod_python or nginx/lighttpd FastCGI?
0
python,django,apache,fastcgi
2008-10-28T23:16:00.000
0
245,237
I've done both, and Apache/mod_python tended to be easier to work with and more stable. But these days I've jumped over to Apache/mod_wsgi, which is everything I've ever wanted and more: Easy management of daemon processes. As a result, much better process isolation (running multiple sites in the same Apache config with mod_python almost always ends in trouble -- environment variables and C extensions leak across sites when you do that). Easy code reloads (set it up right and you can just touch the .wsgi file to reload instead of restarting Apache). More predictable resource usage. With mod_python, a given Apache child process' memory use can jump around a lot. With mod_wsgi it's pretty stable: once everything's loaded, you know that's how much memory it'll use.
0
5,251
true
1
1
Running Django with FastCGI or with mod_python
245,660
6
7
0
6
20
0
1
0
which would you recommend? which is faster, reliable? apache mod_python or nginx/lighttpd FastCGI?
0
python,django,apache,fastcgi
2008-10-28T23:16:00.000
0
245,237
lighttpd with FastCGI will be nominally faster, but really the time it takes to run your python code and any database hits it does is going to absolutely dwarf any performance benefit you get between web servers. mod_python and apache will give you a bit more flexibility feature-wise if you want to write code outside of django that does stuff like digest auth, or any fancy HTTP header getting/setting. Perhaps you want to use other builtin features of apache such as mod_rewrite. If memory is a concern, staying away form apache/mod_python will help a lot. Apache tends to use a lot of RAM, and the mod_python code that glues into all of the apache functionality occupies a lot of memory-space as well. Not to mention the multiprocess nature of apache tends to eat up more RAM, as each process grows to the size of it's most intensive request.
0
5,251
false
1
1
Running Django with FastCGI or with mod_python
245,264
4
11
0
12
37
1
1.2
0
When I see Lua, the only thing I ever read is "great for embedding", "fast", "lightweight" and more often than anything else: "World of Warcraft" or in short "WoW". Why is it limited to embedding the whole thing into another application? Why not write general-purpose scripts like you do with Python or Perl? Lua seems to be doing great in aspects like speed and memory-usage (The fastest scripting language afaik) so why is it that I never see Lua being used as a "Desktop scripting-language" to automate tasks? For example: Renaming a bunch of files Download some files from the web Webscraping Is it the lack of the standard library?
0
python,scripting,lua
2008-10-30T13:21:00.000
0
250,151
Just because it is "marketed" (in some general sense) as a special-purpose language for embedded script engines, does not mean that it is limited to that. In fact, WoW could probably just as well have chosen Python as their embedded scripting language.
0
12,626
true
0
1
Lua as a general-purpose scripting language?
250,158
4
11
0
3
37
1
0.054491
0
When I see Lua, the only thing I ever read is "great for embedding", "fast", "lightweight" and more often than anything else: "World of Warcraft" or in short "WoW". Why is it limited to embedding the whole thing into another application? Why not write general-purpose scripts like you do with Python or Perl? Lua seems to be doing great in aspects like speed and memory-usage (The fastest scripting language afaik) so why is it that I never see Lua being used as a "Desktop scripting-language" to automate tasks? For example: Renaming a bunch of files Download some files from the web Webscraping Is it the lack of the standard library?
0
python,scripting,lua
2008-10-30T13:21:00.000
0
250,151
In order for Lua to be easy to embed it has to have few dependencies and be small. That makes it poorly suited as a general purpose scripting language. Because using it as a general purpose script language would require a lot of standard libraries. But if Lua had a lot of standard libraries it would be harder to embed (due to dependencies and memory footprint.)
0
12,626
false
0
1
Lua as a general-purpose scripting language?
781,316
4
11
0
4
37
1
0.072599
0
When I see Lua, the only thing I ever read is "great for embedding", "fast", "lightweight" and more often than anything else: "World of Warcraft" or in short "WoW". Why is it limited to embedding the whole thing into another application? Why not write general-purpose scripts like you do with Python or Perl? Lua seems to be doing great in aspects like speed and memory-usage (The fastest scripting language afaik) so why is it that I never see Lua being used as a "Desktop scripting-language" to automate tasks? For example: Renaming a bunch of files Download some files from the web Webscraping Is it the lack of the standard library?
0
python,scripting,lua
2008-10-30T13:21:00.000
0
250,151
I think the answer about it being a "marketing" thing is probably correct, along with the lack of a large set of libraries to choose from. I would like to point out another case of this: Ruby. Ruby is meant to be a general purpose scripting language. The problem is that since Ruby on Rails has risen to be so popular, it is becoming hard to find something that is unrelated to Rails. I'm afraid Lua will suffer this as well, being popular because of a few major things using it, but never able to break free of that stigma.
0
12,626
false
0
1
Lua as a general-purpose scripting language?
253,659
4
11
0
6
37
1
1
0
When I see Lua, the only thing I ever read is "great for embedding", "fast", "lightweight" and more often than anything else: "World of Warcraft" or in short "WoW". Why is it limited to embedding the whole thing into another application? Why not write general-purpose scripts like you do with Python or Perl? Lua seems to be doing great in aspects like speed and memory-usage (The fastest scripting language afaik) so why is it that I never see Lua being used as a "Desktop scripting-language" to automate tasks? For example: Renaming a bunch of files Download some files from the web Webscraping Is it the lack of the standard library?
0
python,scripting,lua
2008-10-30T13:21:00.000
0
250,151
Definitely a lack of standard libraries. It's also lesser known than Python, Perl or Ruby.
0
12,626
false
0
1
Lua as a general-purpose scripting language?
251,372
2
3
0
12
19
0
1
0
What's the difference between these two? Which is better/faster/reliable?
0
python,wsgi,scgi
2008-11-02T22:22:00.000
0
257,481
SCGI (like FastCGI) is a (serialized) protocol suitable for inter-process communication between a web-server and a web-application. WSGI is a Python API, connecting two (or more) Python WSGI-compatible modules inside the same process (Python interpreter). One module represents the web-server (being either a Python in-process web-server implementation or a gateway to a web-server in another process via e.g. SCGI). The other module is or represents the web application. Additionally, zero or more modules between theses two modules, may serve as WSGI "middleware" modules, doing things like session/cookie management, content caching, authentication, etc. The WSGI API uses Python language features like iteration/generators and passing of callable objects between the cooperating WSGI-compatible modules.
0
16,163
false
0
1
What's the difference between scgi and wsgi?
778,530
2
3
0
27
19
0
1.2
0
What's the difference between these two? Which is better/faster/reliable?
0
python,wsgi,scgi
2008-11-02T22:22:00.000
0
257,481
SCGI is a language-neutral means of connecting a front-end web server and a web application. WSGI is a Python-specific interface standard for web applications. Though they both have roots in CGI, they're rather different in scope and you could indeed quite reasonably use both at once, for example having a mod_scgi on the webserver talk to a WSGI app run as an SCGI server. There are multiple library implementations that will run WSGI applications as SCGI servers for you (eg. wsgitools, cherrypy). They are both 'reliable', in as much as you can consider a specification reliable as opposed to a particular implementation. These days you would probably write your application as a WSGI callable, and consider the question of deployment separately. Maybe an Apache+mod_wsgi (embedded) interface might be a bit faster than an Apache+mod_scgi+(SCGI wrapper lib), but in all likelihood it's not going to be hugely different. More valuable is the ability to run the application on a variety of servers, platforms and connection standards.
0
16,163
true
0
1
What's the difference between scgi and wsgi?
257,642
7
10
0
3
35
0
0.059928
0
Considering the criteria listed below, which of Python, Groovy or Ruby would you use? Criteria (Importance out of 10, 10 being most important) Richness of API/libraries available (eg. maths, plotting, networking) (9) Ability to embed in desktop (java/c++) applications (8) Ease of deployment (8) Ability to interface with DLLs/Shared Libraries (7) Ability to generate GUIs (7) Community/User support (6) Portability (6) Database manipulation (3) Language/Semantics (2)
0
python,ruby,scripting,groovy
2008-11-03T01:31:00.000
0
257,730
This sort of adding-up-scores-by-features is not a good way to choose a programming language. You'd be better off choosing whichever you know the best. If you don't know any of them, try them out for a little while. If you have a really specific project in mind, then maybe some programming languages would be better, but if you just have general preferences you will never come to a consensus. That said, Python is pretty flexible, it's the most popular on your list so the easiest to solve whatever sorts of problems you have by searching, so I'd recommend Python.
0
36,111
false
1
1
Python vs Groovy vs Ruby? (based on criteria listed in question)
257,770
7
10
0
33
35
0
1.2
0
Considering the criteria listed below, which of Python, Groovy or Ruby would you use? Criteria (Importance out of 10, 10 being most important) Richness of API/libraries available (eg. maths, plotting, networking) (9) Ability to embed in desktop (java/c++) applications (8) Ease of deployment (8) Ability to interface with DLLs/Shared Libraries (7) Ability to generate GUIs (7) Community/User support (6) Portability (6) Database manipulation (3) Language/Semantics (2)
0
python,ruby,scripting,groovy
2008-11-03T01:31:00.000
0
257,730
I think it's going to be difficult to get an objective comparison. I personally prefer Python. To address one of your criteria, Python was designed from the start to be an embeddable language. It has a very rich C API, and the interpreter is modularized to make it easy to call from C. If Java is your host environment, you should look at Jython, an implementation of Python inside the Java environment (VM and libs).
0
36,111
true
1
1
Python vs Groovy vs Ruby? (based on criteria listed in question)
257,746
7
10
0
28
35
0
1
0
Considering the criteria listed below, which of Python, Groovy or Ruby would you use? Criteria (Importance out of 10, 10 being most important) Richness of API/libraries available (eg. maths, plotting, networking) (9) Ability to embed in desktop (java/c++) applications (8) Ease of deployment (8) Ability to interface with DLLs/Shared Libraries (7) Ability to generate GUIs (7) Community/User support (6) Portability (6) Database manipulation (3) Language/Semantics (2)
0
python,ruby,scripting,groovy
2008-11-03T01:31:00.000
0
257,730
Having worked with all 3 of them, this is what I can say: Python has very mature libraries libraries are documented documentation can be accessed from your debugger/shell at runtime through the docstrings you can develop code without an IDE Ruby has some great libraries ( even though some are badly documented ) Ruby's instrospection mechanisms are great. They make writing code pretty easy ( even if documentation is not available ) you can develop code without an IDE Groovy you can benefit from everything Java has to offer syntax is somewhat inspired from Ruby it's hard to write code without an IDE. You have no way to debug stuff from your console ( this is something you can easily do in Python/Ruby ) and the available Groovy plugins have a lot of catching up to do. I wrote some apps using Groovy and as they get bigger I regret not going with Ruby/Python ( debugging would have been WAY more easier ). If you'll only develop from an IDE, Groovy's a cool language.
0
36,111
false
1
1
Python vs Groovy vs Ruby? (based on criteria listed in question)
1,401,616
7
10
0
8
35
0
1
0
Considering the criteria listed below, which of Python, Groovy or Ruby would you use? Criteria (Importance out of 10, 10 being most important) Richness of API/libraries available (eg. maths, plotting, networking) (9) Ability to embed in desktop (java/c++) applications (8) Ease of deployment (8) Ability to interface with DLLs/Shared Libraries (7) Ability to generate GUIs (7) Community/User support (6) Portability (6) Database manipulation (3) Language/Semantics (2)
0
python,ruby,scripting,groovy
2008-11-03T01:31:00.000
0
257,730
try Groovy .. it has all features that you need there. You can use existing java lib without any modification on its classes. basically .. groovy is java++, it is more dynamic and fun to learn (just like ruby) I dont like ruby or python syntax so I will put them behind. Groovy is just like C/C++ syntax so I like him lol :)
0
36,111
false
1
1
Python vs Groovy vs Ruby? (based on criteria listed in question)
326,962
7
10
0
7
35
0
1
0
Considering the criteria listed below, which of Python, Groovy or Ruby would you use? Criteria (Importance out of 10, 10 being most important) Richness of API/libraries available (eg. maths, plotting, networking) (9) Ability to embed in desktop (java/c++) applications (8) Ease of deployment (8) Ability to interface with DLLs/Shared Libraries (7) Ability to generate GUIs (7) Community/User support (6) Portability (6) Database manipulation (3) Language/Semantics (2)
0
python,ruby,scripting,groovy
2008-11-03T01:31:00.000
0
257,730
Python has all nine criteria. It scores a 56. I'm sure Ruby has everything Python has. It seems to have fewer libraries. So it scores a 51. I don't know if Groovy has every feature. Since Python is 56 and Ruby is a 51, Python just barely edges out Ruby. However, I think this kind of decision can still boil down to some subjective issues outside these nine criteria.
0
36,111
false
1
1
Python vs Groovy vs Ruby? (based on criteria listed in question)
257,831
7
10
0
24
35
0
1
0
Considering the criteria listed below, which of Python, Groovy or Ruby would you use? Criteria (Importance out of 10, 10 being most important) Richness of API/libraries available (eg. maths, plotting, networking) (9) Ability to embed in desktop (java/c++) applications (8) Ease of deployment (8) Ability to interface with DLLs/Shared Libraries (7) Ability to generate GUIs (7) Community/User support (6) Portability (6) Database manipulation (3) Language/Semantics (2)
0
python,ruby,scripting,groovy
2008-11-03T01:31:00.000
0
257,730
Just to muddy the waters... Groovy give you access to Java. Java has an extremely rich set of APIs/Libraries, applications, etc. Groovy is embeddable, although easiest in Java. DLLs/Libraries (if you're talking about non-Groovy/Java) may be somewhat problematic, although there are ways and some APIs to help. I've done some Python programming, but being more familiar with Java, Groovy comes a lot easier to me.
0
36,111
false
1
1
Python vs Groovy vs Ruby? (based on criteria listed in question)
257,776
7
10
0
0
35
0
0
0
Considering the criteria listed below, which of Python, Groovy or Ruby would you use? Criteria (Importance out of 10, 10 being most important) Richness of API/libraries available (eg. maths, plotting, networking) (9) Ability to embed in desktop (java/c++) applications (8) Ease of deployment (8) Ability to interface with DLLs/Shared Libraries (7) Ability to generate GUIs (7) Community/User support (6) Portability (6) Database manipulation (3) Language/Semantics (2)
0
python,ruby,scripting,groovy
2008-11-03T01:31:00.000
0
257,730
I know it's not on your list, but at least look at perl. Richness of Api/Libraries to sink a ship. Runs on more systems than most people realise exists. Works well with Binary libraries. Has a huge community. Portability, See above. Database manipulation: more ways to do it. ( Pick your favorite module ) And one of the most expressive/terse languages around.
0
36,111
false
1
1
Python vs Groovy vs Ruby? (based on criteria listed in question)
257,738
2
10
0
14
355
1
1
0
A colleague is looking to generate UML class diagrams from heaps of Python source code. He's primarily interested in the inheritance relationships, and mildly interested in compositional relationships, and doesn't care much about class attributes that are just Python primitives. The source code is pretty straightforward and not tremendously evil--it doesn't do any fancy metaclass magic, for example. (It's mostly from the days of Python 1.5.2, with some sprinklings of "modern" 2.3ish stuff.) What's the best existing solution to recommend?
0
python,uml,diagram
2008-11-03T22:08:00.000
0
260,165
Certain classes of well-behaved programs may be diagrammable, but in the general case, it can't be done. Python objects can be extended at run time, and objects of any type can be assigned to any instance variable. Figuring out what classes an object can contain pointers to (composition) would require a full understanding of the runtime behavior of the program. Python's metaclass capabilities mean that reasoning about the inheritance structure would also require a full understanding of the runtime behavior of the program. To prove that these are impossible, you argue that if such a UML diagrammer existed, then you could take an arbitrary program, convert "halt" statements into statements that would impact the UML diagram, and use the UML diagrammer to solve the halting problem, which as we know is impossible.
0
274,257
false
0
1
What's the best way to generate a UML diagram from Python source code?
260,196
2
10
0
5
355
1
0.099668
0
A colleague is looking to generate UML class diagrams from heaps of Python source code. He's primarily interested in the inheritance relationships, and mildly interested in compositional relationships, and doesn't care much about class attributes that are just Python primitives. The source code is pretty straightforward and not tremendously evil--it doesn't do any fancy metaclass magic, for example. (It's mostly from the days of Python 1.5.2, with some sprinklings of "modern" 2.3ish stuff.) What's the best existing solution to recommend?
0
python,uml,diagram
2008-11-03T22:08:00.000
0
260,165
Umbrello does that too. in the menu go to Code -> import project and then point to the root deirectory of your project. then it reverses the code for ya...
0
274,257
false
0
1
What's the best way to generate a UML diagram from Python source code?
6,606,829
1
25
0
-1
135
0
-0.008
0
How can I play audio (it would be like a 1 second sound) from a Python script? It would be best if it was platform independent, but firstly it needs to work on a Mac. I know I could just execute the afplay file.mp3 command from within Python, but is it possible to do it in raw Python? I would also be better if it didn't rely on external libraries.
0
python,audio
2008-11-04T03:11:00.000
1
260,738
If you're on OSX, you can use the "os" module or "subprocess" etc. to call the OSX "play" command. From the OSX shell, it looks like play "bah.wav" It starts to play in about a half-second on my machine.
0
259,664
false
0
1
Play audio with Python
22,689,253
1
2
0
1
2
0
1.2
1
I'm conducting experiments regarding e-mail spam. One of these experiments require sending mail thru Tor. Since I'm using Python and smtplib for my experiments, I'm looking for a way to use the Tor proxy (or other method) to perform that mail sending. Ideas how this can be done?
0
python,smtp,tor
2008-11-05T21:50:00.000
0
266,849
Because of abuse by spammers, many Tor egress nodes decline to emit port 25 (SMTP) traffic, so you may have problems.
0
2,405
true
0
1
Using Python's smtplib with Tor
275,164
1
3
0
1
18
1
0.066568
0
I'm writing some mail-processing software in Python that is encountering strange bytes in header fields. I suspect this is just malformed mail; the message itself claims to be us-ascii, so I don't think there is a true encoding, but I'd like to get out a unicode string approximating the original one without throwing a UnicodeDecodeError. So, I'm looking for a function that takes a str and optionally some hints and does its darndest to give me back a unicode. I could write one of course, but if such a function exists its author has probably thought a bit deeper about the best way to go about this. I also know that Python's design prefers explicit to implicit and that the standard library is designed to avoid implicit magic in decoding text. I just want to explicitly say "go ahead and guess".
0
python,email,character-encoding,invalid-characters
2008-11-06T15:18:00.000
0
269,060
The best way to do this that I've found is to iteratively try decoding a prospective with each of the most common encodings inside of a try except block.
0
12,045
false
0
1
Is there a Python library function which attempts to guess the character-encoding of some bytes?
271,058
1
2
0
8
3
1
1
0
I have a web API that returns python dictionaries or lists as a response that I eval() in python scripts that use the API, for completness I wanted to set a proper content-type but not sure what would be best to use "text/x-python" or maybe "application/python", or something else? [edit] I'm also outputting JSON, I'm doing Python as an option mainly for internal use.[/edit]
0
python,http,mime-types
2008-11-06T16:19:00.000
0
269,292
I doubt there's an established MIME type. Have you considered using JSON instead, it is almost the same as a Python dict, and has a better established culture of tools and techniques.
0
3,601
false
0
1
What mime-type should I return for a python string
269,364
2
5
0
5
13
0
0.197375
1
I develop a client-server style, database based system and I need to devise a way to stress / load test the system. Customers inevitably want to know such things as: • How many clients can a server support? • How many concurrent searches can a server support? • How much data can we store in the database? • Etc. Key to all these questions is response time. We need to be able to measure how response time and performance degrades as new load is introduced so that we could for example, produce some kind of pretty graph we could throw at clients to give them an idea what kind of performance to expect with a given hardware configuration. Right now we just put out fingers in the air and make educated guesses based on what we already know about the system from experience. As the product is put under more demanding conditions, this is proving to be inadequate for our needs going forward though. I've been given the task of devising a method to get such answers in a meaningful way. I realise that this is not a question that anyone can answer definitively but I'm looking for suggestions about how people have gone about doing such work on their own systems. One thing to note is that we have full access to our client API via the Python language (courtesy of SWIG) which is a lot easier to work with than C++ for this kind of work. So there we go, I throw this to the floor: really interested to see what ideas you guys can come up with!
0
python,database,client-server,load-testing,stress-testing
2008-11-07T11:35:00.000
0
271,825
For performance you are looking at two things: latency (the responsiveness of the application) and throughput (how many ops per interval). For latency you need to have an acceptable benchmark. For throughput you need to have a minimum acceptable throughput. These are you starting points. For telling a client how many xyz's you can do per interval then you are going to need to know the hardware and software configuration. Knowing the production hardware is important to getting accurate figures. If you do not know the hardware configuration then you need to devise a way to map your figures from the test hardware to the eventual production hardware. Without knowledge of hardware then you can really only observe trends in performance over time rather than absolutes. Knowing the software configuration is equally important. Do you have a clustered server configuration, is it load balanced, is there anything else running on the server? Can you scale your software or do you have to scale the hardware to meet demand. To know how many clients you can support you need to understand what is a standard set of operations. A quick test is to remove the client and write a stub client and the spin up as many of these as you can. Have each one connect to the server. You will eventually reach the server connection resource limit. Without connection pooling or better hardware you can't get higher than this. Often you will hit a architectural issue before here but in either case you have an upper bounds. Take this information and design a script that your client can enact. You need to map how long your script takes to perform the action with respect to how long it will take the expected user to do it. Start increasing your numbers as mentioned above to you hit the point where the increase in clients causes a greater decrease in performance. There are many ways to stress test but the key is understanding expected load. Ask your client about their expectations. What is the expected demand per interval? From there you can work out upper loads. You can do a soak test with many clients operating continously for many hours or days. You can try to connect as many clients as you can as fast you can to see how well your server handles high demand (also a DOS attack). Concurrent searches should be done through your standard behaviour searches acting on behalf of the client or, write a script to establish a semaphore that waits on many threads, then you can release them all at once. This is fun and punishes your database. When performing searches you need to take into account any caching layers that may exist. You need to test both caching and without caching (in scenarios where everyone makes unique search requests). Database storage is based on physical space; you can determine row size from the field lengths and expected data population. Extrapolate this out statistically or create a data generation script (useful for your load testing scenarios and should be an asset to your organisation) and then map the generated data to business objects. Your clients will care about how many "business objects" they can store while you will care about how much raw data can be stored. Other things to consider: What is the expected availability? What about how long it takes to bring a server online. 99.9% availability is not good if it takes two days to bring back online the one time it does go down. On the flip side a lower availablility is more acceptable if it takes 5 seconds to reboot and you have a fall over.
0
10,487
false
0
1
How should I stress test / load test a client server application?
271,918
2
5
0
0
13
0
0
1
I develop a client-server style, database based system and I need to devise a way to stress / load test the system. Customers inevitably want to know such things as: • How many clients can a server support? • How many concurrent searches can a server support? • How much data can we store in the database? • Etc. Key to all these questions is response time. We need to be able to measure how response time and performance degrades as new load is introduced so that we could for example, produce some kind of pretty graph we could throw at clients to give them an idea what kind of performance to expect with a given hardware configuration. Right now we just put out fingers in the air and make educated guesses based on what we already know about the system from experience. As the product is put under more demanding conditions, this is proving to be inadequate for our needs going forward though. I've been given the task of devising a method to get such answers in a meaningful way. I realise that this is not a question that anyone can answer definitively but I'm looking for suggestions about how people have gone about doing such work on their own systems. One thing to note is that we have full access to our client API via the Python language (courtesy of SWIG) which is a lot easier to work with than C++ for this kind of work. So there we go, I throw this to the floor: really interested to see what ideas you guys can come up with!
0
python,database,client-server,load-testing,stress-testing
2008-11-07T11:35:00.000
0
271,825
If you have the budget, LoadRunner would be perfect for this.
0
10,487
false
0
1
How should I stress test / load test a client server application?
271,891
2
5
1
23
41
0
1.2
0
I'm currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our program. The alternatives I tried were: Boost.Python I liked the cleaner API produced by Boost.Python, but the fact that it would have required that users install an additional dependency made us switch to SWIG. SWIG SWIG's main advantage for us was that it doesn't require end users to install it to use the final program. What have you used to do this, and what has been your experience with it?
0
c++,python,boost,swig
2008-11-10T00:34:00.000
0
276,761
I've used both (for the same project): Boost is better integrated with the STL, and especially C++ exceptions. Also, its memory management mechanism (which tries to bridge C++ memory management and Python GC) is way more flexible than SWIG's. However, SWIG has much better documentation, no external dependencies, and if you get the library wrapped in SWIG for Python you're more than half-way there to getting a Java/Perl/Ruby wrapper as well. I don't think there's a clear-cut choice: for smaller projects, I'd go with Boost.Python again, for larger long-lived projects, the extra investment in SWIG is worth it.
0
12,800
true
0
1
Exposing a C++ API to Python
277,306
2
5
1
2
41
0
0.07983
0
I'm currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our program. The alternatives I tried were: Boost.Python I liked the cleaner API produced by Boost.Python, but the fact that it would have required that users install an additional dependency made us switch to SWIG. SWIG SWIG's main advantage for us was that it doesn't require end users to install it to use the final program. What have you used to do this, and what has been your experience with it?
0
c++,python,boost,swig
2008-11-10T00:34:00.000
0
276,761
A big plus for Boost::Python is that it allows for tab completion in the ipython shell: You import a C++ class, exposed by Boost directly, or you subclass it, and from then on, it really behaves like a pure Python class. The downside: It takes so long to install and use Boost that all the Tab-completion time-saving won't ever amortize ;-( So I prefer Swig: No bells and whistles, but works reliably after a short introductory example.
0
12,800
false
0
1
Exposing a C++ API to Python
847,688
2
3
0
0
1
0
0
0
I am opening a process (with os.popen() ) that, for some commands, detects certain keypresses (e.g. ESC - not the character, the key). Is there a way to send keypress events to the process?
0
python,keypress,popen
2008-11-10T22:41:00.000
1
279,434
What platform is this on? You may have to actually feed events into the event loop, if it's running on Win32.
0
2,607
false
0
1
Python: How do I generate a keypress?
279,627
2
3
0
0
1
0
0
0
I am opening a process (with os.popen() ) that, for some commands, detects certain keypresses (e.g. ESC - not the character, the key). Is there a way to send keypress events to the process?
0
python,keypress,popen
2008-11-10T22:41:00.000
1
279,434
The obvious way would be to start the process in it's own shell. something like os.popen("sh command")
0
2,607
false
0
1
Python: How do I generate a keypress?
279,460
2
5
0
1
5
0
0.039979
0
I have a j2me client that would post some chunked encoded data to a webserver. I'd like to process the data in python. The script is being run as a CGI one, but apparently apache will refuse a chunked encoded post request to a CGI script. As far as I could see mod_python, WSGI and FastCGI are no go too. I'd like to know if there is a way to have a python script process this kind of input. I'm open to any suggestion (e.g. a confoguration setting in apache2 that would assemble the chunks, a standalone python server that would do the same, etc.) I did quite a bit of googling and didn't find anything usable, which is quite strange. I know that resorting to java on the server side would be a solution, but I just can't imagine that this can't be solved with apache + python.
0
python,http,post,java-me,midlet
2008-11-12T17:50:00.000
0
284,741
Maybe it is a configuration issue? Django can be fronted with Apache by mod_python, WSGI and FastCGI and it can accept file uploads.
0
5,471
false
1
1
Processing chunked encoded HTTP POST requests in python (or generic CGI under apache)
284,857
2
5
0
2
5
0
0.07983
0
I have a j2me client that would post some chunked encoded data to a webserver. I'd like to process the data in python. The script is being run as a CGI one, but apparently apache will refuse a chunked encoded post request to a CGI script. As far as I could see mod_python, WSGI and FastCGI are no go too. I'd like to know if there is a way to have a python script process this kind of input. I'm open to any suggestion (e.g. a confoguration setting in apache2 that would assemble the chunks, a standalone python server that would do the same, etc.) I did quite a bit of googling and didn't find anything usable, which is quite strange. I know that resorting to java on the server side would be a solution, but I just can't imagine that this can't be solved with apache + python.
0
python,http,post,java-me,midlet
2008-11-12T17:50:00.000
0
284,741
Apache 2.2 mod_cgi works fine for me, Apache transparently unchunks the request as it is passed to the CGI application. WSGI currently disallows chunked requests, and mod_wsgi does indeed block them with a 411 response. It's on the drawing board for WSGI 2.0. But congratulations on finding something that does chunk requests, I've never seen one before!
0
5,471
false
1
1
Processing chunked encoded HTTP POST requests in python (or generic CGI under apache)
284,869
1
5
0
2
6
0
0.07983
1
Let's say I wanted to make a python script interface with a site like Twitter. What would I use to do that? I'm used to using curl/wget from bash, but Python seems to be much nicer to use. What's the equivalent? (This isn't Python run from a webserver, but run locally via the command line)
0
python,web-services,twitter
2008-11-12T20:28:00.000
0
285,226
Python has a very nice httplib module as well as a url module which together will probably accomplish most of what you need (at least with regards to wget functionality).
0
839
false
0
1
What Python tools can I use to interface with a website's API?
285,252
1
4
0
1
26
0
1.2
1
I need to connect to an Exchange mailbox in a Python script, without using any profile setup on the local machine (including using Outlook). If I use win32com to create a MAPI.Session I could logon (with the Logon() method) with an existing profile, but I want to just provide a username & password. Is this possible? If so, could someone provide example code? I would prefer if it only used the standard library and the pywin32 package. Unfortunately, enabling IMAP access for the Exchange server (and then using imaplib) is not possible. In case it is necessary: all the script will be doing is connecting to the mailbox, and running through the messages in the Inbox, retrieving the contents. I can handle writing the code for that, if I can get a connection in the first place! To clarify regarding Outlook: Outlook will be installed on the local machine, but it does not have any accounts setup (i.e. all the appropriate libraries will be available, but I need to operate independently from anything setup inside of Outlook).
0
python,email,connection,exchange-server,pywin32
2008-11-13T22:19:00.000
0
288,546
I'm pretty sure this is going to be impossible without using Outlook and a MAPI profile. If you can sweet talk your mail admin into enabling IMAP on the Exchange server it would make your life a lot easier.
0
107,535
true
0
1
Connect to Exchange mailbox with Python
288,569
1
1
0
2
2
0
1.2
0
I would like my python script to search through a directory in SVN, locate the files ending with a particular extension (eg. *.exe), and copy these files to a directory that has been created in my C drive. How can I do this? I'm new to Python so a detailed response and/or point in the right direction would be very much appreciated. Follow-up: When using os.walk what parameter would I pass in to ensure that I'm copying files with a specific extension (eg. *.exe)?
0
python,svn,file
2008-11-14T21:16:00.000
1
291,467
I think it is easiest to check out (or, better, export) the source tree using the svn command line utility: you can use os.system to invoke it. There are also direct Python-to-svn API bindings, but I would advise against using them if you are new to Python. You can then traverse the checkout folder, e.g. using os.walk; the copying itself can be done with shutil.copy.
0
1,000
true
0
1
Search directory in SVN for files with specific file extension and copy to another folder?
291,477
1
2
0
5
12
0
0.462117
0
I need to set my process to run under 'nobody', I've found os.setuid(), but how do I find uid if I have login? I've found out that uids are in /etc/passwd, but maybe there is a more pythonic way than scanning /etc/passwd. Anybody?
0
python,linux,unix,process-management
2008-11-16T22:11:00.000
1
294,470
Never directly scan /etc/passwd. For instance, on a Linux system I administer, the user accounts are not on /etc/passwd, but on a LDAP server. The correct way is to use getpwent/getgrent and related C functions (as in @TFKyle's answer), which will get the information on the correct way for each system (on Linux glibc, it reads /etc/nsswitch.conf to know which NSS dynamic libraries to load to get the information).
0
4,216
false
0
1
How do I find userid by login (Python under *NIX)
294,535
1
3
0
2
1
1
0.132549
0
I have a port scanning application that uses work queues and threads. It uses simple TCP connections and spends a lot of time waiting for packets to come back (up to half a second). Thus the threads don't need to fully execute (i.e. first half sends a packet, context switch, does stuff, comes back to thread which has network data waiting for it). I suspect I can improve performance by modifying the sys.setcheckinterval from the default of 100 (which lets up to 100 bytecodes execute before switching to another thread). But without knowing how many bytecodes are actually executing in a thread or function I'm flying blind and simply guessing values, testing and relying on the testing shows a measurable difference (which is difficult since the amount of code being executed is minimal; a simple socket connection, thus network jitter will likely affect any measurements more than changing sys.setcheckinterval). Thus I would like to find out how many bytecodes are in certain code executions (i.e. total for a function or in execution of a thread) so I can make more intelligent guesses at what to set sys.setcheckinterval to.
0
python,performance,multithreading,internals
2008-11-17T05:44:00.000
0
294,963
Reasoning about a system of this complexity will rarely produce the right answer. Measure the results, and use the setting that runs the fastest. If as you say, testing can't measure the difference in various settings of setcheckinterval, then why bother changing it? Only measurable differences are interesting. If your test run is too short to provide meaningful data, then make the run longer until it does.
0
728
false
0
1
How do I count bytecodes in Python so I can modify sys.setcheckinterval appropriately
297,747
3
8
0
8
70
0
1
0
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Thrift, and Protocol Buffers on Linux? Primarily languages will be Java, C/C++, Python, and PHP. Update: I'm still very interested in this, if anyone has done any further benchmarks please let me know. Also, very interesting benchmark showing compressed JSON performing similar / better than Thrift / Protocol Buffers, so I'm throwing JSON into this question as well.
0
java,python,performance,protocol-buffers,thrift
2008-11-17T19:48:00.000
1
296,650
I did test performance of PB with number of other data formats (xml, json, default object serialization, hessian, one proprietary one) and libraries (jaxb, fast infoset, hand-written) for data binding task (both reading and writing), but thrift's format(s) was not included. Performance for formats with multiple converters (like xml) had very high variance, from very slow to pretty-darn-fast. Correlation between claims of authors and perceived performance was rather weak. Especially so for packages that made wildest claims. For what it is worth, I found PB performance to be bit over hyped (usually not by its authors, but others who only know who wrote it). With default settings it did not beat fastest textual xml alternative. With optimized mode (why is this not default?), it was bit faster, comparable with the fastest JSON package. Hessian was rather fast, textual json also. Properietary binary format (no name here, it was company internal) was the slowest. Java object serialization was fast for larger messages, less so for small objects (i.e. high fixed per-operation noverhead). With PB message size was compact, but given all trade-offs you have to do (data is not self-descriptive: if you lose the schema, you lose data; there are indexes of course, and value types, but from what you have reverse-engineer back to field names if you want), I personally would only choose it for specific use cases -- size-sensitive, closely coupled system where interface/format never (or very very rarely) changes. My opinion in this is that (a) implementation often matters more than specification (of data format), (b) end-to-end, differences between best-of-breed (for different formats) are usually not big enough to dictate the choice. That is, you may be better off choosing format+API/lib/framework you like using most (or has best tool support), find best implementation, and see if that works fast enough. If (and only if!) not, consider next best alternative. ps. Not sure what EJB3 here would be. Maybe just plain of Java serialization?
0
64,229
false
0
1
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
628,329
3
8
0
5
70
0
0.124353
0
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Thrift, and Protocol Buffers on Linux? Primarily languages will be Java, C/C++, Python, and PHP. Update: I'm still very interested in this, if anyone has done any further benchmarks please let me know. Also, very interesting benchmark showing compressed JSON performing similar / better than Thrift / Protocol Buffers, so I'm throwing JSON into this question as well.
0
java,python,performance,protocol-buffers,thrift
2008-11-17T19:48:00.000
1
296,650
If the raw net performance is the target, then nothing beats IIOP (see RMI/IIOP). Smallest possible footprint -- only binary data, no markup at all. Serialization/deserialization is very fast too. Since it's IIOP (that is CORBA), almost all languages have bindings. But I presume the performance is not the only requirement, right?
0
64,229
false
0
1
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
297,193
3
8
0
4
70
0
0.099668
0
We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Thrift, and Protocol Buffers on Linux? Primarily languages will be Java, C/C++, Python, and PHP. Update: I'm still very interested in this, if anyone has done any further benchmarks please let me know. Also, very interesting benchmark showing compressed JSON performing similar / better than Thrift / Protocol Buffers, so I'm throwing JSON into this question as well.
0
java,python,performance,protocol-buffers,thrift
2008-11-17T19:48:00.000
1
296,650
One of the things near the top of my "to-do" list for PBs is to port Google's internal Protocol Buffer performance benchmark - it's mostly a case of taking confidential message formats and turning them into entirely bland ones, and then doing the same for the data. When that's been done, I'd imagine you could build the same messages in Thrift and then compare the performance. In other words, I don't have the data for you yet - but hopefully in the next couple of weeks...
0
64,229
false
0
1
Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?
296,677
1
10
0
1
23
1
0.019997
0
I've got a large amount of data (a couple gigs) I need to write to a zip file in Python. I can't load it all into memory at once to pass to the .writestr method of ZipFile, and I really don't want to feed it all out to disk using temporary files and then read it back. Is there a way to feed a generator or a file-like object to the ZipFile library? Or is there some reason this capability doesn't seem to be supported? By zip file, I mean zip file. As supported in the Python zipfile package.
0
python,zip
2008-11-17T23:27:00.000
0
297,345
Some (many? most?) compression algorithms are based on looking at redundancies across the entire file. Some compression libraries will choose between several compression algorithms based on which works best on the file. I believe the ZipFile module does this, so it wants to see the entire file, not just pieces at a time. Hence, it won't work with generators or files to big to load in memory. That would explain the limitation of the Zipfile library.
0
14,983
false
0
1
Create a zip file from a generator in Python?
297,444
1
2
0
1
5
0
0.099668
0
I am familiar with using the os.system to run from the command line. However, I would like to be able to run a jar file from inside of a specific folder, eg. my 'test' folder. This is because my jar (located in my 'test' folder) requires a file inside of my 'test' folder. So, how would I write a function in my script that does the following: c:\test>java -jar run_this.jar required_parameter.ext ? I'm a python newbie so details are greatly appreciated. Thanks in advance.
0
python
2008-11-18T16:22:00.000
1
299,249
In general: Use os.chdir to change the directory of the parent process, then os.system to run the jar file. If you need to keep Python's working directory stable, you need to chdir back to original working directory - you need to record that with os.getcwd(). On Unix: Create a child process with os.fork explicitly. In the parent, wait for the child with os.waitpid. In the child, use os.chdir, then os.exec to run java.
0
8,648
false
0
1
How can I get my python (version 2.5) script to run a jar file inside a folder instead of from command line?
299,262
1
2
0
4
3
0
1.2
0
I've been trying to build a simple prototype application in Django, and am reaching the point of giving up, sadly, as it's just too complicated (I know it would be worth it in the long-run, but I really just don't have enough time available -- I need something up and running in a few days). So, I'm now thinking of going with PHP instead, as it's the method for creating dynamic web content I'm most familiar with, and I know I can get something working quickly. My application, while simple, is probably going to be doing some reasonably complex AI stuff, and it may be that libraries don't exist for what I need in PHP. So I'm wondering how easy / possible it is for a PHP script to "call" a Java program or Python script or a program or script in another language. It's not entirely clear to me what exactly I mean by "call" in this context, but I guess I probably mean that ideally I'd like to define a function in, let's say Java, and then be able to call it from PHP. If that's not possible, then I guess my best bet (assuming I do go with PHP) will be to pass control directly to the external program explicitly through a POST or GET to a CGI program or similar. Feel free to convince me I should stick with Django, although I'm really at the point where I just can't figure out what model I need to produce the HTML form I want, which seems such a basic thing that I fear for my chances of doing anything more complex... Alternatively, anyone who can offer any advice on linking PHP and other languages, that'll be grateful received.
0
java,php,python,dynamic-linking
2008-11-18T19:51:00.000
0
299,913
"where I just can't figure out what model I need to produce the HTML form I want, which seems such a basic thing that I fear for my chances of doing anything more complex" Common problem. Root cause: Too much programming. Solution. Do less programming. Seriously. Define the Django model. Use the default admin pages to see if it's right. Fix the model. Regenerate the database. Look at the default admin pages. Repeat until the default admin pages work correctly and simply. Once it's right in the default admin pages, you have a model that works. It's testable. And the automatic stuff is hooked up correctly. Choices are defined correctly. Computations are in the model mmethods. Queries work. Now you can start working on other presentations of the data. Django generally starts (and ends) with the model. The forms, view and templates are derived from the model.
0
1,939
true
1
1
Calling Java (or python or perl) from a PHP script
300,035
1
9
0
2
21
0
0.044415
1
We have developers with knowledge of these languages - Ruby , Python, .Net or Java. We are developing an application which will mainly handle XML documents. Most of the work is to convert predefined XML files into database tables, providing mapping between XML documents through database, creating reports from database etc. Which language will be the easiest and fastest to work with? (It is a web-app)
0
java,.net,python,xml,ruby
2008-11-19T10:35:00.000
0
301,493
either C# or VB.Net using LiNQ to XML. LiNQ to XML is very very powerful and easy to implement
0
18,193
false
1
1
Which language is easiest and fastest to work with XML content?
301,538
1
3
0
0
24
1
0
0
Is there anyone out there using iPython with emacs 23? The documents on the emacs wiki are a bit of a muddle and I would be interested in hearing from anyone using emacs for Python development. Do you use the download python-mode and ipython.el? What do you recommend?
0
python,emacs,ipython,emacs23
2008-11-20T01:12:00.000
0
304,049
I've used ipython with emacs cvs (which has been emacs 23 for some time now) in my python development. I, however, use it the other way around: I call emacs from the ipython promt through the $EDITOR environment variable. I tried it the other way around, but got a bit tired of all the process buffers and what not. Emacs is great, but a command-line far more versatile.
0
13,374
false
0
1
Emacs 23 and iPython
492,173
1
1
0
2
1
0
1.2
0
I have been able to zip the contents of my folder. But I would like the zipped file to remain in the folder that was just compressed. For example, I've zipped a folder called test in my C: drive. But I would like my "test.zip" file to be contained in C:\test. How can I do this? Thanks in advance. clarification of question with code example: Someone kindly pointed out that my question is confusing, but for a python newbie a lot of things are confusing :) - my advance apologies if this question is too basic or the answer is obvious. I don't know how I can ensure that the resulting zip file is inside the folder that has been zipped. In other words, I would like the zip process to take place in 'basedir.' That way the user does not waste time searching for it somewhere on the C drive. def zip_folder(basedir, zip_file): z = zipfile.ZipFile(zip_file, 'w', zipfile.ZIP_DEFLATED) for dirpath, dirnames, filenames in os.walk(basedir): print "zipping files:" for fn in filenames: print fn absfn = os.path.join(dirpath, fn) z.write(absfn) z.close
0
python,file,zip
2008-11-20T20:47:00.000
0
306,811
Whatever you pass as zip_file to your function will be the file that the ZipFile object will write to. So if you pass it a full path, then it will be put there. If you pass it just a filename, then it will be written to that filename under the current working path. It sounds like you just need to make sure that zip_file is an absolute path.
0
228
true
0
1
With Python, how can I ensure that compression of a folder takes place within a particular folder?
307,091
1
10
0
2
111
1
0.039979
0
What's the easiest way to play a sound file (.wav) in Python? By easiest I mean both most platform independent and requiring the least dependencies. pygame is certainly an option, but it seems overkill for just sound.
0
python,audio,platform-independent
2008-11-20T23:40:00.000
0
307,305
wxPython has support for playing wav files on Windows and Unix - I am not sure if this includes Macs. However it only support wav files as far as I can tell - it does not support other common formats such as mp3 or ogg.
0
468,055
false
0
1
Play a Sound with Python
1,852,392
8
9
0
8
16
1
1
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
0
python,editor,notepad++,komodo,komodoedit
2008-11-21T15:38:00.000
0
309,135
I use Komodo edit. The main reasons are: Intellisense (not as good as VisualStudio, but Python's a hard language to do intellisense for) and cross-platform compatibility. It's nice being able to use the same editor on my Windows machine, my linux machine, and my macbook with little to no change in feel.
0
27,320
false
0
1
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
314,915
8
9
0
9
16
1
1
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
0
python,editor,notepad++,komodo,komodoedit
2008-11-21T15:38:00.000
0
309,135
I just downloaded and started using Komodo Edit. I've been using Notepad++ for awhile. Here is what I think about some of the features: Komodo Edit Pros: You can jump to a function definition, even if it's in another file (I love this) There is a plugin that displays the list of classes, functions and such for the current file on the side. Notepad++ used to have a plugin like this, but it no longer works with the current version and hasn't been updated in a while. Notepad++ Pros: If you select a word, it will highlight all of those words in the current document (makes it easier to find misspellings), without having to hit Ctrl+F. When working with HTML, when the cursor is on/in a tag, the starting and ending tags are both highlighted Anyone know if either of those last 2 things is possible in Komodo Edit?
0
27,320
false
0
1
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
314,865
8
9
0
1
16
1
0.022219
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
0
python,editor,notepad++,komodo,komodoedit
2008-11-21T15:38:00.000
0
309,135
If I had to choose between Notepad++ and Komodo i would choose PyScripter ;.) Seriously I consider PyScripter as a great alternative...
0
27,320
false
0
1
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
500,622
8
9
0
4
16
1
0.088656
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
0
python,editor,notepad++,komodo,komodoedit
2008-11-21T15:38:00.000
0
309,135
A downside I found of Notepad++ for Python is that it tends (for me) to silently mix tabs and spaces. I know this is configurable, but it caught me out, especially when trying to work with other people using different editors / IDE's, so take care.
0
27,320
false
0
1
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
314,871
8
9
0
1
16
1
0.022219
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
0
python,editor,notepad++,komodo,komodoedit
2008-11-21T15:38:00.000
0
309,135
I haven't used Komodo yet (the download never quite finished on the slow connection I was on at the time), but I use Eclipse with PyDev regularly and enjoy the "IDE" features described by the other respondents. However, I'm also regularly frustrated by how much of a resource hog it is. I downloaded Notepad++ recently (much smaller download size ;-) ) and have been enjoying it quite a bit. The editor itself is nice and fast and it looks to be extensible. I'm hoping to copy some of my favorite features from IDE into Notepad++ and migrate, at some distant point in the future.
0
27,320
false
0
1
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
311,426
8
9
0
5
16
1
0.110656
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
0
python,editor,notepad++,komodo,komodoedit
2008-11-21T15:38:00.000
0
309,135
As far as I know , Notepad++ doesn't show you the docstring each method has .
0
27,320
false
0
1
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
309,140
8
9
0
7
16
1
1
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
0
python,editor,notepad++,komodo,komodoedit
2008-11-21T15:38:00.000
0
309,135
I use both Komodo Edit and Notepad++. Notepad++ is a lot quicker to launch and it's more lightweight, so I often use it for quick one-off editing. I use Komodo Edit for major projects, like my django and wxPython applications. KE is a full-featured IDE, so it has a lot more features. Main advantages of Komodo Edit for programming Python: Manage groups of files as projects Use custom commands to run files, run nosetests/pylint, etc. Auto complete & syntax checking Mozilla extension system, with several useful extensions available Write macros in JavaScript or Python Spell checking Some of the little things that Notepad++ is missing for Python development: Doesn't auto-indent after a colon You can't set tabs/spaces on a file-type basis (I like to use tabs for HTML) No code completion or tooltips No on-the-fly syntax checking
0
27,320
false
0
1
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
501,832
8
9
0
-4
16
1
-1
0
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
0
python,editor,notepad++,komodo,komodoedit
2008-11-21T15:38:00.000
0
309,135
Downloaded both myself. Like Komodo better. Komodo Pros: Like it better. Does more. Looks like an IDE. Edits Django templates Notepad++ Cons: Don't like it as much. Does less. Looks less like and IDE.
0
27,320
false
0
1
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
310,252
1
2
0
0
1
0
0
1
Comparable to cacti or mrtg.
0
python,django,pylons,snmp,turbogears
2008-11-22T02:26:00.000
0
310,759
or you can start building your own solution (like me), you will be surprised how much can you do with few lines of code using for instance cherryp for web server, pysnmp, and python rrd module.
0
1,942
false
1
1
Does anyone know of a python based web ui for snmp monitoring?
541,516
1
1
0
1
0
0
0.197375
0
Ghostscript curls up and dies, throwing an exception to stdout which I cannot catch and log. I am pretty sure it gets sick when I give it asian fonts. Has anybody backed into this problem and solved it?
0
python,jython,tiff,ghostscript
2008-11-25T06:41:00.000
1
316,518
It may be that you need to read stderr from the child process.
0
416
false
0
1
Ghostscript PDF -> TIFF throws an untrappable exception, when consuming files with asian fonts
317,300
1
4
0
0
3
1
0
0
using jython I have a situation where emails come in with different attachments. Certain file types I process others I ignore and dont write to file. I am caught in a rather nasty situation, because sometimes people send an email as an attachment, and that attached email has legal attachments. What I want to do is skip that attached email and all its attachments. using python/jythons std email lib how can i do this? to make it clearer I need to parse an email (named ROOT email), I want to get the attachments from this email using jython. Next certain attachments are supported ie .pdf .doc etc now it just so happens that, the clients send an email (ROOT email) with another email message (CHILD email) as an attachment, and in CHILD email it has .pdf attachments and such like. What I need is: to get rid of any CHILD emails attached to the ROOT email AND the CHILD emails attachments. What happens is I walk over the whole email and it just parses every attachment, BOTH ROOT attachments and CHILD attachments as if they were ROOT attachments. I cannot have this. I am only interested in ROOT attachements that are legal ie .pdf .doc. xls .rtf .tif .tiff That should do for now, I have to run to catch a bus! thanks!
0
python,email,jython,attachment
2008-11-26T06:20:00.000
0
319,896
Have you tried the get_payload( [i[, decode]]) method? Unlike walk it is not documented to recursively open attachments.
0
978
false
0
1
How do I skip processing the attachments of an email which is an attachment of a different email
320,285
2
10
0
3
41
0
0.059928
1
I have an object that can build itself from an XML string, and write itself out to an XML string. I'd like to write a unit test to test round tripping through XML, but I'm having trouble comparing the two XML versions. Whitespace and attribute order seem to be the issues. Any suggestions for how to do this? This is in Python, and I'm using ElementTree (not that that really matters here since I'm just dealing with XML in strings at this level).
0
python,xml,elementtree
2008-11-26T19:09:00.000
0
321,795
Why are you examining the XML data at all? The way to test object serialization is to create an instance of the object, serialize it, deserialize it into a new object, and compare the two objects. When you make a change that breaks serialization or deserialization, this test will fail. The only thing checking the XML data is going to find for you is if your serializer is emitting a superset of what the deserializer requires, and the deserializer silently ignores stuff it doesn't expect. Of course, if something else is going to be consuming the serialized data, that's another matter. But in that case, you ought to be thinking about establishing a schema for the XML and validating it.
0
17,177
false
0
1
Comparing XML in a unit test in Python
322,088
2
10
0
0
41
0
0
1
I have an object that can build itself from an XML string, and write itself out to an XML string. I'd like to write a unit test to test round tripping through XML, but I'm having trouble comparing the two XML versions. Whitespace and attribute order seem to be the issues. Any suggestions for how to do this? This is in Python, and I'm using ElementTree (not that that really matters here since I'm just dealing with XML in strings at this level).
0
python,xml,elementtree
2008-11-26T19:09:00.000
0
321,795
The Java component dbUnit does a lot of XML comparisons, so you might find it useful to look at their approach (especially to find any gotchas that they may have already addressed).
0
17,177
false
0
1
Comparing XML in a unit test in Python
322,600
2
9
0
1
22
1
0.022219
0
Writing a python script and it needs to find out what language a block of code is written in. I could easily write this myself, but I'd like to know if a solution already exists. Pygments is insufficient and unreliable.
0
python
2008-11-28T06:40:00.000
0
325,165
what language a block of code is written in What are your alternatives, among what languages? There is no way to determine this universally. But if you narrow your focus there is probably a tool somewhere
0
4,415
false
0
1
Is there a library that will detect the source code language of a block of code?
325,180
2
9
0
0
22
1
0
0
Writing a python script and it needs to find out what language a block of code is written in. I could easily write this myself, but I'd like to know if a solution already exists. Pygments is insufficient and unreliable.
0
python
2008-11-28T06:40:00.000
0
325,165
As other have said Pygments will be your best bet.
0
4,415
false
0
1
Is there a library that will detect the source code language of a block of code?
346,832
4
15
0
9
236
1
1
0
I've been wondering this for some time. As the title say, which is faster, the actual function or simply raising to the half power? UPDATE This is not a matter of premature optimization. This is simply a question of how the underlying code actually works. What is the theory of how Python code works? I sent Guido van Rossum an email cause I really wanted to know the differences in these methods. My email: There are at least 3 ways to do a square root in Python: math.sqrt, the '**' operator and pow(x,.5). I'm just curious as to the differences in the implementation of each of these. When it comes to efficiency which is better? His response: pow and ** are equivalent; math.sqrt doesn't work for complex numbers, and links to the C sqrt() function. As to which one is faster, I have no idea...
0
python,performance
2008-11-29T01:24:00.000
0
327,002
How many square roots are you really performing? Are you trying to write some 3D graphics engine in Python? If not, then why go with code which is cryptic over code that is easy to read? The time difference is would be less than anybody could notice in just about any application I could forsee. I really don't mean to put down your question, but it seems that you're going a little too far with premature optimization.
0
100,568
false
0
1
Which is faster in Python: x**.5 or math.sqrt(x)?
327,009