Title
stringlengths
15
150
A_Id
int64
2.98k
72.4M
Users Score
int64
-17
470
Q_Score
int64
0
5.69k
ViewCount
int64
18
4.06M
Database and SQL
int64
0
1
Tags
stringlengths
6
105
Answer
stringlengths
11
6.38k
GUI and Desktop Applications
int64
0
1
System Administration and DevOps
int64
1
1
Networking and APIs
int64
0
1
Other
int64
0
1
CreationDate
stringlengths
23
23
AnswerCount
int64
1
64
Score
float64
-1
1.2
is_accepted
bool
2 classes
Q_Id
int64
1.85k
44.1M
Python Basics and Environment
int64
0
1
Data Science and Machine Learning
int64
0
1
Web Development
int64
0
1
Available Count
int64
1
17
Question
stringlengths
41
29k
Miminal Linux For a Pylons Web App?
589,645
0
2
602
0
python,linux,pylons
Damn Small Linux? Slax?
0
1
0
1
2009-02-26T04:33:00.000
7
0
false
589,115
0
0
0
4
I am going to be building a Pylons-based web application. For this purpose, I'd like to build a minimal Linux platform, upon which I would then install the necessary packages such as Python and Pylons, and other necessary dependencies. The other reason to keep it minimal is because this machine will be virtual, probably over KVM, and will eventually be replicated in some cloud environment. What would you use to do this? I am thinking of using Fedora 10's AOS iso, but would love to understand all my options.
Python - How to check if a file is used by another application?
592,121
0
9
22,009
0
python,windows,unix,logging,file-io
One thing I've done is have python very temporarily rename the file. If we're able to rename it, then no other process is using it. I only tested this on Windows.
0
1
0
0
2009-02-26T06:44:00.000
3
0
false
589,407
0
0
0
1
I want to open a file which is periodically written to by another application. This application cannot be modified. I'd therefore like to only open the file when I know it is not been written to by an other application. Is there a pythonic way to do this? Otherwise, how do I achieve this in Unix and Windows? edit: I'll try and clarify. Is there a way to check if the current file has been opened by another application? I'd like to start with this question. Whether those other application read/write is irrelevant for now. I realize it is probably OS dependent, so this may not really be python related right now.
When is it (not) appropriate to bundle dependencies with an application?
609,861
3
14
1,453
0
python,dependencies,distribution,packaging
An important point seems to have been forgotten in the Cons of bundling libraries/frameworks/etc with the application: security updates. Most Web frameworks are full of security holes and require frequent patching. Any library, anyway, may have to be upgraded one day or the other for a security bug. If you do not bundle, sysadmins will just upgrade one copy of the library and restart depending applications. If you bundle, sysadmins will probably not even know they have to upgrade something. So, the issue with bundling is not the disk space, it's the risk of letting old and dangerous copies around.
0
1
0
0
2009-02-28T16:59:00.000
8
0.07486
false
598,299
1
0
0
7
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
598,397
10
14
1,453
0
python,dependencies,distribution,packaging
I favor bundling dependencies, if it's not feasible to use a system for automatic dependency resolution (i.e. setuptools), and if you can do it without introducing version conflicts. You still have to consider your application and your audience; serious developers or enthusiasts are more likely to want to work with a specific (latest) version of the dependency. Bundling stuff in may be annoying for them, since it's not what they expect. But, especially for end-users of an application, I seriously doubt most people enjoy having to search for dependencies. As far as having duplicate copies goes, I would much rather spend an extra 10 milliseconds downloading some additional kilobytes, or spend whatever fraction of a cent on the extra meg of disk space, than spend 10+ minutes searching through websites (which may be down), downloading, installing (which may fail if versions are incompatible), etc. I don't care how many copies of a library I have on my disk, as long as they don't get in each others' way. Disk space is really, really cheap.
0
1
0
0
2009-02-28T16:59:00.000
8
1.2
true
598,299
1
0
0
7
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
598,333
1
14
1,453
0
python,dependencies,distribution,packaging
Just my experience, take it with a grain of salt. My preference for a couple of open-source libraries that I author is for independence from additional libs as much as possible. Reason being, not only am I on the hook for distribution of additional libraries along with mine, I'm also obliged to update my application for compatibility as those other libraries are updated as well. From the libraries I've used from others that carry dependencies of "common" libraries, invariably I end up with requiring multiple versions of the common library on my system. The relative update speed of the niche libraries I'm using just isn't that fast, while the common libraries are updated much more often. Versioning hell. But that's speaking generically. If I can aid my project and users NOW by incorporating a dependency, I'm always looking at the downstream and later-date effects of that decision. If I can manage it, I can confidently include the dependency. As always, your mileage may vary.
0
1
0
0
2009-02-28T16:59:00.000
8
0.024995
false
598,299
1
0
0
7
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
603,843
3
14
1,453
0
python,dependencies,distribution,packaging
If you're producing software for an end-user, the goal is to let the customer use your software. Anything that stands in the way is counter-productive. If they have to download dependencies themselves, there's a possibility that they'll decide to avoid your software instead. You can't control whether libraries will be backwards compatible, and you don't want your software to stop working because the user updated their system. Similarly, you don't want a customer to install an old version of your software with old libraries and have the rest of the system break. This means bundling is generally the way to go. If you can ensure that your software will install smoothly without bundling dependencies, and that's less work, then that may be a better option. It's about what satisfies your customers.
0
1
0
0
2009-02-28T16:59:00.000
8
0.07486
false
598,299
1
0
0
7
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
603,778
2
14
1,453
0
python,dependencies,distribution,packaging
For Linux, don't even think about bundling. You aren't smarter than the package manager or the packagers, and each distribution takes approach their own way - they won't be happy if you attempt to go your way. At best, they won't bother with packaging your app, which isn't great. Keep in mind that in Linux, dependencies are automatically pulled in for you. It's not a matter of making the user get them. It's already done for you. For windows, feel free to bundle, you're on your own there.
0
1
0
0
2009-02-28T16:59:00.000
8
0.049958
false
598,299
1
0
0
7
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
598,614
1
14
1,453
0
python,dependencies,distribution,packaging
Beware reproducing the classic Windows DLL hell. By all means minimize the number of dependencies: ideally, just depend on your language and its framework, nothing else, if you can. After all, preserving hard disk space is hardly the objective any more, so users need not care about having multiple copies. Also, unless you have a minuscule number of users, be sure to take the onus of packaging on yourself rather than requiring them to obtain all dependencies!
0
1
0
0
2009-02-28T16:59:00.000
8
0.024995
false
598,299
1
0
0
7
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
When is it (not) appropriate to bundle dependencies with an application?
598,599
1
14
1,453
0
python,dependencies,distribution,packaging
I always include all dependancies for my web applications. Not only does this make installation simpler, the application remains stable and working the way you expect it to even when other components on the system are upgraded.
0
1
0
0
2009-02-28T16:59:00.000
8
0.024995
false
598,299
1
0
0
7
Summary I recently had a conversation with the creator of a framework that one of my applications depends on. During that conversation he mentioned as a sort of aside that it would make my life simpler if I just bundled his framework with my application and delivered to the end user a version that I knew was consistent with my code. Intuitively I have always tried to avoid doing this and, in fact, I have taken pains to segment my own code so that portions of it could be redistributed without taking the entire project (even when there was precious little chance anyone would ever reuse any of it). However, after mulling it over for some time I have not been able to come up with a particularly good reason why I do this. In fact, now that I have thought about it, I'm seeing a pretty compelling case to bundle all my smaller dependencies. I have come up with a list of pros and cons and I'm hoping someone can point out anything that I'm missing. Pros Consistency of versions means easier testing and troubleshooting. Application may reach a wider audience since there appear to be fewer components to install. Small tweaks to the dependency can more easily be made downstream and delivered with the application, rather than waiting for them to percolate into the upstream code base. Cons More complex packaging process to include dependencies. User may end up with multiple copies of a dependency on their machine. Per bortzmeyer's response, there are potential security concerns with not being able to upgrade individual components. Notes For reference, my application is written in Python and the dependencies I'm referencing are "light", by which I mean small and not in very common use. (So they do not exist on all machines or even in all repositories.) And when I say "package with" my application, I mean distribute under my own source tree, not install with a script that resides inside my package, so there would be no chance of conflicting versions. I am also developing solely on Linux so there are no Windows installation issues to worry about. All that being said, I am interested in hearing any thoughts on the broader (language-independent) issue of packaging dependencies as well. Is there something I am missing or is this an easy decision that I am just over-thinking? Addendum 1 It is worth mentioning that I am also quite sensitive to the needs of downstream packagers. I would like it to be as straightforward as possible to wrap the application up in a distribution-specific Deb or RPM.
Calling function defined in exe
598,571
0
4
2,356
0
python
Unless the said executable takes command line arguments which will specify which function to use, I don't think this is possible. With that being said, if you created the EXE, command line arguments are a good way to implement the functionality you're looking for.
0
1
0
0
2009-02-28T19:55:00.000
3
0
false
598,569
1
0
0
2
I need to know a way to call a function defined in the exe from a python script. I know how to call entire exe from py file.
Calling function defined in exe
598,585
1
4
2,356
0
python
Not sure if it is for windows. But you can treat an exe like a dll (if functions are exported). And they can be used by other programs.
0
1
0
0
2009-02-28T19:55:00.000
3
0.066568
false
598,569
1
0
0
2
I need to know a way to call a function defined in the exe from a python script. I know how to call entire exe from py file.
How can I manually register distributions with pkg_resources?
2,164,138
0
1
724
0
python,google-app-engine,setuptools,pkg-resources
Create a setup.py for the package just as you would normally, and then use "setup.py sdist --formats=zip" to build your source zip. The built source zip will include an .egg-info metadata directory, which will then be findable by pkg_resources. Alternately, you can use bdist_egg for all your packages.
0
1
0
0
2009-03-01T03:40:00.000
3
1.2
true
599,205
0
0
0
2
I'm trying to get a package installed on Google App Engine. The package relies rather extensively on pkg_resources, but there's no way to run setup.py on App Engine. There's no platform-specific code in the source, however, so it's no problem to just zip up the source and include those in the system path. And I've gotten a version of pkg_resources installed and working as well. The only problem is getting the package actually registered with pkg_resources so when it calls iter_entry_points it can find the appropriate plugins. What methods do I need to call to register modules on sys.path with all the appropriate metadata, and how do I figure out what that metadata needs to be?
How can I manually register distributions with pkg_resources?
744,882
0
1
724
0
python,google-app-engine,setuptools,pkg-resources
On your local development system, run python setup.py bdist_egg, which will create a Zip archive with the necessary metadata included. Add it to your sys.path, and it should work properly.
0
1
0
0
2009-03-01T03:40:00.000
3
0
false
599,205
0
0
0
2
I'm trying to get a package installed on Google App Engine. The package relies rather extensively on pkg_resources, but there's no way to run setup.py on App Engine. There's no platform-specific code in the source, however, so it's no problem to just zip up the source and include those in the system path. And I've gotten a version of pkg_resources installed and working as well. The only problem is getting the package actually registered with pkg_resources so when it calls iter_entry_points it can find the appropriate plugins. What methods do I need to call to register modules on sys.path with all the appropriate metadata, and how do I figure out what that metadata needs to be?
Recommendations for Python development on a Mac?
618,078
3
8
6,687
0
python,macos
How about EPD from Enthought? Yes, it's large but it is a framework build and includes things like wxPython, vtk, numpy, scipy, and ipython built-in.
0
1
0
0
2009-03-02T04:04:00.000
11
0.054491
false
601,236
1
0
0
4
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development: "Stock" Apple Python MacPython Fink MacPorts roll-your-own-from-source I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other? Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
Recommendations for Python development on a Mac?
601,287
0
8
6,687
0
python,macos
I recommend python (any python?) plus the ipython shell. My most recent experience with MacPython was MacPython 2.5, and I found IDLE frustrating to use as an editor. It's not very featureful, and its' very slow to scroll large quantities of output.
0
1
0
0
2009-03-02T04:04:00.000
11
0
false
601,236
1
0
0
4
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development: "Stock" Apple Python MacPython Fink MacPorts roll-your-own-from-source I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other? Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
Recommendations for Python development on a Mac?
601,250
2
8
6,687
0
python,macos
I recommend using Python Virtual environments, especially if you use a Timecapsule because Timecapsule will back everything up, except modules you added to Python!
0
1
0
0
2009-03-02T04:04:00.000
11
0.036348
false
601,236
1
0
0
4
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development: "Stock" Apple Python MacPython Fink MacPorts roll-your-own-from-source I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other? Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
Recommendations for Python development on a Mac?
601,252
9
8
6,687
0
python,macos
One advantage I see in using the "stock" Python that's included with Mac OS X is that it makes deployment to other Macs a piece of cake. I don't know what your deployment scenario is, but for me this is important. My code has to run on any number of Macs at work, and I try to minimize the amount of work it takes to run my code on all of those systems.
0
1
0
0
2009-03-02T04:04:00.000
11
1
false
601,236
1
0
0
4
I bought a low-end MacBook about a month ago and am finally getting around to configuring it for Python. I've done most of my Python work in Windows up until now, and am finding the choices for OS X a little daunting. It looks like there are at least five options to use for Python development: "Stock" Apple Python MacPython Fink MacPorts roll-your-own-from-source I'm still primarily developing for 2.5, so the stock Python is fine from a functionality standpoint. What I want to know is: why should I choose one over the other? Update: To clarify, I am looking for a discussion of the various options, not links to the documentation. I've marked this as a Community Wiki question, as I don't feel there is a "correct" answer. Thanks to everyone who has already commented for their insight.
Choosing and deploying a comet server
622,509
5
13
7,360
0
python,django,comet,daemon
I would recommend looking into Twisted, their twisted.web server, and the comet work done on top of it at Divmod. They can handle far more concurrent connections than traditional thread or process based servers, which is exactly what you need for something like this. And, yes, I've architected systems using Twisted for COMET stuff, while using other things for the more front-facing web applications beside it. It works out well with each part doing what it does best.
0
1
0
0
2009-03-07T12:51:00.000
6
1.2
true
621,802
0
0
1
1
I want to push data to the browser over HTTP without killing my django/python application. I decided to use a comet server, to proxy requests between my application and the client (though I still haven't really figured it out properly). I've looked into the following engines: orbited cometd ejabberd jetty Has anyone had any experience working with these servers and deploying them? Any insight and links regarding the topics would be great. Thank you.
What will be the upgrade path to Python 3.x for Google App Engine Applications?
625,632
1
9
4,490
0
python,google-app-engine
The app.yaml syntax already supports multiple languages and multiple API versions, though only one of each (Python, API version 1) is currently supported. Presumably, one of those extension mechanisms will be used to specify that you want Python 3, and it'll be up to you to port your app over to work in Python 3, then change that setting.
0
1
0
0
2009-03-09T04:43:00.000
4
0.049958
false
625,042
1
0
1
2
What is required to make the transition to Python 3.x for Google App Engine? I know Google App Engine requires the use of at least Python 2.5. Is it possible to use Python 3.0 already on Google App Engine?
What will be the upgrade path to Python 3.x for Google App Engine Applications?
625,130
1
9
4,490
0
python,google-app-engine
At least at the being, Guido was working closely with the team at Google who is building AppEngine. When this option does become available, you will have to edit your main XAML file. I agree with Chris B. that Python 3.0 support may not be forthcoming too soon, but I'm not sure I agree that it will come sooner than Perl or PHP. At the Google I/O conference last year, they were very mum on what future languages they would support on AppEngine but they were pretty clear on the fact that they're actively exploring how to safely allow other code to run. One of the main reason they chose to support Python is that they due to it's dynamically compiled nature, they could support 3rd party library extensions with the minimal restriction that all add-ons must be in pure Python. I wouldn't be surprised if Python 3.0 support was introduced sooner than new languages.
0
1
0
0
2009-03-09T04:43:00.000
4
0.049958
false
625,042
1
0
1
2
What is required to make the transition to Python 3.x for Google App Engine? I know Google App Engine requires the use of at least Python 2.5. Is it possible to use Python 3.0 already on Google App Engine?
Dump memcache keys from GAE SDK Console?
626,559
8
1
2,662
0
python,google-app-engine,memcached
People ask for this on the memcached list a lot, sometimes with the same type of "just in case I want to look around to debug something" sentiment. The best way to handle this is to know how you generate your keys, and just go look stuff up when you want to know what's stored for a given value. If you have too many things using memcached to do that within the scope of your debugging session, then start logging access. But keep in mind -- memcached is fast because it doesn't allow for such things in general. The community server does have limited functionality to get a subset of the keys available within a given slab class, but it's probably not what you really want, and hopefully google doesn't implement it in theirs. :)
0
1
0
0
2009-03-09T07:49:00.000
5
1.2
true
625,314
0
0
1
4
In the "Memcache Viewer", is there any way to dump a list of existing keys? Just for debugging, of course, not for use in any scripts! I ask because it doesn't seem like the GAE SDK is using a "real" memcache server, so I'm guessing it's emulated in Python (for simplicity, as it's just a development server).. This would mean there is a dict somewhere with the keys/values..
Dump memcache keys from GAE SDK Console?
625,331
4
1
2,662
0
python,google-app-engine,memcached
No. I did not found such functionality in memcached too. Thinking about this issue, I found this limitation understandable - it would require keeping a registry of keys with all related problems like key expiration, invalidation and of course locking. Such system would not be as fast as memcaches are intended to be.
0
1
0
0
2009-03-09T07:49:00.000
5
0.158649
false
625,314
0
0
1
4
In the "Memcache Viewer", is there any way to dump a list of existing keys? Just for debugging, of course, not for use in any scripts! I ask because it doesn't seem like the GAE SDK is using a "real" memcache server, so I'm guessing it's emulated in Python (for simplicity, as it's just a development server).. This would mean there is a dict somewhere with the keys/values..
Dump memcache keys from GAE SDK Console?
626,458
0
1
2,662
0
python,google-app-engine,memcached
Memcache is designed to be quick and there's no convincing use case for this functionality which would justify the overhead required for a command that is so at odds with the rest of memcached. The GAE SDK is simulating memcached, so it doesn't offer this functionality either.
0
1
0
0
2009-03-09T07:49:00.000
5
0
false
625,314
0
0
1
4
In the "Memcache Viewer", is there any way to dump a list of existing keys? Just for debugging, of course, not for use in any scripts! I ask because it doesn't seem like the GAE SDK is using a "real" memcache server, so I'm guessing it's emulated in Python (for simplicity, as it's just a development server).. This would mean there is a dict somewhere with the keys/values..
Dump memcache keys from GAE SDK Console?
660,458
0
1
2,662
0
python,google-app-engine,memcached
The easiest way that I could think of, would be to maintain a memcache key at a known ID, and then append to it every time you insert a new key. This way you could just query for the single key to get a list of existing keys.
0
1
0
0
2009-03-09T07:49:00.000
5
0
false
625,314
0
0
1
4
In the "Memcache Viewer", is there any way to dump a list of existing keys? Just for debugging, of course, not for use in any scripts! I ask because it doesn't seem like the GAE SDK is using a "real" memcache server, so I'm guessing it's emulated in Python (for simplicity, as it's just a development server).. This would mean there is a dict somewhere with the keys/values..
What is the feasibility of porting a legacy C program to Python?
632,844
1
2
381
0
python,c
If I was faced with a similar situation I'd ask myself a couple of questions: Is there anything more important I could be working on? Does Python bring anything to the table that is currently handled poorly by the current application? Will this allow me to add functionality that was previously too difficult to implement? Is this going to disrupt service in any way? If I can't answer those satisfactorily, then I'd put off the rewrite.
0
1
0
1
2009-03-10T23:47:00.000
7
0.028564
false
632,730
0
0
0
6
I have a program in C that communicates via UDP with another program (in Java) and then does process manipulation (start/stop) based on the UDP pkt exchange. Now this C program has been legacy and I want to convert it to Python - do you think Python will be a good choice for the tasks mentioned?
What is the feasibility of porting a legacy C program to Python?
634,093
0
2
381
0
python,c
If this is an embedded program, then it might be a problem to port it since Python programs typically rely on the Python runtime and library, and those are fairly large. Especially when compared to a C program doing a well-defined task. Of course, it's likely you've already considered that aspect, but I wanted to mention it in the context of the question anyway, since I feel it's an important aspect when doing this type of comparison.
0
1
0
1
2009-03-10T23:47:00.000
7
0
false
632,730
0
0
0
6
I have a program in C that communicates via UDP with another program (in Java) and then does process manipulation (start/stop) based on the UDP pkt exchange. Now this C program has been legacy and I want to convert it to Python - do you think Python will be a good choice for the tasks mentioned?
What is the feasibility of porting a legacy C program to Python?
632,740
1
2
381
0
python,c
Assuming that you have control over the environment which this application will run, and that the performance of interpreted language (python) compared to a compiled one (C) can be ignored, I believe Python is a great choice for this.
0
1
0
1
2009-03-10T23:47:00.000
7
0.028564
false
632,730
0
0
0
6
I have a program in C that communicates via UDP with another program (in Java) and then does process manipulation (start/stop) based on the UDP pkt exchange. Now this C program has been legacy and I want to convert it to Python - do you think Python will be a good choice for the tasks mentioned?
What is the feasibility of porting a legacy C program to Python?
632,788
4
2
381
0
python,c
I'd say that if: Your C code contains no platform specific requirements You are sure speed is not going to be an issue going from C to python You have a desire to not compile anymore You would like to try utilise exception handling You want to dabble in OO You might choose to run on many platforms without porting You are curious about dynamic typing You want memory handled for you You know or want to learn python Then sure, why not. There doesn't seem to be any technical reason you shouldn't use python here, so it's a preference in this case.
0
1
0
1
2009-03-10T23:47:00.000
7
0.113791
false
632,730
0
0
0
6
I have a program in C that communicates via UDP with another program (in Java) and then does process manipulation (start/stop) based on the UDP pkt exchange. Now this C program has been legacy and I want to convert it to Python - do you think Python will be a good choice for the tasks mentioned?
What is the feasibility of porting a legacy C program to Python?
632,925
2
2
381
0
python,c
Remember as well, you can leave parts of your program in C, turn them into Python modules and build python code around them - you don't need to re-write everything up-front.
0
1
0
1
2009-03-10T23:47:00.000
7
0.057081
false
632,730
0
0
0
6
I have a program in C that communicates via UDP with another program (in Java) and then does process manipulation (start/stop) based on the UDP pkt exchange. Now this C program has been legacy and I want to convert it to Python - do you think Python will be a good choice for the tasks mentioned?
What is the feasibility of porting a legacy C program to Python?
632,935
1
2
381
0
python,c
Yes, I think Python is a good choice, if all your platforms support it. Since this is a network program, I'm assuming the network is your runtime bottleneck? That's likely to still be the case in Python. If you really do need to speed it up, you can include your long-since-debugged, speedy C as Python modules.
0
1
0
1
2009-03-10T23:47:00.000
7
0.028564
false
632,730
0
0
0
6
I have a program in C that communicates via UDP with another program (in Java) and then does process manipulation (start/stop) based on the UDP pkt exchange. Now this C program has been legacy and I want to convert it to Python - do you think Python will be a good choice for the tasks mentioned?
Is there any linux distribution that comes with python 2.6 yet?
640,292
1
4
619
0
python,linux
For what it's worth, Python 2.6 is available in the Portage tree for Gentoo, but it's hardmasked (that doesn't really count as stable) because apparently there are some programs that don't work with it. My guess is that if you had Gentoo, you could install Python 2.6 and get it to work, but it might not be smart to make it the default version (i.e. you'd want to keep Python 2.5 around as well).
0
1
0
0
2009-03-12T19:47:00.000
6
0.033321
false
640,191
1
0
0
2
I've heard ubuntu 9.4 will but it's still in alpha. Are there any stable distros that come with python 2.6 or at least don't depend on it so much so reinstalling python won't break anything?
Is there any linux distribution that comes with python 2.6 yet?
640,447
4
4
619
0
python,linux
openSUSE 11.1 ships Python 2.6 as standard.
0
1
0
0
2009-03-12T19:47:00.000
6
0.132549
false
640,191
1
0
0
2
I've heard ubuntu 9.4 will but it's still in alpha. Are there any stable distros that come with python 2.6 or at least don't depend on it so much so reinstalling python won't break anything?
Which version of python is currently best for os x?
651,764
1
2
856
0
python,macos
I've updated my macbook running leopard to python 2.6 and haven't had any problems with psycopg2. For that matter, I haven't had any compatibility issues anywhere with 2.6, but obviously switching to python3k isn't exactly recommended if you're concerned about backwards compatibility.
0
1
0
0
2009-03-16T19:00:00.000
10
0.019997
false
651,717
1
0
0
6
After going through hell trying to install the latest version of postgresql and psycopg2 today I'm going for a complete reinstall of Leopard. I've been sticking with macpython 2.5 for the past year but now I'm considering macports even 2.6 For me it's most important for Twisted, PIL and psycopg2 to be working without a problem. Can anyone give some guidelines for what version I should choose, based on experience? Edit: Ok I've decided to go without reinstalling the os. Hacked around to clean up the bad PostgresPlus installation and installed another one. The official python 2.6.1 package works great, no problem installing it alongside 2.5.2. Psycopg2 works. But as expected PIL wont compile. I guess I'll be switching between the 2.5 from macports and the official 2.6 for different tasks, since I know the macports python has it's issues with some packages. Another Edit: I've now compiled PIL. Had to hide the whole macports directory and half the xcode libraries, so it would find the right ones. It wouldn't accept the paths I was feeding it. PIL is notorious for this on leopard.
Which version of python is currently best for os x?
1,115,314
0
2
856
0
python,macos
If your using Macports, I recommend downloading the python_select package, which facilitates easy switching between different versions including the built in apple versions. Makes life a lot easier.
0
1
0
0
2009-03-16T19:00:00.000
10
0
false
651,717
1
0
0
6
After going through hell trying to install the latest version of postgresql and psycopg2 today I'm going for a complete reinstall of Leopard. I've been sticking with macpython 2.5 for the past year but now I'm considering macports even 2.6 For me it's most important for Twisted, PIL and psycopg2 to be working without a problem. Can anyone give some guidelines for what version I should choose, based on experience? Edit: Ok I've decided to go without reinstalling the os. Hacked around to clean up the bad PostgresPlus installation and installed another one. The official python 2.6.1 package works great, no problem installing it alongside 2.5.2. Psycopg2 works. But as expected PIL wont compile. I guess I'll be switching between the 2.5 from macports and the official 2.6 for different tasks, since I know the macports python has it's issues with some packages. Another Edit: I've now compiled PIL. Had to hide the whole macports directory and half the xcode libraries, so it would find the right ones. It wouldn't accept the paths I was feeding it. PIL is notorious for this on leopard.
Which version of python is currently best for os x?
651,768
4
2
856
0
python,macos
You can install them side-by-side. If you've encounter problems just set python 2.5 as the standard python and use e.g. python26 for a newer version.
0
1
0
0
2009-03-16T19:00:00.000
10
0.07983
false
651,717
1
0
0
6
After going through hell trying to install the latest version of postgresql and psycopg2 today I'm going for a complete reinstall of Leopard. I've been sticking with macpython 2.5 for the past year but now I'm considering macports even 2.6 For me it's most important for Twisted, PIL and psycopg2 to be working without a problem. Can anyone give some guidelines for what version I should choose, based on experience? Edit: Ok I've decided to go without reinstalling the os. Hacked around to clean up the bad PostgresPlus installation and installed another one. The official python 2.6.1 package works great, no problem installing it alongside 2.5.2. Psycopg2 works. But as expected PIL wont compile. I guess I'll be switching between the 2.5 from macports and the official 2.6 for different tasks, since I know the macports python has it's issues with some packages. Another Edit: I've now compiled PIL. Had to hide the whole macports directory and half the xcode libraries, so it would find the right ones. It wouldn't accept the paths I was feeding it. PIL is notorious for this on leopard.
Which version of python is currently best for os x?
652,455
0
2
856
0
python,macos
I am using Python 2.5.1. It's working great for me for general scripting and some CherryPy web projects.
0
1
0
0
2009-03-16T19:00:00.000
10
0
false
651,717
1
0
0
6
After going through hell trying to install the latest version of postgresql and psycopg2 today I'm going for a complete reinstall of Leopard. I've been sticking with macpython 2.5 for the past year but now I'm considering macports even 2.6 For me it's most important for Twisted, PIL and psycopg2 to be working without a problem. Can anyone give some guidelines for what version I should choose, based on experience? Edit: Ok I've decided to go without reinstalling the os. Hacked around to clean up the bad PostgresPlus installation and installed another one. The official python 2.6.1 package works great, no problem installing it alongside 2.5.2. Psycopg2 works. But as expected PIL wont compile. I guess I'll be switching between the 2.5 from macports and the official 2.6 for different tasks, since I know the macports python has it's issues with some packages. Another Edit: I've now compiled PIL. Had to hide the whole macports directory and half the xcode libraries, so it would find the right ones. It wouldn't accept the paths I was feeding it. PIL is notorious for this on leopard.
Which version of python is currently best for os x?
651,988
1
2
856
0
python,macos
I use both Twisted and Psycopg2 extensively on OSX, and both work fine with Python 2.6. Neither has been ported to Python 3.0, as far as I know. Several of Python 3.0's features have been back-ported to 2.6, so you gain quite a bit by moving from 2.5 to 2.6. But I wouldn't switch to 3.0 until all of your thirdparty libraries support it; and this may not happen for some time.
0
1
0
0
2009-03-16T19:00:00.000
10
0.019997
false
651,717
1
0
0
6
After going through hell trying to install the latest version of postgresql and psycopg2 today I'm going for a complete reinstall of Leopard. I've been sticking with macpython 2.5 for the past year but now I'm considering macports even 2.6 For me it's most important for Twisted, PIL and psycopg2 to be working without a problem. Can anyone give some guidelines for what version I should choose, based on experience? Edit: Ok I've decided to go without reinstalling the os. Hacked around to clean up the bad PostgresPlus installation and installed another one. The official python 2.6.1 package works great, no problem installing it alongside 2.5.2. Psycopg2 works. But as expected PIL wont compile. I guess I'll be switching between the 2.5 from macports and the official 2.6 for different tasks, since I know the macports python has it's issues with some packages. Another Edit: I've now compiled PIL. Had to hide the whole macports directory and half the xcode libraries, so it would find the right ones. It wouldn't accept the paths I was feeding it. PIL is notorious for this on leopard.
Which version of python is currently best for os x?
651,835
1
2
856
0
python,macos
I would stick with the MacPython version 2.5.x (I believe 2.5.4 currently). Here's my rationale: Snow Leopard may still be on the 2.5 series, so you might as well be consistent with the future OS (i.e. no point in going too far ahead). For most production apps, nobody is going to want to use 2.6 for another year. No frameworks/programs are going to leave 2.5 behind for at least 2 years. In other words, my approach is that the only reason to do 2.6 is for fun. If you're looking to have fun, just go for 3.0.
0
1
0
0
2009-03-16T19:00:00.000
10
0.019997
false
651,717
1
0
0
6
After going through hell trying to install the latest version of postgresql and psycopg2 today I'm going for a complete reinstall of Leopard. I've been sticking with macpython 2.5 for the past year but now I'm considering macports even 2.6 For me it's most important for Twisted, PIL and psycopg2 to be working without a problem. Can anyone give some guidelines for what version I should choose, based on experience? Edit: Ok I've decided to go without reinstalling the os. Hacked around to clean up the bad PostgresPlus installation and installed another one. The official python 2.6.1 package works great, no problem installing it alongside 2.5.2. Psycopg2 works. But as expected PIL wont compile. I guess I'll be switching between the 2.5 from macports and the official 2.6 for different tasks, since I know the macports python has it's issues with some packages. Another Edit: I've now compiled PIL. Had to hide the whole macports directory and half the xcode libraries, so it would find the right ones. It wouldn't accept the paths I was feeding it. PIL is notorious for this on leopard.
Access to errno from Python?
6,170,629
1
25
10,955
0
python,linux,python-2.5,errno
ctypes actually gives a standard way to access python's c implementation, which is using errno. I haven't tested this on anything other than my (linux) system, but this should be very portable: ctypes.c_int.in_dll(ctypes.pythonapi,"errno") which returns a c_int containing the current value.
0
1
0
1
2009-03-19T04:00:00.000
6
0.033321
false
661,017
0
0
0
1
I am stuck with a fairly complex Python module that does not return useful error codes (it actually fails disturbingly silently). However, the underlying C library it calls sets errno. Normally errno comes in over OSError attributes, but since I don't have an exception, I can't get at it. Using ctypes, libc.errno doesn't work because errno is a macro in GNU libc. Python 2.6 has some affordances but Debian still uses Python 2.5. Inserting a C module into my pure Python program just to read errno disgusts me. Is there some way to access errno? A Linux-only solution is fine, since the library being wrapped is Linux-only. I also don't have to worry about threads, as I'm only running one thread during the time in which this can fail.
Can I use a single file as a buffer? I.e. write to and read from at same time
669,335
2
2
313
0
python,file-io
You can use memory-mapped files, standard Python module called mmap.
0
1
0
0
2009-03-19T11:20:00.000
3
0.132549
false
661,826
0
0
0
1
I want to have an application writing out information at the same time that a monitor is reading it. The application is "embedded" (and on Win32 XP) and so has restricted memory and I/O functionality. The simplest way I can think to do this is by writing the data to a buffer file from the application, and then read the same file using the monitor application. The writer application is C++, and the reader is currently Python on Win32 XP. Are there libraries to do this? Has anyone seen examples of this? I don't want to have to use a database as I don't want to link to a database library in the applcation. I.e. don't have space and may not be supported on the embedded platform. Another way to do this is over a network connection, but I figure files are the simplest solution.
Can I write Python web application for Windows and Linux platforms at the same time?
663,372
0
3
1,553
0
python,cgi,fastcgi,wsgi
Writing python web apps is a topic on itself, but I would say that by default, it will be portable on multiple servers / platforms. When developping python web applications, you will often use frameworks that provide their own web server. For performance reasons, you might want to place it behind apache, but it is not even necessary, however, you might get a performance boost by placing it behind an apache server. Some of the most popular frameworks for web python are : Plone, Zope, CherryPy and TurboGears, only to name a few. Under apache, you could also use python server pages through mod_python, and since apache runs on windows too, this would aslo be portable.
0
1
0
0
2009-03-19T15:52:00.000
6
0
false
662,762
0
0
1
5
Can I write web application that I can host on Windows(IIS web server) and Linux (Apache or lighttpd) without any changes? CGI? Maybe something new? WSGI | FastCGI ?
Can I write Python web application for Windows and Linux platforms at the same time?
663,304
0
3
1,553
0
python,cgi,fastcgi,wsgi
consider also the possibility of using web2Py, or XML-RPC implementation, or Twisted...
0
1
0
0
2009-03-19T15:52:00.000
6
0
false
662,762
0
0
1
5
Can I write web application that I can host on Windows(IIS web server) and Linux (Apache or lighttpd) without any changes? CGI? Maybe something new? WSGI | FastCGI ?
Can I write Python web application for Windows and Linux platforms at the same time?
662,791
2
3
1,553
0
python,cgi,fastcgi,wsgi
Yes, if you use CGI, FastCGI or depending on your framework, even a self-contained web server (so IIS and Apache would be a reverse-proxy) then that would all work. The difference will be the configuration of the OS-specific servers, and also your Python environment on each OS. So you may find yourself doing a small bit of work at the beginning to make sure your paths are right, etc.
0
1
0
0
2009-03-19T15:52:00.000
6
0.066568
false
662,762
0
0
1
5
Can I write web application that I can host on Windows(IIS web server) and Linux (Apache or lighttpd) without any changes? CGI? Maybe something new? WSGI | FastCGI ?
Can I write Python web application for Windows and Linux platforms at the same time?
662,784
2
3
1,553
0
python,cgi,fastcgi,wsgi
web.py includes a server... It will do the trick for small jobs. By the way, Apache works on windows.
0
1
0
0
2009-03-19T15:52:00.000
6
0.066568
false
662,762
0
0
1
5
Can I write web application that I can host on Windows(IIS web server) and Linux (Apache or lighttpd) without any changes? CGI? Maybe something new? WSGI | FastCGI ?
Can I write Python web application for Windows and Linux platforms at the same time?
662,789
7
3
1,553
0
python,cgi,fastcgi,wsgi
Yes you can. But you can also use apache on windows. If you go the IIS way there's only CGI and it's pretty hard to set up. You can also use python based server like CherryPy which is pretty good and will work on all platforms with python. Some frameworks like django support both CGI and WSGI, so you don't have to worry about the details of WSGI or CGI much. If you ask me, WSGI is the future for python web apps.
0
1
0
0
2009-03-19T15:52:00.000
6
1
false
662,762
0
0
1
5
Can I write web application that I can host on Windows(IIS web server) and Linux (Apache or lighttpd) without any changes? CGI? Maybe something new? WSGI | FastCGI ?
PyObjC + Python 3.0 Questions
667,584
9
10
1,254
0
python,cocoa,xcode,pyobjc
PyObjC does not yet work with Python 3.0. According to Ronald Oussoren, a (the?) PyObjC developer, Python 3.0 support is possible, but not yet implemented: Support for Python 3.x is on my todo list but is non-trivial to achieve. PyObjC contains a large amount of pretty low-level C code, getting the details w.r.t. to the changes in 3.0 right is not easy. I have looked into a Python 3.x port and this should be fairly easy, but it's still a couple of days work. I'm not planning to work on that before the next release of PyObjC, that's way too long overdue as it is. I'm sure patches would be welcomed.
0
1
0
0
2009-03-20T13:30:00.000
2
1.2
true
666,148
1
0
0
1
By default, a Cocoa-Python application uses the default Python runtime which is version 2.5. How can I configure my Xcode project so that it would use the newer Python 3.0 runtime? I tried replacing the Python.framework included in the project with the newer version but it did not work. And another thing, are PyObjc modules compatible with the new version of Python?
Full command line as it was typed
667,556
29
36
9,141
0
python,command-line
You're too late. By the time that the typed command gets to Python your shell has already worked its magic. For example, quotes get consumed (as you've noticed), variables get interpolated, etc.
0
1
0
0
2009-03-20T19:11:00.000
10
1
false
667,540
1
0
0
4
I want to get the full command line as it was typed. This: " ".join(sys.argv[:]) doesn't work here (deletes double quotes). Also I prefer not to rejoin something that was parsed and split. Any ideas?
Full command line as it was typed
667,889
5
36
9,141
0
python,command-line
As mentioned, this probably cannot be done, at least not reliably. In a few cases, you might be able to find a history file for the shell (e.g. - "bash", but not "tcsh") and get the user's typing from that. I don't know how much, if any, control you have over the user's environment.
0
1
0
0
2009-03-20T19:11:00.000
10
0.099668
false
667,540
1
0
0
4
I want to get the full command line as it was typed. This: " ".join(sys.argv[:]) doesn't work here (deletes double quotes). Also I prefer not to rejoin something that was parsed and split. Any ideas?
Full command line as it was typed
668,518
2
36
9,141
0
python,command-line
On Linux there is /proc/<pid>/cmdline that is in the format of argv[] (i.e. there is 0x00 between all the lines and you can't really know how many strings there are since you don't get the argc; though you will know it when the file runs out of data ;). You can be sure that that commandline is already munged too since all escaping/variable filling is done and parameters are nicely packaged (no extra spaces between parameters, etc.).
0
1
0
0
2009-03-20T19:11:00.000
10
0.039979
false
667,540
1
0
0
4
I want to get the full command line as it was typed. This: " ".join(sys.argv[:]) doesn't work here (deletes double quotes). Also I prefer not to rejoin something that was parsed and split. Any ideas?
Full command line as it was typed
667,554
13
36
9,141
0
python,command-line
In a Unix environment, this is not generally possible...the best you can hope for is the command line as passed to your process. Because the shell (essentially any shell) may munge the typed command line in several ways before handing it to the OS for execution.
0
1
0
0
2009-03-20T19:11:00.000
10
1
false
667,540
1
0
0
4
I want to get the full command line as it was typed. This: " ".join(sys.argv[:]) doesn't work here (deletes double quotes). Also I prefer not to rejoin something that was parsed and split. Any ideas?
Web crawlers and Google App Engine Hosted applications
677,133
1
4
3,097
0
python,google-app-engine,web-crawler
App Engine code only runs in response to HTTP requests, so you can't run a persistent crawler in the background. With the upcoming release of scheduled tasks, you could write a crawler that uses that functionality, but it would be less than ideal.
0
1
0
0
2009-03-24T07:44:00.000
4
0.049958
false
676,460
0
0
1
2
Is it impossible to run a web crawler on GAE along side with my app considering the I am running the free startup version?
Web crawlers and Google App Engine Hosted applications
677,320
0
4
3,097
0
python,google-app-engine,web-crawler
It's possible. But that's not really an application for appengine just as Arachnid wrote. If you manage to get it working I'll doubt you'll stay in the qotas for free accounts.
0
1
0
0
2009-03-24T07:44:00.000
4
0
false
676,460
0
0
1
2
Is it impossible to run a web crawler on GAE along side with my app considering the I am running the free startup version?
What to do with "The input line is too long" error message?
4,378,603
1
10
26,102
0
python,command-line,windows-console
I got the same message but it was strange because the command was not that long (130 characters) and it used to work, it just stopped working one day. I just closed the command window and opened a new one and it worked. I have had the command window opened for a long time (maybe months, it's a remote virtual machine). I guess is some windows bug with a buffer or something.
0
1
0
0
2009-03-25T18:08:00.000
6
0.033321
false
682,799
0
0
0
2
I am trying to use os.system() to call another program that takes an input and an output file. The command I use is ~250 characters due to the long folder names. When I try to call the command, I'm getting an error: The input line is too long. I'm guessing there's a 255 character limit (its built using a C system call, but I couldn't find the limitations on that either). I tried changing the directory with os.chdir() to reduce the folder trail lengths, but when I try using os.system() with "..\folder\filename" it apparently can't handle relative path names. Is there any way to get around this limit or get it to recognize relative paths?
What to do with "The input line is too long" error message?
682,807
1
10
26,102
0
python,command-line,windows-console
Assuming you're using windows, from the backslashes, you could write a .bat file from python and then os.system() on that. It's a hack.
0
1
0
0
2009-03-25T18:08:00.000
6
0.033321
false
682,799
0
0
0
2
I am trying to use os.system() to call another program that takes an input and an output file. The command I use is ~250 characters due to the long folder names. When I try to call the command, I'm getting an error: The input line is too long. I'm guessing there's a 255 character limit (its built using a C system call, but I couldn't find the limitations on that either). I tried changing the directory with os.chdir() to reduce the folder trail lengths, but when I try using os.system() with "..\folder\filename" it apparently can't handle relative path names. Is there any way to get around this limit or get it to recognize relative paths?
python convert microsoft office docs to plain text on linux
685,656
0
11
11,214
0
python,linux,ms-office
I've had some success at using XSLT to process the XML-based office files into something usable in the past. It's not necessarily a python-based solution, but it does get the job done.
0
1
0
0
2009-03-26T12:24:00.000
7
0
false
685,533
0
0
0
1
Any recomendations on a method to convert .doc, .ppt, and .xls to plain text on linux using python? Really any method of conversion would be useful. I have already looked at using Open Office but, I would like a solution that does not require having to install Open Office.
Python module for VBox?
694,365
2
2
1,234
0
python,virtualbox
Consider using libvirt. The VirtualBox support is bleeding-edge (not in any release, may not even be in source control yet, but is available as a set of patches on the mailing list) -- but this single API, available for C, Python and several other languages, lets you control virtual machines and images running in Qemu/KVM, Xen, LXC (Linux Containers), UML (User-Mode Linux), OpenVZ and others. I build and administer virtual appliances (in an automated QA context) using libvirt with the qemu/KVM backend, and it meets my needs very well. libvirt can be configured to allow remote access (such as controlling or querying VBoxService or libvirtd from within one of the VMs, which you appear to want to do -- though I question the wisdom and utility), with numerous authentication and transport options available. [Caveat: libvirt principally targets Unixlike operating systems; it can be built for win32, but YMMV]
0
1
0
0
2009-03-28T23:20:00.000
1
1.2
true
693,752
1
0
0
1
I want to make some python scripts to create an "Appliance" with VirtualBox. However, I can't find any documentation anywhere on making calls to VBoxService.exe. Well, I've found stuff that works from OUTSIDE the Machine, but nothing from working from inside the machine. Does anyone know anything about this? If there's a library for another language like C I'd be okay with it, though Python would be heavily preferred.
Suppress output in Python calls to executables
2,728,111
12
45
42,935
0
python,redirect
If your search engine lead you to this old question (like me), be aware that using PIPE may lead to deadlocks. Indeed, because pipes are buffered, you can write a certain number of bytes in a pipe, even if no one read it. However the size of buffer is finite. And consequently if your program A has an output larger than the buffer, A will be blocked on writing, while the calling program B awaits the termination of A. But not, in this particular case... see comments below. Still, I recommend using Devin Jeanpierre and DNS' solution.
0
1
0
1
2009-03-30T22:39:00.000
9
1
false
699,325
0
0
0
1
I have a binary named A that generates output when called. If I call it from a Bash shell, most of the output is suppressed by A > /dev/null. All of the output is suppressed by A &> /dev/null I have a python script named B that needs to call A. I want to be able to generate output from B, while suppressing all the output from A. From within B, I've tried os.system('A'), os.system('A > /dev/null'), and os.system('A &> /dev/null'), os.execvp('...'), etc. but none of those suppress all the output from A. I could run B &> /dev/null, but that suppresses all of B's output too and I don't want that. Anyone have suggestions?
Using pydev with Eclipse on OSX
10,695,484
1
11
11,573
0
python,eclipse
I know this is a ancient post... but, in case of some newbee like me to get the better answer. I just using "Eclipse Marketplace" from the "Help" menu and search for keyword "python" or "PyDev" to get PyDev, and get it successfully installed. AND, you should add PyDev to the top-right dock. For the instance, my eclipse on my laptop's OSX is (Version: Indigo Service Release 2 Build id: 20120216-1857). Have fun, folks! :)
0
1
0
0
2009-04-01T03:11:00.000
4
0.049958
false
703,925
0
0
0
2
I setup PyDev with this path for the python interpreter /System/Library/Frameworks/Python.framework/Versions/2.5/Python since the one under /usr/bin were alias and Eclipse won't select it. I can run my python script now but cannot run the shell as an external tool. The message I get is variable references empty selection ${resource_loc} Same if I use {container_loc} Any thoughts ? Sunit
Using pydev with Eclipse on OSX
884,296
3
11
11,573
0
python,eclipse
Common practice seems to be to install an up-to-date Python 2.5 from python.org and use that instead of the system installation. I saw that recommended here and there when I got started on Mac OS X. It installs under /Library (as opposed to /System/Library) so the system Python is intact. Pydev has /Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python as its configured Python interpreter and all is well. Can't state for sure that your trouble is due only to using the system's Python installation; in any case this way I have no trouble. Also, this way when you fiddle with your development environment (install things in site-packages, upgrade Python), anything that uses the system Python is sure to be unaffected.
0
1
0
0
2009-04-01T03:11:00.000
4
0.148885
false
703,925
0
0
0
2
I setup PyDev with this path for the python interpreter /System/Library/Frameworks/Python.framework/Versions/2.5/Python since the one under /usr/bin were alias and Eclipse won't select it. I can run my python script now but cannot run the shell as an external tool. The message I get is variable references empty selection ${resource_loc} Same if I use {container_loc} Any thoughts ? Sunit
How do I schedule a process' termination?
704,223
0
0
2,629
0
python,bash,unix,process,kill
One idea: Save the process's PID (returned by fork() in your child process) to a file, then either schedule a cron job to kill it or kill it manually, reading the PID from the file. Another option: Create a shell script wrapper that automatically kills and restarts the process. Same as above, but you can keep the PID in memory, sleep for as long as you need, kill the process, then loop.
0
1
0
0
2009-04-01T05:44:00.000
7
0
false
704,203
0
0
0
1
I need to run a process, wait a few hours, kill it, and start it again. Is there an easy way that I can accomplish this with Python or Bash? I can run it in the background but how do I identify it to use kill on it?
check permissions of directories in python
704,953
0
3
15,588
0
python,chmod
Does it have to be python? You can also use find to do that : "find . -perm 775"
0
1
0
0
2009-04-01T10:35:00.000
5
0
false
704,945
0
0
0
1
i want a python program that given a directory, it will return all directories within that directory that have 775 (rwxrwxr-x) permissions thanks!
Create a standalone windows exe which does not require pythonXX.dll
707,261
1
16
9,499
0
python,windows,py2exe
This is not the best way to do it, but you might consider using executable SFX Archive with both the .exe and .dll files inside, and setting it to execute your .exe file when it's double clicked.
0
1
0
0
2009-04-01T20:38:00.000
5
0.039979
false
707,242
1
0
0
2
is there a way to create a standalone .exe from a python script. Executables generated with py2exe can run only with pythonXX.dll. I'd like to obtain a fully standalone .exe which does not require to install the python runtime library. It looks like a linking problem but using static library instead the dynamic one and it would be also useful to apply a strip in order to remove the unused symbols. Any idea ? Thanks. Alessandro
Create a standalone windows exe which does not require pythonXX.dll
707,310
5
16
9,499
0
python,windows,py2exe
Due to how Windows' dynamic linker works you cannot use the static library if you use .pyd or .dll Python modules; DLLs loaded in Windows do not automatically share their symbol space with the executable and so require a separate DLL containing the Python symbols.
0
1
0
0
2009-04-01T20:38:00.000
5
0.197375
false
707,242
1
0
0
2
is there a way to create a standalone .exe from a python script. Executables generated with py2exe can run only with pythonXX.dll. I'd like to obtain a fully standalone .exe which does not require to install the python runtime library. It looks like a linking problem but using static library instead the dynamic one and it would be also useful to apply a strip in order to remove the unused symbols. Any idea ? Thanks. Alessandro
Packaging Ruby or Python applications for distribution?
718,216
1
4
2,181
0
python,ruby,deployment
You can't strictly do this (creating a single installer/executable) in a general cross-platform way, because different platforms use different executable formats. The JVM thing is relying on having a platform-specific JVM already installed on the destination computer; if there is not one installed, then your JAR won't run unless you install a JVM in a platform-specific way. Perhaps more importantly, any third-party Python packages that rely on binary extensions will not play well with Jython unless specifically released in a Jython version, which is unusual. (I presume that a similar situation holds for Ruby packages, though I have no direct knowledge there, nor even how common it is for Ruby packages to use binary extensions....) You'd be able to use the whole range of Java libraries, but very little in the way of Python/Ruby libraries. It's also worth noting that the JVM versions of languages tend to lag behind the standard version, offering fewer language features and less-frequent bugfixes. If your code is pure Python, then it's already cross-platform as long as the destination machine already has Python installed, just as Java is... but at least in Windows, it's rather less safe to assume that Python is installed than to assume that Java is installed. The third-party elements (database, etc) are likely to be platform-specific binaries, too. User expectations about what's a reasonable installation process vary considerably across platforms, too -- if your app uses third-party libraries or tools, you'd better include all of them for Windows users, but *nix users tend to be more tolerant of downloading dependencies. (However, expectations for that to be handled automatically by a package manager are growing...) Really, if this is a large-ish application stack and you want to be able to have a drop-in bundle that can be deployed on almost any server, the easiest route would probably be to distribute it as a complete VMWare virtual machine -- the player software is free (for at least Windows and *nix, but I presume for Mac as well), and it allows you to create a dedicated Linux/BSD system that's already fully configured specifically for your application. (I say Linux/BSD because then you don't need to worry about OS licensing fees...) (If it's a smaller application that you want to allow to run on a client's existing webserver, then I suspect that cross-OS compatibility will be less of a concern than cross-webserver compatibility -- while Apache does have a Windows version, the vast majority of Windows webservers run IIS, and having a single package distribution (or even single version of your application) that plays well with both of those webservers is likely to be impractical.)
0
1
0
0
2009-04-04T04:52:00.000
5
0.039979
false
716,524
0
0
1
2
Are there any good options other than the JVM for packaging Python or Ruby applications for distribution to end-users? Specifically, I'm looking for ways to be able to write and test a web-based application written in either Ruby or Python, complete with a back-end database, that I can then wrap up in a convenient set of platform-independent packages (of some type) for deployment on Windows, Linux, OS X, and FreeBSD? Edit: What I mean by a 'web-based application' is a webapp that end-users can run on servers at their companies, providing a web service internally to their end-users. There are a lot of ways to do this on the JVM via JPython or JRuby, but I'm curious if there's a non-JVM route with alternate VMs or interpreters.
Packaging Ruby or Python applications for distribution?
7,002,189
1
4
2,181
0
python,ruby,deployment
You can either distribute the app as a virtual machine or create an installer that includes all dependencies, like the GitHub guys did for their on-premise version.
0
1
0
0
2009-04-04T04:52:00.000
5
0.039979
false
716,524
0
0
1
2
Are there any good options other than the JVM for packaging Python or Ruby applications for distribution to end-users? Specifically, I'm looking for ways to be able to write and test a web-based application written in either Ruby or Python, complete with a back-end database, that I can then wrap up in a convenient set of platform-independent packages (of some type) for deployment on Windows, Linux, OS X, and FreeBSD? Edit: What I mean by a 'web-based application' is a webapp that end-users can run on servers at their companies, providing a web service internally to their end-users. There are a lot of ways to do this on the JVM via JPython or JRuby, but I'm curious if there's a non-JVM route with alternate VMs or interpreters.
How do I write to the console in Google App Engine?
18,987,161
0
50
25,274
0
python,google-app-engine,logging
Use log.setLevel(Level.ALL) to see messages The default message filtering level seems to be 'error'. I didn't see any useful log messages until I used the setLevel() method to make the .info and .warning messages visible. Text printed to System.out wasn't showing up either. It seems to be interpreted as log.info() level messaages.
0
1
0
0
2009-04-07T20:14:00.000
11
0
false
727,410
0
0
1
2
Often when I am coding I just like to print little things (mostly the current value of variables) out to console. I don't see anything like this for Google App Engine, although I note that the Google App Engine Launcher does have a Log terminal. Is there any way to write to said Terminal, or to some other terminal, using Google App Engine?
How do I write to the console in Google App Engine?
20,152,111
1
50
25,274
0
python,google-app-engine,logging
Hello I'm using the version 1.8.6 of GoogleAppEngineLauncher, you can use a flag to set the messages log level you want to see, for example for debug messages: --dev_appserver_log_level debug Use it instead of --debug (see @Christopher answer).
0
1
0
0
2009-04-07T20:14:00.000
11
0.01818
false
727,410
0
0
1
2
Often when I am coding I just like to print little things (mostly the current value of variables) out to console. I don't see anything like this for Google App Engine, although I note that the Google App Engine Launcher does have a Log terminal. Is there any way to write to said Terminal, or to some other terminal, using Google App Engine?
How do you automate the launching/debugging of large scale projects?
750,128
0
4
1,141
0
python,debugging,gdb,subprocess,selinux
Your comment notes that you're sshing in with putty... do you have a controlling tty? With openssh you would want to add the -T option, I don't know how/if putty will do this the way you're using it. Also: you might try using cygwin's ssh instead of putty.
0
1
0
0
2009-04-10T22:43:00.000
3
0
false
739,090
0
0
0
2
Scenario: There is a complex piece of software that is annoying to launch by hand. What I've done is to create a python script to launch the executable and attach gdb for debugging. The process launching script: ensures an environment variable is set. ensures a local build directory gets added to the environment's LD_LIBRARY_PATH variable. changes the current working directory to where the executable expects to be (not my design) launches the executable with a config file the only command line option pipes the output from the executable to a second logging process remembers PID of executable, then launches & attaches gdb to running executable. The script works, with one caveat. ctrl-c doesn't interrupt the debugee and return control to gdb. So if I "continue" with no active breakpoints I can never stop the process again, it has to be killed/interrupted from another shell. BTW, running "kill -s SIGINT <pid>" where <pid> is the debuggee's pid does get me back to gdb's prompt... but it is really annoying to have to do things this way At first I thought Python was grabbing the SIGINT signal, but this doesn't seem to be the case as I set up signal handlers forward the signal to the debugee and that doesn't fix the problem. I've tried various configurations to the python script (calling os.spawn* instead of subprocess, etc.) It seems that any way I go about it, if python launched the child process, SIGINT (ctrl-c) signals DO NOT to get routed to gdb or the child process. Current line of thinking This might be related to needing a separate process group id for the debugee & gdb...any credence to this? Possible bug with SELinux? Info: gdb 6.8 Python 2.5.2 (problem present with Python 2.6.1 as well) SELinux Environment (bug delivering signals to processes?) Alternatives I've considered: Setting up a .gdbinit file to do as much of what the script does, environment variables and current working directory are a problem with this approach. Launching executable and attaching gdb manually (yuck) Question: How do you automate the launching/debugging of large scale projects? Update: I've tried Nicholas Riley's examples below, on my Macintosh at home they all allow cntl-c to work to varrying degrees, on the production boxen (which I now to believe may be running SELinux) they don't...
How do you automate the launching/debugging of large scale projects?
753,721
0
4
1,141
0
python,debugging,gdb,subprocess,selinux
if you already have a current script set up to do this, but are having problems automating part of it, maybe you can just grab expect and use it to provide the setup, then drop back into interactive mode in expect to launch the process. Then you can still have your ctrl-c available to interrupt.
0
1
0
0
2009-04-10T22:43:00.000
3
0
false
739,090
0
0
0
2
Scenario: There is a complex piece of software that is annoying to launch by hand. What I've done is to create a python script to launch the executable and attach gdb for debugging. The process launching script: ensures an environment variable is set. ensures a local build directory gets added to the environment's LD_LIBRARY_PATH variable. changes the current working directory to where the executable expects to be (not my design) launches the executable with a config file the only command line option pipes the output from the executable to a second logging process remembers PID of executable, then launches & attaches gdb to running executable. The script works, with one caveat. ctrl-c doesn't interrupt the debugee and return control to gdb. So if I "continue" with no active breakpoints I can never stop the process again, it has to be killed/interrupted from another shell. BTW, running "kill -s SIGINT <pid>" where <pid> is the debuggee's pid does get me back to gdb's prompt... but it is really annoying to have to do things this way At first I thought Python was grabbing the SIGINT signal, but this doesn't seem to be the case as I set up signal handlers forward the signal to the debugee and that doesn't fix the problem. I've tried various configurations to the python script (calling os.spawn* instead of subprocess, etc.) It seems that any way I go about it, if python launched the child process, SIGINT (ctrl-c) signals DO NOT to get routed to gdb or the child process. Current line of thinking This might be related to needing a separate process group id for the debugee & gdb...any credence to this? Possible bug with SELinux? Info: gdb 6.8 Python 2.5.2 (problem present with Python 2.6.1 as well) SELinux Environment (bug delivering signals to processes?) Alternatives I've considered: Setting up a .gdbinit file to do as much of what the script does, environment variables and current working directory are a problem with this approach. Launching executable and attaching gdb manually (yuck) Question: How do you automate the launching/debugging of large scale projects? Update: I've tried Nicholas Riley's examples below, on my Macintosh at home they all allow cntl-c to work to varrying degrees, on the production boxen (which I now to believe may be running SELinux) they don't...
Need to build (or otherwise obtain) python-devel 2.3 and add to LD_LIBRARY_PATH
754,180
2
2
1,219
0
python,linux,build
You can use the python RPM's linked to from the python home page ChristopheD mentioned. You can extract the RPM's using cpio, as they are just specialized cpio archives. Your method of extracting them to your home directory and setting LD_LIBRARY_PATH and PATH should work; I use this all the time for hand-built newer versions of projects I also have installed. Don't focus on the -devel package though; you need the main package. You can unpack the -devel one as well, but the only thing you'll actually use from it is the libpython2.3.so symlink that points to the actual library, and you can just as well create this by hand. Whether this is the right approach depends on what you are trying to do. If all you're trying to do is to get this one application to run for you personally, then this hack sounds fine. If you wanted to actually distribute something to other people for running this application, and you have no way of fixing the actual application, you should consider building an rpm of the older python version that doesn't conflict with the system-installed one.
0
1
0
0
2009-04-15T21:13:00.000
2
1.2
true
753,749
0
0
0
1
I am supporting an application with a hard dependency on python-devel 2.3.7. The application runs the python interpreter embedded, attempting to load libpython2.3.so - but since the local machine has libpython2.4.so under /usr/lib64, the application is failing. I see that there are RPMs for python-devel (but not version 2.3.x). Another wrinkle is that I don't want to overwrite the existing python under /usr/lib (I don't have su anyway). What I want to do is place the somewhere in my home directory (i.e. /home/noahz/lib) and use PATH and LD_LIBRARY_PATH to point to the older version for this application. What I'm trying to find out (but can't seem to craft the right google search for) is: 1) Where do I download python-devel-2.3 or libpython2.3.so.1.0 (if either available) 2a) If I can't download python-devel-2.3, how do I build libpython2.3.so from source (already downloaded Python-2.3.tgz and 2b) Is building libpython2.3.so.1.0 from source and pointing to it with LD_LIBRARY_PATH good enough, or am I going to run into other problems (other dependencies) 3) In general, am I approaching this problem the right way? ADDITIONAL INFO: I attempted to symlink (ln -s) to the later version. This caused the app to fail silently. Distro is Red Hat Enterprise Linux 5 (RHEL5) - for x86_64
How do you use Binary conversion in Python/Bash/AWK?
6,600,616
0
1
2,535
0
python,bash,binary,awk
In newer versions of Python there exists the bin() function which I believe takes an int and returns a binary literal, of form 0b011010 or whatever.
0
1
0
0
2009-04-16T15:14:00.000
3
0
false
756,630
1
0
0
1
I am new in binary conversion. I use Python, Bash and AWK daily. I would like to see binary conversion's applications in these languages. For example, I am interested in problems which you solve by it at your work. Where do you use binary conversion in Python/Bash/AWK? I would like to see examples of codes.
How to retrieve google appengine entities using their numerical id?
760,060
0
3
1,494
0
python,google-app-engine
Turns out I needed to do key = Key.from_path( Application_ModelName, numeric_id ) wasn't clear till i looked at the dict() of an entity
0
1
0
0
2009-04-17T09:39:00.000
4
0
false
759,771
0
0
1
1
Is it possible to retrieve an entity from google appengine using their numerical IDs and if so how? I tried using: key = Key.from_path("ModelName", numericalId) m = ModelName.get(key) but the key generated wasnt correct.
Investigating python process to see what's eating CPU
784,432
6
6
3,282
0
python,multithreading,debugging,monitoring,pylons
As you noted, in --reload mode, Paste sweeps the filesystem every second to see if any of the files loaded have changed. If they have, then Paste reloads the process. You can also manually tell Paste to monitor non-Python code modules for changes if desired. You can change the reload interval with the --reload-interval option, this will reduce the CPU usage when using --reload as it will sweep less often.
0
1
0
1
2009-04-17T11:17:00.000
2
1
false
760,039
0
0
0
1
I have a python process (Pylons webapp) that is constantly using 10-30% of CPU. I'll improve/tune logging to get some insight of what's going on, but until then, are there any tools/techniques that allow to see what python process is doing, how many and how busy threads it has etc? Update: configured access log which shows that there are no requests going on, webapp is just idling no point to plug in paste.profile in middleware chain since there are no requests, activity must be happening either in webapp's worker threads or paster web server running paster like this: "python -m cProfile -o outfile /usr/bin/paster serve dev.ini" and inspecting results shows that most time is spent in "posix.waitpid". Paster runs webapp in subprocess, subprocess activity is not picked up by profiler looking into ;hacking PasteScript "serve" command so that subprocesses would get profiled Another update: After much tinkering, sticking profiler in various places and getting familiar with PasteScript insides, I discovered that the constant CPU load goes away if application is started without "--reload" parameter (this flag tells paster to restart itself if code changes, handy in development), which is fine in production environment.
How to hide console window in python?
70,466,855
1
92
193,952
0
python,console,hide
just change the file extension from .py to .pyw
0
1
0
0
2009-04-19T01:35:00.000
9
0.022219
false
764,631
1
0
0
3
I am writing an IRC bot in Python. I wish to make stand-alone binaries for Linux and Windows of it. And mainly I wish that when the bot initiates, the console window should hide and the user should not be able to see the window. What can I do for that?
How to hide console window in python?
764,642
44
92
193,952
0
python,console,hide
In linux, just run it, no problem. In Windows, you want to use the pythonw executable. Update Okay, if I understand the question in the comments, you're asking how to make the command window in which you've started the bot from the command line go away afterwards? UNIX (Linux) $ nohup mypythonprog & Windows C:/> start pythonw mypythonprog I think that's right. In any case, now you can close the terminal.
0
1
0
0
2009-04-19T01:35:00.000
9
1
false
764,631
1
0
0
3
I am writing an IRC bot in Python. I wish to make stand-alone binaries for Linux and Windows of it. And mainly I wish that when the bot initiates, the console window should hide and the user should not be able to see the window. What can I do for that?
How to hide console window in python?
15,148,338
28
92
193,952
0
python,console,hide
On Unix Systems (including GNU/Linux, macOS, and BSD) Use nohup mypythonprog &, and you can close the terminal window without disrupting the process. You can also run exit if you are running in the cloud and don't want to leave a hanging shell process. On Windows Systems Save the program with a .pyw extension and now it will open with pythonw.exe. No shell window. For example, if you have foo.py, you need to rename it to foo.pyw.
0
1
0
0
2009-04-19T01:35:00.000
9
1
false
764,631
1
0
0
3
I am writing an IRC bot in Python. I wish to make stand-alone binaries for Linux and Windows of it. And mainly I wish that when the bot initiates, the console window should hide and the user should not be able to see the window. What can I do for that?
Programmatically taking screenshots in windows without the application noticing
767,992
6
0
3,194
0
python,windows,events,operating-system,screenshot
There will certainly be no protection against a screenshot taken with a digital camera.
1
1
0
0
2009-04-20T07:11:00.000
4
1
false
767,212
0
0
0
2
There are various ways to take screenshots of a running application in Windows. However, I hear that an application can be tailored such that it can notice when a screenshot is being taken of it, through some windows event handlers perhaps? Is there any way of taking a screenshot such that it is impossible for the application to notice? (Maybe even running the application inside a VM, and taking a screenshot from the host?) I'd prefer solutions in Python, but anything will do.
Programmatically taking screenshots in windows without the application noticing
767,985
3
0
3,194
0
python,windows,events,operating-system,screenshot
> I hear that an application can be tailored such that it can notice when a screenshot is being taken of it Complete nonsense. Don't repeat what kids say... Read MSDN about screenshots.
1
1
0
0
2009-04-20T07:11:00.000
4
1.2
true
767,212
0
0
0
2
There are various ways to take screenshots of a running application in Windows. However, I hear that an application can be tailored such that it can notice when a screenshot is being taken of it, through some windows event handlers perhaps? Is there any way of taking a screenshot such that it is impossible for the application to notice? (Maybe even running the application inside a VM, and taking a screenshot from the host?) I'd prefer solutions in Python, but anything will do.
Estimating zip size/creation time
767,701
3
7
3,583
0
python,zip,time-estimation
I suggest you measure the average time it takes to produce a zip of a certain size. Then you calculate the estimate from that measure. However I think the estimate will be very rough in any case if you don't know how well the data compresses. If the data you want to compress had a very similar "profile" each time you could probably make better predictions.
0
1
0
1
2009-04-20T10:23:00.000
4
0.148885
false
767,684
0
0
0
2
I need to create ZIP archives on demand, using either Python zipfile module or unix command line utilities. Resources to be zipped are often > 1GB and not necessarily compression-friendly. How do I efficiently estimate its creation time / size?
Estimating zip size/creation time
767,704
16
7
3,583
0
python,zip,time-estimation
Extract a bunch of small parts from the big file. Maybe 64 chunks of 64k each. Randomly selected. Concatenate the data, compress it, measure the time and the compression ratio. Since you've randomly selected parts of the file chances are that you have compressed a representative subset of the data. Now all you have to do is to estimate the time for the whole file based on the time of your test-data.
0
1
0
1
2009-04-20T10:23:00.000
4
1.2
true
767,684
0
0
0
2
I need to create ZIP archives on demand, using either Python zipfile module or unix command line utilities. Resources to be zipped are often > 1GB and not necessarily compression-friendly. How do I efficiently estimate its creation time / size?
importing gaeutilities or any other module by dev_appserver
771,165
1
0
803
0
python,google-app-engine,import
Strange. I would start troubleshooting by making 100% sure that the sys.path that dev_appserver.py uses does include C:\Python25\Lib\site-packages\gaeutilities-1.2.1. I suggest you display sys.path in a HTML view served by dev_appserver.py. Check permissions on gaeutilities-1.2.1 directory and subdirectories. Perhaps the python interpreter is unable to create *.pyc files or something like that. Another suggestion: Put the appengines_utilities folder in your application directory (the directory that contains your app.yaml file). I guess you need all third-party stuff there anyway if you want to upload the code to google's servers.
0
1
0
0
2009-04-20T22:39:00.000
1
1.2
true
770,385
0
0
1
1
I'm developing a gae application on a windows machine. to have session handling I downloaded gaeutilities and added its path (C:\Python25\Lib\site-packages\gaeutilities-1.2.1) to the registry ("PythonPath" item under python25). in my code this is how I import the gaeutilities Session class: from appengine_utilities.sessions import Session when gae engine (dev_appserver.py) tries to import it, an exception is raised, stating an importerror and "no module named appengine_utilities.sessions" on the other hand, pyscripter can find the module (autocomplete becomes available for the Session class), and I can import the module within the python interpreter (the same one that dev_appserver uses, python 2.5.4). for a remedy, I created a PYTHONPATH environmental variable and also added the path to it. nothing changes. I'm lost. what am I doing wrong? important edit: I have found myself to be totally unable to import any 3rd party gae modules. PYTHONPATH is correct, sys.path is correct, registry is correct, still dev_appserver complains of importerror.
Call python script from AIR application?
3,895,749
0
1
1,223
0
python,flex3,air
Air 2.0 has a native process API.
0
1
0
0
2009-04-21T09:09:00.000
4
0
false
771,738
0
0
0
3
How can we invoke a python script using AIR 1.5?
Call python script from AIR application?
771,836
-1
1
1,223
0
python,flex3,air
Hypothetically, Adobe Alchemy technology may allow you to port Python interpreter to Flash. Though I seriously doubt that's the approach you want to use. Depending on task there should be easier solutions.
0
1
0
0
2009-04-21T09:09:00.000
4
-0.049958
false
771,738
0
0
0
3
How can we invoke a python script using AIR 1.5?
Call python script from AIR application?
771,745
1
1
1,223
0
python,flex3,air
You cannot directly invoke system commands or run an executable (the python interpreter) from within an AIR application. If it's possible to share what exactly you want to do, maybe we can suggest alternatives. If it's really really (that's two reallys) important to run an executable from AIR lookup the CommandProxy demo.
0
1
0
0
2009-04-21T09:09:00.000
4
1.2
true
771,738
0
0
0
3
How can we invoke a python script using AIR 1.5?
What does the 'shell' argument in subprocess mean on Windows?
772,743
1
1
1,280
0
python,subprocess
When you execute an external process, the command you want may look something like "foo arg1 arg2 arg3". If "foo" is an executable, that is what gets executed and given the arguments. However, often it is the case that "foo" is actually a script of some sort, or maybe a command that is built-in to the shell and not an actual executable file on disk. In this case the system can't execute "foo" directly because, strictly speaking, these sorts of things aren't executable. They need some sort of "shell" to execute them. On *nix systems this shell is typically (but not necessarily) /bin/sh. On windows it will typically be cmd.exe (or whatever is stored in the COMSPEC environment variable). This parameter lets you define what shell you wish to use to execute your command, for the relatively rare case when you don't want the default.
0
1
0
0
2009-04-21T09:35:00.000
4
1.2
true
771,816
1
0
0
1
The docs for the subprocess module state that 'If shell is True, the specified command will be executed through the shell'. What does this mean in practice, on a Windows OS?
os.path.exists() for files in your Path?
777,067
3
16
87,347
0
python,windows
Please note that checking for existance and then opening is always open to race-conditions. The file can disappear between your program's check and its next access of the file, since other programs continue to run on the machine. Thus there might still be an exception being thrown, even though your code is "certain" that the file exists. This is, after all, why they're called exceptions.
0
1
0
0
2009-04-22T01:09:00.000
5
0.119427
false
775,351
1
0
0
2
I commonly use os.path.exists() to check if a file is there before doing anything with it. I've run across a situation where I'm calling a executable that's in the configured env path, so it can be called without specifying the abspath. Is there something that can be done to check if the file exists before calling it? (I may fall back on try/except, but first I'm looking for a replacement for os.path.exists()) btw - I'm doing this on windows.
os.path.exists() for files in your Path?
777,961
2
16
87,347
0
python,windows
You generally shouldn't should os.path.exists to try to figure out if something is going to succeed. You should just try it and if you want you can handle the exception if it fails.
0
1
0
0
2009-04-22T01:09:00.000
5
0.07983
false
775,351
1
0
0
2
I commonly use os.path.exists() to check if a file is there before doing anything with it. I've run across a situation where I'm calling a executable that's in the configured env path, so it can be called without specifying the abspath. Is there something that can be done to check if the file exists before calling it? (I may fall back on try/except, but first I'm looking for a replacement for os.path.exists()) btw - I'm doing this on windows.
access eggs in python?
775,908
1
1
412
0
python,egg
Adding the egg to PYTHONPATH or to sys.path will allow you to access the modules and packages within.
0
1
0
0
2009-04-22T05:55:00.000
2
0.099668
false
775,880
1
0
0
1
Is there any way to call an installed python egg from python code? I need to cal a sphinx documentation generator from within a python code, and currently i'm doing it like this: os.system( "sphinx-build.exe -b html c:\\src c:\\dst" ) This works, but requires some additional configuration: 'scripts' folder inside a python installation folder need to be added to a system PATH ( i'm on Windows ). Is it any better, native way to call an installed python egg?
How to run a python script in the background?
783,541
2
26
42,798
0
python,windows,backgrounding
cron it on linux; schedule it on windows [control panel > scheduled tasks > Add scheduled task]
0
1
0
0
2009-04-23T21:07:00.000
6
0.066568
false
783,531
1
0
0
3
I have a script that checks something on my PC every 5 minutes and I don't want Python to show on my task tray. I use Windows as my operating system. Is there any way to make Python run in the background and force it to not show in my task tray?
How to run a python script in the background?
783,559
5
26
42,798
0
python,windows,backgrounding
Just another option you have: You can create a shortcut to your Python script, then right-click the shortcut --> Properties --> Shortcut tab There is a drop-down box under the Run option which lets you run the command minimized.
0
1
0
0
2009-04-23T21:07:00.000
6
0.16514
false
783,531
1
0
0
3
I have a script that checks something on my PC every 5 minutes and I don't want Python to show on my task tray. I use Windows as my operating system. Is there any way to make Python run in the background and force it to not show in my task tray?
How to run a python script in the background?
783,544
-6
26
42,798
0
python,windows,backgrounding
Look for Schedule Tasks in the control panel.
0
1
0
0
2009-04-23T21:07:00.000
6
1.2
true
783,531
1
0
0
3
I have a script that checks something on my PC every 5 minutes and I don't want Python to show on my task tray. I use Windows as my operating system. Is there any way to make Python run in the background and force it to not show in my task tray?
Is there a way to retrieve process stats using Perl or Python?
785,836
2
2
4,760
0
python,linux,perl,process
If you are fork()ing the child, you will know it's PID. From within the parent you can then parse the files in /proc/<PID/ to check the memory and CPU usage, albeit only for as long as the child process is running.
0
1
0
1
2009-04-24T13:18:00.000
3
0.132549
false
785,810
0
0
0
2
Is there a way to generically retrieve process stats using Perl or Python? We could keep it Linux specific. There are a few problems: I won't know the PID ahead of time, but I can run the process in question from the script itself. For example, I'd have no problem doing: ./myscript.pl some/process/I/want/to/get/stats/for Basically, I'd like to, at the very least, get the memory consumption of the process, but the more information I can get the better (like run time of the process, average CPU usage of the process, etc.) Thanks.
Is there a way to retrieve process stats using Perl or Python?
785,855
1
2
4,760
0
python,linux,perl,process
A common misconception is that reading /proc is like reading /home. /proc is designed to give you the same information with one open() that 20 similar syscalls filling some structure could provide. Reading it does not pollute buffers, send innocent programs to paging hell or otherwise contribute to the death of kittens. Accessing /proc/foo is just telling the kernel "give me information on foo that I can process in a language agnostic way" If you need more details on what is in /proc/{pid}/ , update your question and I'll post them.
0
1
0
1
2009-04-24T13:18:00.000
3
0.066568
false
785,810
0
0
0
2
Is there a way to generically retrieve process stats using Perl or Python? We could keep it Linux specific. There are a few problems: I won't know the PID ahead of time, but I can run the process in question from the script itself. For example, I'd have no problem doing: ./myscript.pl some/process/I/want/to/get/stats/for Basically, I'd like to, at the very least, get the memory consumption of the process, but the more information I can get the better (like run time of the process, average CPU usage of the process, etc.) Thanks.
How to install Python on mac os x and windows with Aptana Studio?
14,819,410
2
2
3,309
0
python,aptana
To add the current Python version on Mac: Add new interpreter via Aptana Studio 3/Preferences/PyDev/Interpreter-Python. Give it name (check version using the Terminal and then python or /usr/bin/python. Then add the path (2.7 in my case): /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python If you install your own (2.6 in my case) use the following path instead: /Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python Don't forget to hit the "Apply" button...
0
1
0
0
2009-04-24T19:57:00.000
7
0.057081
false
787,330
0
0
0
2
How do I get python to work with aptana studio? I've downloaded a bunch of stuff, but none of them seem to give me a straight text editor where I can interpret code into an executable type thing. I know there's interactive mode in IDLE, but I want to actually use an editor. So I downloaded the pydev extensions for Aptana studio, but it wants me to configure a python interpreter (so I guess it actually doesn't have one). Where can I find a straight python interpreter that will work with this? or another IDE?
How to install Python on mac os x and windows with Aptana Studio?
788,002
0
2
3,309
0
python,aptana
On Mac OS X Leopard and Tiger, Python is already installed. On Mac, I've tried a few editor. Textmate is my current choice. If you're looking for a free one, I really liked Xcode. But you'll have to run your script from the command line. If you want a cross-platform environment, you could try Eclipse and the pydev extension. So you don't get lost between the two platform.
0
1
0
0
2009-04-24T19:57:00.000
7
0
false
787,330
0
0
0
2
How do I get python to work with aptana studio? I've downloaded a bunch of stuff, but none of them seem to give me a straight text editor where I can interpret code into an executable type thing. I know there's interactive mode in IDLE, but I want to actually use an editor. So I downloaded the pydev extensions for Aptana studio, but it wants me to configure a python interpreter (so I guess it actually doesn't have one). Where can I find a straight python interpreter that will work with this? or another IDE?
How to install python-rsvg without python-gnome2-desktop on Ubuntu 8.10?
787,960
2
4
3,929
0
python,librsvg,rsvg
No longer relevant. Installed the entire package, and got rsvg that way.
0
1
0
0
2009-04-24T22:32:00.000
1
1.2
true
787,812
1
0
0
1
I need rsvg support in Python 2.5.2. It appears that I have to install all 199 deps along with the package python-gnome2-desktop, which doesn't sound fun at all. Alternatives?
Blender- python
788,143
1
3
1,821
0
python,blender
Personally, I was setting my PATH environment variable so that Blender would find the most appropriate version of Python first.
0
1
0
0
2009-04-25T02:36:00.000
4
0.049958
false
788,102
1
0
0
2
How do I point Blender to the version of python I have installed
Blender- python
7,134,809
5
3
1,821
0
python,blender
Blender 2.5x now comes bundled with its own python, this is un-modified, only included to so users don't have to match their system versions of python. If you remove this python/ directory blender will look for python on the system, matching the version it was compiled with. (3.2, 3.3 etc, minor point releases are all inter compatible). If you want to point to a non-standard python path you can set PYTHONHOME environment variable - python documents how this works (nothing specific to blender).
0
1
0
0
2009-04-25T02:36:00.000
4
0.244919
false
788,102
1
0
0
2
How do I point Blender to the version of python I have installed
Check to see if python script is running
66,500,807
0
121
189,116
0
python,process,daemon
I was looking for an answer on this and in my case, came to mind a very easy and very good solution, in my opinion (since it's not possible to exist a false positive on this, I guess - how can the timestamp on the TXT be updated if the program doesn't do it): --> just keep writing on a TXT the current timestamp in some time interval, depending on your needs (here each half hour was perfect). If the timestamp on the TXT is outdated relatively to the current one when you check, then there was a problem on the program and it should be restarted or what you prefer to do.
0
1
0
1
2009-04-25T06:59:00.000
20
0
false
788,411
0
0
0
1
I have a python daemon running as a part of my web app/ How can I quickly check (using python) if my daemon is running and, if not, launch it? I want to do it that way to fix any crashes of the daemon, and so the script does not have to be run manually, it will automatically run as soon as it is called and then stay running. How can i check (using python) if my script is running?
Locales and temperature/length conversion
790,078
0
1
355
0
python,localization
For what it's worth, KDE offers a choice of "Metric" or "Imperial" as the standard unit system, so I would presume that it's possible to access that information through Python somehow. Gnome might have a similar setting, I'm not sure... but I don't think there's any equivalent for a generic UNIX/Linux system. The most recent version of SciPy (0.7) includes a module for unit handling, and you can use that to do your conversions if necessary.
0
1
0
1
2009-04-25T23:49:00.000
2
0
false
789,953
1
0
0
1
Do locales contain information about preferred units for temperature, lengths, etc. on Unix/Linux? Is it possible to access these properties from Python? I checked out the "locales" module, but didn't find anything suitable. I'd like my application to automatically convert values into the most suitable unit.