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
Performance differences between Python and C
3,534,125
11
13
14,463
0
python,c,performance
C will absolutely crush Python in almost any performance category, but C is far more difficult to write and maintain and high performance isn't always worth the trade off of increased time and difficulty in development. You say you're doing things like text file processing, but what you omit is how much text file processing you're doing. If you're processing 10 million files an hour, you might benefit from writing it in C. But if you're processing 100 files an hour, why not use python? Do you really need to be able to process a text file in 10ms vs 50ms? If you're planning for the future, ask yourself, "Is this something I can just throw more hardware at later?" Writing solid code in C is hard. Be sure you can justify that investment in effort.
0
1
0
1
2010-08-20T18:27:00.000
14
1
false
3,533,759
1
0
0
11
Working on different projects I have the choice of selecting different programming languages, as long as the task is done. I was wondering what the real difference is, in terms of performance, between writing a program in Python, versus doing it in C. The tasks to be done are pretty varied, e.g. sorting textfiles, disk access, network access, textfile parsing. Is there really a noticeable difference between sorting a textfile using the same algorithm in C versus Python, for example? And in your experience, given the power of current CPU's (i7), is it really a noticeable difference (Consider that its a program that doesnt bring the system to its knees).
Performance differences between Python and C
3,533,877
37
13
14,463
0
python,c,performance
Use python until you have a performance problem. If you ever have one figure out what the problem is (often it isn't what you would have guessed up front). Then solve that specific performance problem which will likely be an algorithm or data structure change. In the rare case that your problem really needs C then you can write just that portion in C and use it from your python code.
0
1
0
1
2010-08-20T18:27:00.000
14
1.2
true
3,533,759
1
0
0
11
Working on different projects I have the choice of selecting different programming languages, as long as the task is done. I was wondering what the real difference is, in terms of performance, between writing a program in Python, versus doing it in C. The tasks to be done are pretty varied, e.g. sorting textfiles, disk access, network access, textfile parsing. Is there really a noticeable difference between sorting a textfile using the same algorithm in C versus Python, for example? And in your experience, given the power of current CPU's (i7), is it really a noticeable difference (Consider that its a program that doesnt bring the system to its knees).
Python shell and execfile scope
3,540,375
2
2
2,290
0
python,ipython,execfile
Functions create a new scope. execfile() runs the script in the current scope. What you are doing will not work.
0
1
0
1
2010-08-22T05:54:00.000
2
1.2
true
3,540,368
1
0
0
1
I'm working from inside an ipython shell and often need to reload the script files that contain my functions-under-construction. Inside my main.py I have: def myreload(): execfile("main.py") execfile("otherfile.py") Calling myreload() works fine if I have already ran in the same ipython session the execfile commands directly. However, for some reason, if the session is fresh and I just called execfile("main.py"), then myreload() doesn't actually make the functions from inside otherfile.py available. It doesn't throw any error though. Any ideas?
Is it possible to run linux on hand-held tablets?
3,541,193
0
3
395
0
python,android,django
Do you want it to run on a tablet or a hand-held device? Are netbooks okay? There are plenty netbooks that run Ubuntu, on which you should be able to run python. I also remember that the sharp zaurus handheld devices were able to run Zope for example (be it very, very slowly) In general, smaller, embedded systems (i.e. pandora) run versions of OpenWRT that use ipkg, and I think there are django packages for OpenWRT, so that may be an option as well.
0
1
0
0
2010-08-22T08:53:00.000
2
0
false
3,540,805
0
0
1
1
I want to run a django app on a hand-held device. It'll need to run Python (obviously) and will write its data to an SQLite database. Are there any tablets available that will let me do this? Specifically, if I bought an Android tablet, would I have to/be able to install linux instead, or would I be able to run it under Android?
windows/python manipulate versioninfo during runtime
3,603,987
0
0
169
0
python,windows,winapi,console
Version Information are stored as a resource in the executable. You cannot change them during runtime.
0
1
0
0
2010-08-22T17:11:00.000
1
1.2
true
3,542,426
1
0
0
1
I have multiple python processes running in their console output windows. I can set their console title via win32api.SetConsoleTitle(). Thats nice, but it would be even nicer to set some versioninfo strings (like description/company name/version) during runtime as that would allow me to easier differentiate between the (generic) python proceses in the taskmanager/process-explorer. Has anybody ever done something like that. thnx, dirkse
Uninstall python built from source?
3,544,394
-3
51
69,854
0
python,linux,ubuntu,python-2.x
Do you still have the source directory where you compiled Python before? If so, you can CD into that directory and run sudo make uninstall. If you don't have it still, you could re-create it by going through the build steps again--download, extract, configure, and make--but end with sudo make uninstall instead of sudo make install, of course.
0
1
0
0
2010-08-23T02:32:00.000
6
-0.099668
false
3,544,378
1
0
0
2
I've installed python 2.6 from source, and somehow later mistakenly installed another python 2.6 from a package manager too. I can't find a way to uninstall a python that was built from source, is this possible/easy? Running ubuntu 10.04.
Uninstall python built from source?
3,544,396
0
51
69,854
0
python,linux,ubuntu,python-2.x
In the future it may be prudent to use sudo checkinstall.
0
1
0
0
2010-08-23T02:32:00.000
6
0
false
3,544,378
1
0
0
2
I've installed python 2.6 from source, and somehow later mistakenly installed another python 2.6 from a package manager too. I can't find a way to uninstall a python that was built from source, is this possible/easy? Running ubuntu 10.04.
Is there a way of having a GUI for bash scripts?
3,556,046
0
3
2,093
0
python,user-interface,bash
basically, all bash does is start other programs (and do symbolic math on the command line). So no, you're going to have to involve some other program.
0
1
0
1
2010-08-24T11:41:00.000
4
0
false
3,556,027
0
0
0
1
I have some bash scripts, some simple ones to copy, search, write lines to files and so on. I am an Ubuntu. and I've searched in google, but it seems that everybody is doing that on python. I could do these on python, but since I am not a python programmer, I just know the basics. I have no idea of how calling a sh script from a GUI written on python. If someone has a link or something to say, please drop a line. regards, Mario
Command-line arguments as bytes instead of strings in python3
3,559,991
-3
4
2,162
0
encoding,python-3.x,filenames,command-line-arguments
Don't go against the grain: filenames are strings, not bytes. You shouldn't use a bytes when you should use a string. A bytes is a tuple of integers. A string is a tuple of characters. They are different concepts. What you're doing is like using an integer when you should use a boolean. (Aside: Python stores all strings in-memory under Unicode; all strings are stored the same way. Encoding specifies how Python converts the on-file bytes into this in-memory format.) Your operating system stores filenames as strings under a specific encoding. I'm surprised you say that some filenames have different encodings; as far as I know, the filename encoding is system-wide. Functions like open default to the default system filename encoding, for example.
0
1
0
0
2010-08-24T14:59:00.000
2
-0.291313
false
3,557,830
1
0
0
1
I'm writing a python3 program, that gets the names of files to process from command-line arguments. I'm confused regarding what is the proper way to handle different encodings. I think I'd rather consider filenames as bytes and not strings, since that avoids the danger of using an incorrect encoding. Indeed, some of my file names use an incorrect encoding (latin1 when my system locale uses utf-8), but that doesn't prevent tools like ls from working. I'd like my tool to be resilient to that as well. I have two problems: the command-line arguments are given to me as strings (I use argparse), and I want to report errors to the user as strings. I've successfuly adapted my code to use binaries, and my tool can handle files whose name are invalid in the current default encoding, as long as it is by recursing trough the filesystem, because I convert the arguments to binaries early, and use binaries when calling fs functions. When I receive a filename argument which is invalid, however, it is handed to me as a unicode string with strange characters like \udce8. I do not know what these are, and trying to encode it always fail, be it with utf8 or with the corresponding (wrong) encoding (latin1 here). The other problem is for reporting errors. I expect users of my tool to parse my stdout (hence wanting to preserve filenames), but when reporting errors on stderr I'd rather encode it in utf-8, replacing invalid sequences with appropriate "invalid/question mark" characters. So, 1) Is there a better, completely different way to do it ? (yes, fixing the filenames is planned, but i'd still like my tool to be robust) 2) How do I get the command line arguments in their original binary form (not pre-decoded for me), knowing that for invalid sequences re-encoding the decoded argument will fail, and 3) How do I tell the utf-8 codec to replace invalid, undecodable sequences with some invalid mark rather than dying on me ?
add Python path to PATH system variable automatically under Windows
3,558,004
0
1
1,668
0
python,python-install
There has to be a way, but what some people do is provide batch files that set up the environment before invoking Python. That's what BZR does, anyway. If you can write that batch file somewhere that's already normally in the path, so much the better. If you're just worried about invoking Python, the normal Python installer does file associations, so you can work it that way.
0
1
0
0
2010-08-24T15:11:00.000
2
0
false
3,557,949
1
0
0
1
I'm creating one-click python installer (integrated with my application). Is there any way to force Python MSI installer to add python's path to SYSTEM PATH variable? I'm using MSI installer because it is very easy to specify (using command line) how it should interact with the user.
Where are Python dylibs installed on the Mac?
3,561,953
0
0
2,538
0
python,macos,dylib
Run the included setup.py file. You should never try to copy things into place manually; it'll lead to disaster, especially in situations involving pip or easy_install.
0
1
0
0
2010-08-24T21:32:00.000
2
0
false
3,561,209
1
0
0
2
On Mac OSX 10.6.4 where do you install dynamic libraries (dylib) so Python 2.6.1 can import them? I've tried placing them in /usr/local/lib and usr/localbin and /Library/Python/2.6/site-packages but none of these locations have worked. The library I'm trying to install is libevecache.dylib a library to access cache files for Eve-Online.
Where are Python dylibs installed on the Mac?
3,561,232
0
0
2,538
0
python,macos,dylib
Anywhere in your $DYLD_LIBRARY_PATH should work for compiled library files; you can also try setting $PYTHONPATH / sys.path.
0
1
0
0
2010-08-24T21:32:00.000
2
0
false
3,561,209
1
0
0
2
On Mac OSX 10.6.4 where do you install dynamic libraries (dylib) so Python 2.6.1 can import them? I've tried placing them in /usr/local/lib and usr/localbin and /Library/Python/2.6/site-packages but none of these locations have worked. The library I'm trying to install is libevecache.dylib a library to access cache files for Eve-Online.
How to check if DataStore Indexes are being served on AppEngine?
3,562,948
2
1
244
0
python,google-app-engine
Attempt to perform a query that requires that index. If it raises a NeedIndexError, it's not uploaded or not yet serving.
0
1
0
0
2010-08-25T02:32:00.000
2
1.2
true
3,562,466
0
0
1
1
How can I check if datastore Indexes as defined in index.yaml are serving in the python code? I am using Python 1.3.6 AppEngine SDK.
Which cross platform scripting language should we adopt for a group of DBAs?
3,564,251
1
6
3,213
1
python,scala,groovy,shell,jython
Although I prefer working on the JVM, one thing that turns me off is having to spin up a JVM to run a script. If you can work in a REPL this is not such a big deal, but it really slows you down when doing edit-run-debug scripting. Now of course Oracle has a lot of Java stuff where interaction moght be needed, but that is something only you can estimate how important it is. For plain Oracle DB work I have seen very little Java and lots fo PLSQL/SQL. If your dba now do their work in bash, then they will very likely pickup perl in a short time as there is a nice, logical progression path. Since ruby was designed to be an improved version of perl, it might fit in that category too. Actually python also. Scala is statically typed like Java, albeit with much better type inference. My recommendation would be to go the Perl route. The CPAN is its ace in the hole, you do not have to deal with the OO stuff which might turn off some DBA's (although it is there for the power users).
0
1
0
0
2010-08-25T08:47:00.000
6
0.033321
false
3,564,177
0
0
0
5
I wanted to get the community's feedback on a language choice our team is looking to make in the near future. We are a software developer, and I work in a team of Oracle and SQL Server DBAs supporting a cross platform Java application which runs on Oracle Application Server. We have SQL Server and Oracle code bases, and support customers on Windows, Solaris and Linux servers. Many of the tasks we do on a frequent basis are insufficiently automated, and where they are, tend to be much more automated via shell scripts, with little equivalent functionality on Windows. Unfortunately, we now have this problem of redeveloping scripts and so on, on two platforms. So, I wish for us to choose a cross platform language to script in, instead of using Bash and awkwardly translating to Cygwin or Batch files where necessary. It would need to be: Dynamic (so don't suggest Java or C!) Easily available on each platform (Windows, Solaris, Linux, perhaps AIX) Require very little in the way of setup (root access not always available!) Be easy for shell scripters, i.e. DBAs, to adopt, who are not hardcore developers. Be easy to understand other people's code Friendly with SQL Server and Oracle, without messing around. A few nice XML features wouldn't go amiss. It would be preferable if it would run on the JVM, since this will almost always be installed on every server (certainly on all application servers) and we have many Java developers in our company, so sticking to the JVM makes sense. This isn't exclusive though, since I know Python is a very viable language here. I have created a list of options, but there may be more: Groovy, Scala, Jython, Python, Ruby, Perl. No one has much experience of any, except I have quite a lot of Java and Groovy experience myself. We are looking for something dynamic, easy to pick up, will work with both SQL server and Oracle effortlessly, has some XML simplifying features, and that won't be a turnoff for DBAs. Many of us are very Bash orientated - what could move us away from this addiction? What are people's opinions on this? thanks! Chris
Which cross platform scripting language should we adopt for a group of DBAs?
3,564,285
0
6
3,213
1
python,scala,groovy,shell,jython
I've been in a similar situation, though on a small scale. The previous situation was that any automation on the SQL Server DBs was done with VBScript, which I did start out using. As I wanted something cross-platform (and less annoying than VBScript) I went with Python. What I learnt is: Obviously you want a language that comes with libraries to access your databases comfortably. I wasn't too concerned with abstracting the differences away (ie, I still wrote SQL queries in the relevant dialect, with parameters). However, I'd be a bit less happy with PHP, for example, which has only very vendor-specific libraries and functions for certain databases. I see it's not on your list. THE major obstacle was authentication. If your SQL Server uses Windows domain authentication, you'll have to work to get in. Another system also had specific needs as it required RSA tokens to be supported. For the second point, Python is quite versatile enough to work around the difficulties, but it was getting into "badly supported" territory, especially on Windows. It was easy to work around the first problem from a Windows host, and for a Unix host it is possible though not easy. If you're using SQL Server authentication, it becomes a lot easier. From your other choices, I'd expect various ways of authenticating and DB drivers to exist for Perl, which philosophically would be easier for DBAs used to shell scripting. Ruby - no experience, but it tends to have spotty support for some of the odder authentication methods and connectors. Scala I'd expect to be a bit too much of a "programmer's programming language" -- OOO and FP? It's a very interesting language, but maybe not the one I'd chose at first. As for the rest of the Java-based options, I don't have an opinion, but do check that all the connection types you want to make are solidly supported.
0
1
0
0
2010-08-25T08:47:00.000
6
0
false
3,564,177
0
0
0
5
I wanted to get the community's feedback on a language choice our team is looking to make in the near future. We are a software developer, and I work in a team of Oracle and SQL Server DBAs supporting a cross platform Java application which runs on Oracle Application Server. We have SQL Server and Oracle code bases, and support customers on Windows, Solaris and Linux servers. Many of the tasks we do on a frequent basis are insufficiently automated, and where they are, tend to be much more automated via shell scripts, with little equivalent functionality on Windows. Unfortunately, we now have this problem of redeveloping scripts and so on, on two platforms. So, I wish for us to choose a cross platform language to script in, instead of using Bash and awkwardly translating to Cygwin or Batch files where necessary. It would need to be: Dynamic (so don't suggest Java or C!) Easily available on each platform (Windows, Solaris, Linux, perhaps AIX) Require very little in the way of setup (root access not always available!) Be easy for shell scripters, i.e. DBAs, to adopt, who are not hardcore developers. Be easy to understand other people's code Friendly with SQL Server and Oracle, without messing around. A few nice XML features wouldn't go amiss. It would be preferable if it would run on the JVM, since this will almost always be installed on every server (certainly on all application servers) and we have many Java developers in our company, so sticking to the JVM makes sense. This isn't exclusive though, since I know Python is a very viable language here. I have created a list of options, but there may be more: Groovy, Scala, Jython, Python, Ruby, Perl. No one has much experience of any, except I have quite a lot of Java and Groovy experience myself. We are looking for something dynamic, easy to pick up, will work with both SQL server and Oracle effortlessly, has some XML simplifying features, and that won't be a turnoff for DBAs. Many of us are very Bash orientated - what could move us away from this addiction? What are people's opinions on this? thanks! Chris
Which cross platform scripting language should we adopt for a group of DBAs?
3,565,446
4
6
3,213
1
python,scala,groovy,shell,jython
The XML thing almost calls for Scala. Now, I love Scala, but I suggest Python here.
0
1
0
0
2010-08-25T08:47:00.000
6
0.132549
false
3,564,177
0
0
0
5
I wanted to get the community's feedback on a language choice our team is looking to make in the near future. We are a software developer, and I work in a team of Oracle and SQL Server DBAs supporting a cross platform Java application which runs on Oracle Application Server. We have SQL Server and Oracle code bases, and support customers on Windows, Solaris and Linux servers. Many of the tasks we do on a frequent basis are insufficiently automated, and where they are, tend to be much more automated via shell scripts, with little equivalent functionality on Windows. Unfortunately, we now have this problem of redeveloping scripts and so on, on two platforms. So, I wish for us to choose a cross platform language to script in, instead of using Bash and awkwardly translating to Cygwin or Batch files where necessary. It would need to be: Dynamic (so don't suggest Java or C!) Easily available on each platform (Windows, Solaris, Linux, perhaps AIX) Require very little in the way of setup (root access not always available!) Be easy for shell scripters, i.e. DBAs, to adopt, who are not hardcore developers. Be easy to understand other people's code Friendly with SQL Server and Oracle, without messing around. A few nice XML features wouldn't go amiss. It would be preferable if it would run on the JVM, since this will almost always be installed on every server (certainly on all application servers) and we have many Java developers in our company, so sticking to the JVM makes sense. This isn't exclusive though, since I know Python is a very viable language here. I have created a list of options, but there may be more: Groovy, Scala, Jython, Python, Ruby, Perl. No one has much experience of any, except I have quite a lot of Java and Groovy experience myself. We are looking for something dynamic, easy to pick up, will work with both SQL server and Oracle effortlessly, has some XML simplifying features, and that won't be a turnoff for DBAs. Many of us are very Bash orientated - what could move us away from this addiction? What are people's opinions on this? thanks! Chris
Which cross platform scripting language should we adopt for a group of DBAs?
3,568,609
5
6
3,213
1
python,scala,groovy,shell,jython
I think your best three options are Groovy, Python, and Scala. All three let you write code at a high level (compared to C/Java). Python has its own perfectly adequate DB bindings, and Groovy and Scala can use ones made for Java. The advantages of Python are that it is widely used already, so there are tons of tools, libraries, expertise, etc. available around it. It has a particularly clean syntax, which makes working with it aesthetically pleasing. The disadvantages are that it is slow (which may not be an issue for you), untyped (so you have runtime errors instead of compile-time errors), and you can't really switch back and forth between Jython and Python, so you have to pick whether you want the large amount of Python stuff, or the huge amount of Java stuff, minus a lot of the nice Python stuff. The advantages of Groovy are that you know it already and it interoperates well with Java libraries. Its disadvantages are also slowness and lack of static typing. (So in contrast to Python, the choice is: do you value Python's clean syntax and wide adoption more, or do you value the vast set of Java libraries more in a language made to work well in that environment?) The advantages of Scala are that it is statically typed (i.e. if the code gets past the compiler, it has a greater chance of working), is fast (as fast as Java if you care to work hard enough), and interoperates well with Java libraries. The disadvantages are that it imposes a bit more work on you to make the static typing work (though far, far less than Java while simultaneously being more safe), and that the canonical style for Scala is a hybrid object/functional blend that feels more different than the other two (and thus requires more training to use at full effectiveness IMO). In contrast to Groovy, the question would be whether familiarity and ease of getting started is more important than speed and correctness. Personally, I now do almost all of my work in Scala because my work requires speed and because the compiler catches those sort of errors in coding that I commonly make (so it is the only language I've used where I am not surprised when large blocks of code run correctly once I get them to compile). But I've had good experiences with Python in other contexts--interfacing with large databases seems like a good use-case. (I'd rule out Perl as being harder to maintain with no significant benefits over e.g. Python, and I'd rule out Ruby as being not enough more powerful than Python to warrant the less-intuitive syntax and lower rate of adoption/tool availability.)
0
1
0
0
2010-08-25T08:47:00.000
6
0.16514
false
3,564,177
0
0
0
5
I wanted to get the community's feedback on a language choice our team is looking to make in the near future. We are a software developer, and I work in a team of Oracle and SQL Server DBAs supporting a cross platform Java application which runs on Oracle Application Server. We have SQL Server and Oracle code bases, and support customers on Windows, Solaris and Linux servers. Many of the tasks we do on a frequent basis are insufficiently automated, and where they are, tend to be much more automated via shell scripts, with little equivalent functionality on Windows. Unfortunately, we now have this problem of redeveloping scripts and so on, on two platforms. So, I wish for us to choose a cross platform language to script in, instead of using Bash and awkwardly translating to Cygwin or Batch files where necessary. It would need to be: Dynamic (so don't suggest Java or C!) Easily available on each platform (Windows, Solaris, Linux, perhaps AIX) Require very little in the way of setup (root access not always available!) Be easy for shell scripters, i.e. DBAs, to adopt, who are not hardcore developers. Be easy to understand other people's code Friendly with SQL Server and Oracle, without messing around. A few nice XML features wouldn't go amiss. It would be preferable if it would run on the JVM, since this will almost always be installed on every server (certainly on all application servers) and we have many Java developers in our company, so sticking to the JVM makes sense. This isn't exclusive though, since I know Python is a very viable language here. I have created a list of options, but there may be more: Groovy, Scala, Jython, Python, Ruby, Perl. No one has much experience of any, except I have quite a lot of Java and Groovy experience myself. We are looking for something dynamic, easy to pick up, will work with both SQL server and Oracle effortlessly, has some XML simplifying features, and that won't be a turnoff for DBAs. Many of us are very Bash orientated - what could move us away from this addiction? What are people's opinions on this? thanks! Chris
Which cross platform scripting language should we adopt for a group of DBAs?
3,564,413
6
6
3,213
1
python,scala,groovy,shell,jython
You can opt for Python. Its dynamic(interpreted) , is available on Windows/Linux/Solaris, has easy to read syntax so that your code maintenance is easy. There modules/libraries for Oracle interaction and various other database servers as well. there are also library support for XML. All 7 points are covered.
0
1
0
0
2010-08-25T08:47:00.000
6
1
false
3,564,177
0
0
0
5
I wanted to get the community's feedback on a language choice our team is looking to make in the near future. We are a software developer, and I work in a team of Oracle and SQL Server DBAs supporting a cross platform Java application which runs on Oracle Application Server. We have SQL Server and Oracle code bases, and support customers on Windows, Solaris and Linux servers. Many of the tasks we do on a frequent basis are insufficiently automated, and where they are, tend to be much more automated via shell scripts, with little equivalent functionality on Windows. Unfortunately, we now have this problem of redeveloping scripts and so on, on two platforms. So, I wish for us to choose a cross platform language to script in, instead of using Bash and awkwardly translating to Cygwin or Batch files where necessary. It would need to be: Dynamic (so don't suggest Java or C!) Easily available on each platform (Windows, Solaris, Linux, perhaps AIX) Require very little in the way of setup (root access not always available!) Be easy for shell scripters, i.e. DBAs, to adopt, who are not hardcore developers. Be easy to understand other people's code Friendly with SQL Server and Oracle, without messing around. A few nice XML features wouldn't go amiss. It would be preferable if it would run on the JVM, since this will almost always be installed on every server (certainly on all application servers) and we have many Java developers in our company, so sticking to the JVM makes sense. This isn't exclusive though, since I know Python is a very viable language here. I have created a list of options, but there may be more: Groovy, Scala, Jython, Python, Ruby, Perl. No one has much experience of any, except I have quite a lot of Java and Groovy experience myself. We are looking for something dynamic, easy to pick up, will work with both SQL server and Oracle effortlessly, has some XML simplifying features, and that won't be a turnoff for DBAs. Many of us are very Bash orientated - what could move us away from this addiction? What are people's opinions on this? thanks! Chris
Crash in development server clears datastore?
3,570,139
0
0
61
0
python,google-app-engine
The GAE development data store is only functionally equivalent to the production data store. It's really just a file (or set of files) on your local disk simulating BigTable. So if you abort it in the middle of doing something important, it could end up in an inconsistent state. If you're concerned about this, you can easily back up your local data store and restore it if this happens.
0
1
0
0
2010-08-25T20:53:00.000
2
0
false
3,570,111
0
0
1
1
I'm testing my app with the development server. When I manually interrupt a request, it sometimes clears the datastore. This clears even models that are not modified by my request, like users, etc. Any idea why is this? Thanks
Function Names for sending and receiving RPCs?
3,575,219
1
0
60
0
python,naming-conventions,twisted,rpc
First tip: Use PB... it's well designed and does exactly that Second Tip: If the first tip isn't going to work for you, just do what PB does. On the client end a "callRemote("foo_func")" asks the server ot invoke the "foo_func" function on the server object. The server will then use "getattr(server_obj, "remote_" + "foo_func")" to find the remote method. If the method exists, it's called. Otherwise an error is returned. The nice thing about this design is that it completely does away with your REQUEST... CMD... constants.
0
1
0
0
2010-08-26T12:43:00.000
1
1.2
true
3,575,119
0
0
0
1
I'm using twisted. I have my protocols set up so that, to send an RPC, I do protocol.send("update_status", data). To document which RPCs I've implemented, I make a separate function call for each one, so in this case I'd call REQUEST_UPDATE_STATUS(data) to send that RPC. When a protocol receives an RPC, a function gets called based on its name, in this case, CMD_UPDATE_STATUS. The problem is that REQUEST and CMD are a bit awkward. I can mistake REQUEST as part of the command, for example, REQUEST_NEW_DATA, and that would end up triggering an RPC called 'new_data'. However, REQUEST_REQUEST_NEW_DATA is just silly. CMD is also awkward, as a REQUEST_SEND_NEW_DATA will become CMD_SEND_NEW_DATA, which is a bit awkward. Any tips?
Is there a standard way to make sure a python script will be interpreted by python2 and not python3?
3,586,813
0
22
1,239
0
python,unix,scripting,python-3.x,shebang
As I understand different distros will be in different locations in your drive. Here are some suggestions that come to mind - You could use UNIX alias to create shortcuts pointing to the different distros. Eg: alias py2="/usr/bin/python2.X". So when you run your script you could use py2 xx.py Or other way could be to modify your PYTHON_PATH environment variable. Or if I am not wrong there is a provision in sys module to get the current python version number. You could get that & deal appropriately. This should do it...
0
1
0
0
2010-08-27T17:38:00.000
8
0
false
3,586,776
1
0
0
4
Is there a standard way to make sure a python script will be interpreted by python2 and not python3? On my distro, I can use #!/usr/bin/env python2 as the shebang, but it seems not all distros ship "python2". I could explicitly call a specific version (eg. 2.6) of python, but that would rule out people who don't have that version. It seems to me that this is going to be increasingly a problem when distros will start putting python3 as the default python interpreter.
Is there a standard way to make sure a python script will be interpreted by python2 and not python3?
3,587,849
2
22
1,239
0
python,unix,scripting,python-3.x,shebang
Depends on how you're distributing it, I guess. If you're using a normal setup.py file to manage your distribution, have it bomb out if the user is trying to install it in Python 3. Once it's installed, the shebang of the console script created by (say) setuptools will likely be linked to the specific interpreter used to install it. If you're doing something weird for your installation, you can in whatever installation script you're using look for python interpreters and store a choice. You might first check whether whatever is called "python" is a 2.x. If not, check for "python2.7", "python2.6", etc to see what's available.
0
1
0
0
2010-08-27T17:38:00.000
8
0.049958
false
3,586,776
1
0
0
4
Is there a standard way to make sure a python script will be interpreted by python2 and not python3? On my distro, I can use #!/usr/bin/env python2 as the shebang, but it seems not all distros ship "python2". I could explicitly call a specific version (eg. 2.6) of python, but that would rule out people who don't have that version. It seems to me that this is going to be increasingly a problem when distros will start putting python3 as the default python interpreter.
Is there a standard way to make sure a python script will be interpreted by python2 and not python3?
3,587,790
2
22
1,239
0
python,unix,scripting,python-3.x,shebang
Not quite the same situation, but the company I work for has an app that can run Python scripts (among its many features). After numerous support issues involving Python installations on various platforms, we decided to just install our own Python interpreter with the app. That way we know exactly where it is installed and what version it is. This approach may be too heavyweight for your needs (the Python package is only about 10% of our app's bits) but it definitely works.
0
1
0
0
2010-08-27T17:38:00.000
8
0.049958
false
3,586,776
1
0
0
4
Is there a standard way to make sure a python script will be interpreted by python2 and not python3? On my distro, I can use #!/usr/bin/env python2 as the shebang, but it seems not all distros ship "python2". I could explicitly call a specific version (eg. 2.6) of python, but that would rule out people who don't have that version. It seems to me that this is going to be increasingly a problem when distros will start putting python3 as the default python interpreter.
Is there a standard way to make sure a python script will be interpreted by python2 and not python3?
3,587,731
8
22
1,239
0
python,unix,scripting,python-3.x,shebang
This is a bit of a messy issue during what will be a very long transition time period. Unfortunately, there is no fool-proof, cross-platform way to guarantee which Python version is being invoked, other than to have the Python script itself check once started. Many, if not most, distributions that ship Python 3 are ensuring the generic python command is aliased by default to the most recent Python 2 version while python3 is aliased to the most recent Python 3. Those distributions that don't should be encouraged to do so. But there is no guarantee that a user won't override that. I think the best practice available for the foreseeable future is to for packagers, distributors, and users to assume python refers to Python 2 and, where necessary, build a run-time check into the script.
0
1
0
0
2010-08-27T17:38:00.000
8
1.2
true
3,586,776
1
0
0
4
Is there a standard way to make sure a python script will be interpreted by python2 and not python3? On my distro, I can use #!/usr/bin/env python2 as the shebang, but it seems not all distros ship "python2". I could explicitly call a specific version (eg. 2.6) of python, but that would rule out people who don't have that version. It seems to me that this is going to be increasingly a problem when distros will start putting python3 as the default python interpreter.
Where is my local App Engine datastore?
42,148,664
0
11
11,200
0
python,google-app-engine,google-cloud-datastore
I'll restate a solution to getting permanent datastore as it worked for me (circa Feb 2017), running GoogleAppEngineLauncher on OS X v10.10. Create the folder path for permanent datastore In GAEL, click on the project in question e.g. PROJECTNAME Click Edit-Application Settings in Extra Flags field: --datastore_path=/Users/foo/GAE_datastore/PROJECTNAME/datastore.db Filename has to be included; in my config, datastore.db works. Having searched all over for GAE datastore path, and head-bonked on dev_appserver.py --datastore_path command line, it was very helpful to find this. Application Settings under the Edit menu is an odd choice, Google :-)
0
1
0
0
2010-08-27T23:49:00.000
10
0
false
3,588,817
0
0
1
5
How can I find where my local development datastore is located? I am using the Python SDK and Linux.
Where is my local App Engine datastore?
4,180,525
6
11
11,200
0
python,google-app-engine,google-cloud-datastore
To find the file location for the local AppEngine datastore on MacOSX/Python, you can run the following command: dev_appserver.py -help Mine was at something like: /var/folders/uP/uP1GHkGKGqO7QPq+eGMmb++++TI/-Tmp-/dev_appserver.datastore
0
1
0
0
2010-08-27T23:49:00.000
10
1
false
3,588,817
0
0
1
5
How can I find where my local development datastore is located? I am using the Python SDK and Linux.
Where is my local App Engine datastore?
57,534,409
0
11
11,200
0
python,google-app-engine,google-cloud-datastore
The default location of the datastore for the platform you're running the app engine on is provided in the README that comes with the platform (at least, in the one for Linux). The README is in google_appengine_x.x.xx/google_appengine/README. This is what is says in the Linux'es one: --datastore_path=DS_FILE Path to file to use for storing Datastore file stub data. (Default /tmp/dev_appserver.datastore)
0
1
0
0
2010-08-27T23:49:00.000
10
0
false
3,588,817
0
0
1
5
How can I find where my local development datastore is located? I am using the Python SDK and Linux.
Where is my local App Engine datastore?
8,814,627
2
11
11,200
0
python,google-app-engine,google-cloud-datastore
Since it's top question on Google search and I spent quite amount of time searching for an answer I'll say that on Windows/Java mix DB file called local_db.bin.
0
1
0
0
2010-08-27T23:49:00.000
10
0.039979
false
3,588,817
0
0
1
5
How can I find where my local development datastore is located? I am using the Python SDK and Linux.
Where is my local App Engine datastore?
23,270,307
4
11
11,200
0
python,google-app-engine,google-cloud-datastore
I use OS X Mavericks (10.9), Python 2.7.5, and Google App Engine SDK 1.9.3 (Python). None of the above worked for me, however, referencing @alsmola's answer, I executed sudo find / | grep datastore.db and found the file in /private/var/folders/vw/7w1zhkls4gb1wd8r160c36300000gn/T/appengine.YYYY.XXXXX/datastore.db (YYYY is the project name, XXXXX is my username).
0
1
0
0
2010-08-27T23:49:00.000
10
0.07983
false
3,588,817
0
0
1
5
How can I find where my local development datastore is located? I am using the Python SDK and Linux.
Cross platform way to list disk drives on Linux, Windows and Mac using Python?
3,596,681
3
12
15,615
0
python,file,cross-platform,disk
There isn't really a unified naming scheme for Linux devices that guarantees you a formatable block device. There are conventions, but they can vary widely and I can call my thumb-drive /Thomas/O if I want and there is no cross-platform way in Python to know: That /Thomas/O corresponds to /dev/sdf1 That /dev/sdf1 can have a FAT32 filesystem made on it That /dev/sdf is not preferred to /dev/sdf1 I'm pretty sure that neither is there a cross-platform Python module which will allow you to determine that H:/ is formattable on a Windows system but that Z:/ is not. Each system will require its own specific checks and validations which you could best learn from studying open-source disk manipulation software.
0
1
0
0
2010-08-29T20:35:00.000
4
1.2
true
3,596,485
0
0
0
2
I am using Python2.6. I am trying to list the disk drives that a system may have. On Windows, it may be something like C:/, D:/, E:/, etc. On Linux, it may be something like /boot, /media/SDCard, etc. And I don't know what it's like on a Mac. Maybe something under /Volumes. Does anyone know of a cross platform way (that is, one which works on Linux, Windows and Mac) in Python? Thanks!
Cross platform way to list disk drives on Linux, Windows and Mac using Python?
55,051,781
2
12
15,615
0
python,file,cross-platform,disk
I don't see a way in psutil to include net mounts on Windows. I.e., \foobar\home is mapped to X:, but X: does not appear in the list returned by psutil.disk_partitions() (local drives are). Update: To include net drives in the returned list, simply use: psutil.disk_partitions(all=True) Works quite well.
0
1
0
0
2010-08-29T20:35:00.000
4
0.099668
false
3,596,485
0
0
0
2
I am using Python2.6. I am trying to list the disk drives that a system may have. On Windows, it may be something like C:/, D:/, E:/, etc. On Linux, it may be something like /boot, /media/SDCard, etc. And I don't know what it's like on a Mac. Maybe something under /Volumes. Does anyone know of a cross platform way (that is, one which works on Linux, Windows and Mac) in Python? Thanks!
google-app-engine-django loading fixtures
3,605,268
1
1
312
0
python,django,google-app-engine,fixtures,django-fixtures
Turns out the issue was caused because I wasn't declaring my model correctly in models.py When using google-app-engine-django, each model should be a subclass of: appengine_django.db.BaseModel after fixing this, it works. I also needed to put a valid pk: value in my fixture.
0
1
0
0
2010-08-30T01:32:00.000
1
1.2
true
3,597,332
0
0
1
1
I'm having troubles loading fixtures on GAE with google-app-engine-django. I receive an error that says "DeserializationError: Invalid model identifier: 'fcl.User'" ./manage.py loaddata users I'm trying to load a fixture that has the following data: - model: fcl.User fields: firstname: test lastname: testerson email: test@example.com user_id: '981167207188616462253' status: active usertype: player creationtime: '2010-08-29 00:00:00' do I need to do any other qualifying of my model name? The fixture lives at fcl/fixtures/users.yaml and model lives in at 'fcl/models.py'. Any help would be greatly appreciated.
Getting Monitor resolution in Python on Ubuntu
3,598,627
4
4
12,480
0
python,ubuntu,monitor,resolution
I assume you're a GUI toolkit. Why else would you be interested in the screen dimensions? Check out gtk.gdk.screen_width() and gtk.gdk.screen_height() from PyGTK. Something similar should be available for QT.
0
1
0
0
2010-08-30T04:58:00.000
6
1.2
true
3,597,965
0
0
0
1
Is there a equatable bit of code to GetSystemMetrics in win32api, for Ubuntu? I need to get the monitors width and height in pixels.
Add/remove programs in Windows XP with Python script
3,599,566
2
0
2,948
0
python,windows,system,administration
Are you installing or uninstalling? Installing: Easy way: subprocess.Popen the installer. Nearly-as-easy way: subprocess.Popen the installer, with some Windows hackery so that the user doesn't have to click anything. Uninstalling: As above. Hard way: work out the files changed on the computer and revert them manually.
0
1
0
0
2010-08-30T09:27:00.000
1
0.379949
false
3,599,213
1
0
0
1
I would like to add add/programs like adobe acrobat reader and other application in windows XP using Python script. Kindly looking for some help. Thanks in advance! Everest.
Google App Engine self.redirect() POST method
40,599,400
0
4
5,118
0
python,google-app-engine
You can pass parameters. Here is an example: Let's say you have a main page and you want to POST to '/success'. Usually, you may use this way: self.redirect('/sucess') But if you want to pass some parameters from the main page to /success page, like username for example, you can modify the code to this: self.redirect('/sucess?username=' + username) In this way, you successfully passed the username value into the URL. In /success page, you can read and store the value by using this: username = self.request.get('username') At last, you can make you favorite information onto the /success page by using this simple code: self.response.out.write('You\'ve succeeded, ' + username + '!') But, it's of course not a safe way to pass password. I wish it helps.
0
1
0
0
2010-08-30T12:01:00.000
3
0
false
3,600,101
0
0
1
1
In GAE (Python), using the webApp Framework, calling self.redirect('some_url') redirects the user to that URL via the GET method. Is it possible to do a (redirect) via the POST method with some parameters as well? If possible, how? Thanks!
Can python's mechanize use localhost sites?
3,603,922
0
0
257
0
python,mechanize
Yes. It can use any URL available so long as it is reachable. Just make sure it's properly formatted!
0
1
0
1
2010-08-30T20:12:00.000
2
1.2
true
3,603,883
0
0
1
1
Can Mechanize access sites being locally hosted by Apache?
List query with, facebook friends in list?
3,611,807
1
2
442
0
python,google-app-engine
I would suggest the following: Make 'marked' entities child entities of the users who have marked them. Use a key name for the 'marked' entity that is based on the URL of the page marked To find friends who have marked a page, retrieve a list of friends, then generate the list of entity keys from the list of friends (easy, since you know the friend key and the URL), and do a single batch get to retrieve a list of 'mark' entities indicating which friends have marked that page.
0
1
0
0
2010-08-31T06:59:00.000
2
0.099668
false
3,606,669
0
0
1
1
In a python based facebook application on GAE, i want to check which friends of current user have "marked" a web page or not. For this i have to run as many DB queries as the number of friends (say 100) I fear this may run into "timeout" because of large no of queries. Google DOCs suggest that "list" queries run in parallel, will this save time ?? Also list has a limit of 30, so i have to make 2 or 3 queries of list type. Please suggest a better way if possible, using task ques or something....
Installing Python SSL module on Windows Vista
3,606,827
0
1
530
0
python,google-app-engine,ssl
Why don't you provide the complete path to python executable. That should work. C:\"Python2.5.2"\python.exe setup.py install
0
1
0
0
2010-08-31T07:07:00.000
3
0
false
3,606,743
1
0
0
1
I'm running GAE SDK on a Windows Vista laptop. It keeps reminding me to install the SSL module. I've been having great difficulty on how to do that. I've downloaded the SSL module. I've done 'python setup.py install' in cmd, but it just says "python is not recognized as an internal..." I've added C:\Python2.5.2 to my PATH. Still the same message "python is not recognized as an internal or external command..." What else should I do?
How to edit a StringListProperty value in Google App Engine?
3,608,338
2
0
220
0
python,google-app-engine
You need to edit it programmatically. Not all property types can be edited in the data viewer.
0
1
0
0
2010-08-31T08:12:00.000
1
1.2
true
3,607,201
0
0
1
1
I would like to edit the value of a StringListProperty variable on App Engine. Is it possible? I don't see any sign of editable field for a StringListProperty variable right inside the DataViewer panel.
How to read symbols of an object file using C
3,607,298
0
0
1,506
0
python,c,linux
On linux object files are written in ELF file format.So i think you have to start with understanding the ELF file format and how OS write object file using this format.That can give you a idea how you can read object file and symbol table by your own program.To get some initial idea you can look into the source code of readelf tool.
0
1
0
1
2010-08-31T08:21:00.000
3
1.2
true
3,607,254
0
0
0
1
Question is simple, i have a object file and i want to read the symbols of the object file via code. I am aware that the linux command "nm" would be able to do this, but i want to be able to do it inside code. Also note id like to do this either via C or Python. Regards Paul
pydev doesn't find python library after installation
14,501,729
3
28
12,392
0
python,eclipse,pydev
I've found that closing the project and reopening (after rescanning the interpreter) works for me.
0
1
0
0
2010-08-31T14:59:00.000
4
0.148885
false
3,610,272
1
0
1
4
I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py install and it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it. Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing? thanks
pydev doesn't find python library after installation
3,610,311
37
28
12,392
0
python,eclipse,pydev
Pydev doesn't automatically rescan the site-packages folder. You need to go to Preferences-> Interpreter -> Python and click apply to make it scan again.
0
1
0
0
2010-08-31T14:59:00.000
4
1.2
true
3,610,272
1
0
1
4
I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py install and it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it. Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing? thanks
pydev doesn't find python library after installation
43,832,437
0
28
12,392
0
python,eclipse,pydev
Well, I followed this sequence to make it work: 1) I installed the desired library by using pip install 2) I went in Eclipse to: Window --> Preferences --> Pydev --> Interpreters --> Python Interpreter, and clicked "Quick Auto-Config". It made the trick.
0
1
0
0
2010-08-31T14:59:00.000
4
0
false
3,610,272
1
0
1
4
I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py install and it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it. Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing? thanks
pydev doesn't find python library after installation
6,144,832
14
28
12,392
0
python,eclipse,pydev
I also faced the same error when i had installed a new package.i'm using eclipse Helios. Even after applying and re scanning the folder it was NOT detecting the new packages. So finally i clicked on the "Click here to configure a interpreter not listed" listed and deleted the already selected interpreter and used the autoconfig to add the interpreter again. Finally i was able to resolve the issue.
0
1
0
0
2010-08-31T14:59:00.000
4
1
false
3,610,272
1
0
1
4
I'm using Django and PyDev/Eclipse. I just installed django-treebeard with setup.py install and it got installed in my site-packages directory C:\Python26\Lib\site-packages. I can successfully import it in the python shell with import treebeard. However PyDev complains that it cannot resolve it when I try to import it. Unfortunately I have no experience with PyDev and I assumed that it would automatically pick up everything in the site-packages directory but apparently it does not. What am I missing? thanks
Is it possible to memcache a json result in App Engine?
3,610,930
7
2
717
0
python,json,google-app-engine
JSON is just text, so yes, you can store it in memcache.
0
1
0
0
2010-08-31T15:59:00.000
1
1.2
true
3,610,854
0
0
1
1
I think my question is already clear enough, but to make it even more clear i will illustrate it with my example. I'm currently returning many json every request, which I would like to cache in some way. I thought memcache would be great, but I only see that they use memcache for caching queries.
how do I return all memcached values in Google App Engine?
3,611,908
0
4
3,350
0
python,google-app-engine,memcached,python-memcached
as in comments above, I guess I could stick all data in a single memcache entry with a known key. Still for non-static data there are scenarios where it would be useful.
0
1
0
0
2010-08-31T17:59:00.000
3
0
false
3,611,830
0
0
1
2
I want to use all the data in my python app engine memcache. I do not know the keys in advance. How do I go about getting all data?
how do I return all memcached values in Google App Engine?
4,524,611
1
4
3,350
0
python,google-app-engine,memcached,python-memcached
I am using a 'well known key' called "config" where I store a list of all other keys and use that to enumerate the rest of the items.
0
1
0
0
2010-08-31T17:59:00.000
3
0.066568
false
3,611,830
0
0
1
2
I want to use all the data in my python app engine memcache. I do not know the keys in advance. How do I go about getting all data?
Is it possible to get a list of all versions of an app?
3,625,552
4
1
91
0
python,google-app-engine,version-control
No, there's no way to get a list of app versions from inside an app.
0
1
0
0
2010-09-01T21:07:00.000
1
1.2
true
3,622,165
0
0
1
1
the title speaks for itself. I play with GAE and some of my apps have versions like (1,2,3,4 and dev). So, is there a way to get all of them, so I could use it in my app to generate links to different versions ?
Python Windows service autostarts too early
3,626,820
2
2
348
0
python,windows-services
Add in script wait for the resources who script must use is in good standing, or rewrite script to better design like not exit if dont have connection; wait 1s and try again if connection failed.
0
1
0
0
2010-09-02T11:47:00.000
2
0.197375
false
3,626,766
0
0
0
1
I am running a Python script as a Windows service, but it seems to be failing whenever I set it to auto-start. I believe this may be because the service uses network resources that are not yet mounted when the service starts. Is there a way I can get it to wait until startup is complete before running?
Is there an Eclipse personality settings for Wing IDE?
9,213,010
1
1
139
0
python,eclipse,wing-ide
I've added an experimental one in version 4.1.3
0
1
0
1
2010-09-02T15:54:00.000
2
0.099668
false
3,628,847
1
0
0
2
While PyDev turns out to be a great IDE for python, especially if you are a former Java developer accustomed to all the eclipse ubercool navigation, it still lacks some features that Wing has, like GUI for running python unit-tests. I know Wing has some "personalities" of other editors: vi, emacs, Visual Studio, ... Unfortunately, Eclipse is not one of them. Before I start configuring all the keys myself, creating a keymap.eclipse file, etc. (seems like it's gonna take ages), I wanted to know if no one already configured it and can share it with the rest of the world. Thanks!
Is there an Eclipse personality settings for Wing IDE?
3,629,793
0
1
139
0
python,eclipse,wing-ide
Unfortunately, there's no Eclipse personality.
0
1
0
1
2010-09-02T15:54:00.000
2
1.2
true
3,628,847
1
0
0
2
While PyDev turns out to be a great IDE for python, especially if you are a former Java developer accustomed to all the eclipse ubercool navigation, it still lacks some features that Wing has, like GUI for running python unit-tests. I know Wing has some "personalities" of other editors: vi, emacs, Visual Studio, ... Unfortunately, Eclipse is not one of them. Before I start configuring all the keys myself, creating a keymap.eclipse file, etc. (seems like it's gonna take ages), I wanted to know if no one already configured it and can share it with the rest of the world. Thanks!
What is the best way of running shell commands from a web based interface?
3,637,544
1
8
4,016
0
python,ruby-on-rails,ruby,django,shell
I'm not sure if it's what you want, but there are some web based ssh clients out there. If you care about security and really just want dynamic feedback, you could look into comet or just have a frame with its own http session that doesn't end until it's done printing.
0
1
0
1
2010-09-03T15:59:00.000
7
0.028564
false
3,637,503
0
0
1
1
Imagine a web application that allows a logged in user to run a shell command on the web server at the press of a button. This is relatively simple in most languages via some standard library os tools. But if that command is long running you don't want your UI to hang. Again this is relatively easy to deal with using some sort of background process or putting the command to be executed onto a message queue (and maybe saving the output and status somewhere for later consumption). Just return quickly saving we'll run that and get back to you. What I'd like to do is show the output of said web ui triggered shell command as it happens. So vertically scrolling text like when running in a terminal. I have a vague idea of how I might approach this, streaming the output to a websocket perhaps and simply printing the output to screen. What I'd like to ask is: Are their any plugins, libraries or applications that already do this. Something I can either use or read the source of. Ideally an open source python/django or ruby/rails tool, but other stacks would be interesting too.
Python, ctypes and mmap
3,640,616
1
12
3,930
0
python,ctypes
Be aware that the operating system is going to be doing readahead for read() anyway. You're going to be blocking either in read() or write()--one or the other will bottleneck the operation--but even though you're blocking in one, that doesn't mean the other isn't taking place for you behind the scenes. That's the job of every multitasking operating system. If you use mmap for this, you're very likely making things more complicated for the OS--making it harder for it to determine that you're really just streaming data in and out, and making it more complicated for it to do read-ahead. It may still figure it out (operating systems are very good at this), but you're probably not helping. The only benefit in principle is avoiding the cost of a memory copy, but it doesn't sound like that's your goal here (and unless profiling clearly says otherwise, I'd strongly doubt that would help performance).
0
1
0
0
2010-09-03T22:51:00.000
2
0.099668
false
3,640,092
0
0
0
1
I am wondering if it is possible for the ctypes package to interface with mmap. Currently, my module allocates a buffer (with create_string_buffer) and then passes that using byref to my libraries mylib.read function. This, as the name suggests, reads data into the buffer. I then call file.write(buf.raw) to write the data to disk. My benchmarks, however, show this to be far from optimal (time spent in file.write is time better spent in mylib.read). I am therefore interested in knowing if ctypes can interoperate with mmap. Given an mmap.mmap instance and an offset how can I get a pointer (c_void_p) into the address space?
Google App Engine: Including external packages
3,643,164
2
2
506
0
python,google-app-engine
Just place the package's folder in the root directory of your GAE application, easy!
0
1
0
0
2010-09-04T08:54:00.000
3
0.132549
false
3,641,538
0
0
0
1
I understand that if you want to include external packages you have to include them in your project. So I was wondering how do you do this? Do people use one general script that auto imports them from a location. Maybe some kind of config file that lists all the external packages? Do you always zip the packages and use zipimporter? Anway, I guess I am looking for a good general strategy for import external packages. I learned some already from looking at source code but extra info/examples would be super.
Operating System from scratch
8,959,919
-3
15
13,899
0
python,operating-system
Buddy, here is the answer you have been looking for: Writting an Operating System is not different than writting any other application, actually it is far easier than writing any other code for the reason an Operating System is an ALL-PURPOSE software or what is meant as a platform... and you know it!. All of the previous asnwers are EXTREMELY USEFUL!, and ALL OF THE PREVIOUS INCLUDING THIS ONE WILL HELP YOU IN CODING YOUR O.S. actually in less than three months. Please, try to be objective and get rid of negative answers (that is just mindblocking...) A Software Developer actually CODE EVERYTHING that comes to his mind! (in my case I was a SUPERB software developer until I had a brain accident and suffered hypoxia for a considerably period... not want to talk further about it... me traumatized...)... Let's speak clear: If you want to build an O.S. do the following and start TODAY!: Define if you want to write a SHELL or if you want to write a CORE O.S.; Plan main functions of the O.S., processes, etc.; Choose the level you want to build it on: VERY LOW LEVEL (Assembly Language required and MEMORY, CPU, AND HARDWARE RESOURCES KNOWLEDGE REQUIRED ALSO -NOT TO BE ACQUIRED IN MERELY THREE MONTHS... OH NO!...)... Medium Level (Here you can use the STANDARD solution, that is C programming Language!); High Level (This is the level you may want to use Python, it means you will use ALL of the same resources and shells you operating systems offer to you, whether it is any Linux Distribution, or a UNIX(R), Windows(R), CP/M(R) or any other known up to date); Because of the time required for you to build it I must assume you are delivering a College work to earn credits... and yet in case you work for a Corporation or in case you are self employed or your own C.E.O., you must have resources assigned to this project... I will assume you are building it for a Academic's!. Imagine you are writing a shell, that will ease the start-up of your work, and while you are writing the shell your mind should be drawing the real core of it, along with the addressing and along with the lowest level routines... I think you may know MS(R)-DOS(R). The version 3.3 is one of the easiest and enriching (pedagogically speaking) Operating Systems ever designed and published by Microsoft(r) Corp. Please, be creative, DO NOT CLONE IT, just inspire your mind on it, and then build something your Professor or end-consumer will admire and enjoy!. Do not forget we are in the age of Graphical User's Interface, so do not go into texting, although ASCII is still the most beautiful expression of computer age, you can play with both interfaces. Once you work this from Top to Dowm you will find out how easy it is to build routines in High Level language, and once you build it, and debug it, may be you will speed up a CORE os. that is: Bootstrapping, Memory management, etcetera... Do not get to involved in dealing with interruptions or you may end up loosing you enthusiasm INMEDIATELY!... leave the UNDERGROUND O.S. to deal and take care of the interruptions. In less than three months you will have your first prototype, and then you need to make it work good (To Debug it, I mean!). Exceed yourself!. If you work SOLO, you will need to write a manual, IT TAKES CONSIDERABLY PRECIOUS TIME YOU DO NOT WANT TO LOOSE... My advice (please, do not laugh, I used this technique and it made today's Magnate's earn BILLIONS) WRITE DOWN IN PAPER, HANDWRITTEN, ALL OF THE DOCUMENTATION (THIS IS BECAUSE YOUR FINE MOTRICE COORDINATION IS FASSST! AND EVEN IT WILL NOT EQUAL THE SPEED OF YOUR THOUGHTS IT IS A HARD COPY TO DELIVER TO A WELL PAID ASSISTANT TO TYPE IT INTO A COMPUTER AND EDIT IT MARVELOUS -MAYBE A .PDF WITH ILLUSTRATIONS, ALONG WITH A VIDEO WILL SHARPEN AND DELIGHT THE EYES OF THE END-CONSUMER!. Remember, the build up of the first month must be actually a SHELL of the basic functions a BASIC operating system must deliver to the user: Commands Processor; File Directory listup; Create/Edit and Delete files; Create/Edit and Delete Directories; Accessing drive units (floppies, Compact Discs, HardDrives, Flash Drives, etc...); Update and Display of information through the screen!; I would focus mainly in the previous, and then ANYTHING else comes up easily through the creation of enriching routines (trust me this phase is addictive and you will have NO MORE life when you reach to this poit for you will be married to this project and you will never leave it anymore), do not fear, it wil work!. Present your Operating System, and if your expecting upcomming funds show up, or if your expecting grade gets the higher rated you expect, you may want to keep enlarging your project and then build it into a more solid, robust and steady application!. Just imagine yourself using this platform as a plaintiff for any kind of hardware you may want to work with: ROBOTS, AUTOS; AIRPLANES; REMOTE CONTROL; ETC... I know you will enjoy this assignment and I know you will entertain yourself greatly! Only a real programmer has this kind of ambitions! God bless America! KnowBuddy
0
1
0
0
2010-09-04T18:35:00.000
11
-0.054491
false
3,643,500
1
0
0
7
I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python. I have a few limitations: I have only 3 months. I want to do it in Python. I can put in say 20-30 hours every week into it. I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations? Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS) If the idea is not feasible, can anyone tell me how much do I need to scale down my idea? Any help is much appreciated!
Operating System from scratch
3,643,520
16
15
13,899
0
python,operating-system
Scale this down a lot. I would recommend looking at one very small piece of an operating system that you would want to do, perhaps parallel processing. There is no feasible way you will be able to write an entire operating system in under 500 hours, let only 5000 hours. The real question is is this for an undergraduate course or a graduate course? The answer to that will greatly reflect what is needed to pass. Adding Grab a book on a topic about the operating system that interests you and focus intently on that for 3 months and you may just produce something that is good. Operating systems may seem like they don't do much on the outside, but think of it this way Windows has ~50 million lines of code.
0
1
0
0
2010-09-04T18:35:00.000
11
1
false
3,643,500
1
0
0
7
I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python. I have a few limitations: I have only 3 months. I want to do it in Python. I can put in say 20-30 hours every week into it. I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations? Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS) If the idea is not feasible, can anyone tell me how much do I need to scale down my idea? Any help is much appreciated!
Operating System from scratch
3,643,598
9
15
13,899
0
python,operating-system
Does your professor require a "low-level" component in the project? For example, anything that deals with the hardware or the instruction architecture. If so, your professor will not allow you to do the project in Python. The project must be written in C and assembly. And you will invariably be working on modifying the Linux kernel. However, nowadays Operating System is no longer confined to the low-level aspect. Virtualization, database, parallelization are all built on top of the Operating System. If your professor is "old school" then he/she may not consider those new topics to be part of Operating System. So, you may need to bring some sample ideas to your professor and seek clarification. Whether to go into low-level, as some have suggested, depends entirely on the professor's educational goals. To teach basic concurrent programming constructs, such as events, semaphors and mutex. This can be taught by writing some multi-thread applications. It is arguably too easy as a goal for an OS class. Nevertheless, this is in fact the most "marketable" skill you will get from the class. A variation on this theme is to teach how to "use" a particular flavor of OS API. To teach how to write applications that make efficient use of the operating system. This may require you to implement some entry-level OS-related algorithms inside a "simulated OS project" (say, in Java or Python, could also be in C++). Each aspect can be studied in separate projects/simulators, without using a full-blown OS. For example, to teach how to use the file cache efficiently, it is necessary to make students play with a "toy" file cache using a simple algorithm. To teach the hardware aspect of operating system (including the ugliness of it), namely, how it interacts with the instruction set architecture and hardware I/O. This is usually done with "embedded system", with a small prototyping board. To teach real-world algorithms used inside modern operating system. This will require lots of paper reading, as well as implementing a non-trivial algorithm inside a real Linux kernel. This level is appropriate for graduate studies. A good project would include one or more of: Input / Output Storage Deciding what to cache / predicting what to pre-load Starting / managing / logging tasks (processes, threads or Python functions), locally or remotely Managing resources Require each process to give estimates of how much peak memory will be used, and to report a "progress" percentage regularly throughout their execution, which can then be used together to make estimates about resource usage Communication Concurrency A project that does not directly interact with hardware, but would still be good project, will be: If your project provides an abstraction of the operating system to the apps that will run "inside" your project In other words, the "apps" rely solely on your "operating system project" for their I/O, storage, task management, resource, communication needs Your project makes good (efficient, measurable) use of the real operating system (Windows, Linux etc) Then it will be a good Operating Systems project, regardless of the language used. I would suggest implementing your own memcached, map-reduce or a simple version control system as good project examples. Edited: removed ranting
0
1
0
0
2010-09-04T18:35:00.000
11
1
false
3,643,500
1
0
0
7
I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python. I have a few limitations: I have only 3 months. I want to do it in Python. I can put in say 20-30 hours every week into it. I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations? Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS) If the idea is not feasible, can anyone tell me how much do I need to scale down my idea? Any help is much appreciated!
Operating System from scratch
3,644,442
1
15
13,899
0
python,operating-system
You could probably code a small embedded-system OS in the timeframe you indicate, using concepts that are over a decade old. Many newer operating systems require many more complicated scheduling and memory-management heuristics than would be typical in a small embedded OS; designing an entire modern OS would not be a practical single-person project, but one might be able to do something interesting with some subsystem of it. I personally think there's some room for improvement in flash file systems, but I don't know what your prof would think. What is your prof really looking for?
0
1
0
0
2010-09-04T18:35:00.000
11
0.01818
false
3,643,500
1
0
0
7
I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python. I have a few limitations: I have only 3 months. I want to do it in Python. I can put in say 20-30 hours every week into it. I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations? Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS) If the idea is not feasible, can anyone tell me how much do I need to scale down my idea? Any help is much appreciated!
Operating System from scratch
3,643,741
0
15
13,899
0
python,operating-system
Developing an operating system in Python is possible. However, you might want to choose C or Assembly because there's an huge code base developed in those languages.
0
1
0
0
2010-09-04T18:35:00.000
11
0
false
3,643,500
1
0
0
7
I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python. I have a few limitations: I have only 3 months. I want to do it in Python. I can put in say 20-30 hours every week into it. I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations? Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS) If the idea is not feasible, can anyone tell me how much do I need to scale down my idea? Any help is much appreciated!
Operating System from scratch
3,643,534
2
15
13,899
0
python,operating-system
I don't get how you think you can write an operating system in Python. You need native code to at least load an interpreter during bootup, not to mention hardware communication, drivers etc., all of which would be nearly impossible to do given current Python interpreters when running on a bare machine. I'm also pondering if you are aware that you'd have to port a given Python interpreter to compile and run without an underlying operating system, which alone would keep you busy for a time. It's good that you are ambitious, but I honestly think you could not even finish the basic operating system, let alone "some very basic apps running".
0
1
0
0
2010-09-04T18:35:00.000
11
0.036348
false
3,643,500
1
0
0
7
I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python. I have a few limitations: I have only 3 months. I want to do it in Python. I can put in say 20-30 hours every week into it. I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations? Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS) If the idea is not feasible, can anyone tell me how much do I need to scale down my idea? Any help is much appreciated!
Operating System from scratch
3,644,477
1
15
13,899
0
python,operating-system
In our university we have operating systems course where we too are supposed to develop something on linux. Not entire OS. We did our own scheduling policy and file system for linux. But this will be done in C since linux is in C.
0
1
0
0
2010-09-04T18:35:00.000
11
0.01818
false
3,643,500
1
0
0
7
I have been asked to choose a project for my Operating System course at my university. I was bubbled with the idea of making an Operating System from scratch in Python. I have a few limitations: I have only 3 months. I want to do it in Python. I can put in say 20-30 hours every week into it. I want to know, how feasible is the idea? Like how far can I go in building the same. I would be very happy, if I can get a basic version running (something with a handful of very basic apps running.) Is it possible with the given limitations? Is there a book that can help me like a guideline? (need not be for python, I just need a guide to tell me how I should go about making the OS) If the idea is not feasible, can anyone tell me how much do I need to scale down my idea? Any help is much appreciated!
Is code interpreted at every call in Web2Py?
3,649,957
2
4
814
0
python,performance,caching,bytecode,web2py
I don't know web2py particularly, but it runs via WSGI like most other Python frameworks. This means that code is only interpreted when the process starts, and is otherwise kept in memory. Processes are dynamically started and killed by the web server itself, but usually last for multiple requests. In any case, the Python interpreter usually creates a byte-code file, .pyc, when code is first read. This works in a webserver environment just as it does anywhere else. Finally, however, it is generally considered that code parsing is not particularly a bottleneck - the conversion to bytecode is pretty quick. In a web application, your bottleneck is almost certainly elsewhere (probably in the connection to the database).
0
1
0
1
2010-09-06T06:59:00.000
2
0.197375
false
3,649,607
0
0
1
2
If so, What is the advantage ? (sure it will avoid restarting webserver). But isn't it a perfomance bottleneck? For production, is it possible to make web2py run directly from bytecode skipping interpreting stage (Caching) (except for the first request) ?
Is code interpreted at every call in Web2Py?
3,653,081
6
4
814
0
python,performance,caching,bytecode,web2py
In web2py, by default, all code in models, views and controllers (not web2py code, not code in modules imported by your models, views, controllers) is interpreted at every request. This allows to use a third party web server (for example apache) and still be able to see changes in your code reflected immediately without restart. PHP works in the same way. The performance penalty is negligible because the time to parse your code is less than the time to execute your code. Anyway, in the admin interface there is a "compile" button that will bytecode compile your code and collapse the view hierarchy (extended and included views) into a single file per action and remove the performance penalty. It also allows you to distribute your code bytecode compiled without giving away the source. The license allows it.
0
1
0
1
2010-09-06T06:59:00.000
2
1
false
3,649,607
0
0
1
2
If so, What is the advantage ? (sure it will avoid restarting webserver). But isn't it a perfomance bottleneck? For production, is it possible to make web2py run directly from bytecode skipping interpreting stage (Caching) (except for the first request) ?
Google App Engine - Tracking which indexes are used
3,651,774
5
3
226
0
python,database,google-app-engine,indexing
The App Engine SDK tracks this for its automatic index creation. Delete your index.yaml, then give your app a good workout. As long as you hit every distinct query in your testing, the SDK will generate a new index.yaml that contains only the indexes you need.
0
1
0
0
2010-09-06T12:55:00.000
2
1.2
true
3,651,609
0
0
1
1
I have a App Engine/Python/Django application which has grown and been modified over the past year and currently has 175 indexes. The problem is that I have not been thourough in cleaning up/removing indexes that are no longer needed. Now, I am not sure which indexes are active and which are essentially dead, but I am guessing that about 20% of the idexes are useless. I am curious if there are any App Engine tools available for tracking/counting number of accesses to indexes? If no tools are available, then one possible idea is to overload the fetch method to track this information everytime an index is accessed, but I am not sure if this is a good idea (could slow things down) and I don't know what the best way to implement this might be. If anybody has already gone through the experience of cleaning up (searching for) dead indexes, I would be interested in hearing about your experiences.
Subdomains vs folders/directories
3,653,270
1
3
286
0
python,django,nginx,subdomain
I think directories are the way to go. I believe it would be easier to adapt Django to the directories way much easier than to subdomains. And as one user commented you can avoid restarting your server each time. I prefer to keep subdomains reserved for system use. Users should get their own directories instead. This is not a rule, just my preference.
0
1
0
1
2010-09-06T17:26:00.000
2
0.099668
false
3,653,239
0
0
0
2
I'm currently building a web application and I would like my users to have their own URLs to identify them. I could either do this using subdomains or using folders and am wondering what are the advantages and disadvantages of either one. I really like the folder solution because my URL mapping would be fairly easy. I have read about auto-generating subdomains and one solution was to create virtual hosts and then restart my nginx. It's a solution but I would prefer not to have to restart my web server everytime a new account is created. If there are any other ways on how to do automated subdomain creation, that would be great as well! Thanks!
Subdomains vs folders/directories
3,653,257
0
3
286
0
python,django,nginx,subdomain
Use something like mod_wsgi instead of cgi scripts, they allow you to use arbitrary URL configs (example: Django, web.py, Zope ...)
0
1
0
1
2010-09-06T17:26:00.000
2
0
false
3,653,239
0
0
0
2
I'm currently building a web application and I would like my users to have their own URLs to identify them. I could either do this using subdomains or using folders and am wondering what are the advantages and disadvantages of either one. I really like the folder solution because my URL mapping would be fairly easy. I have read about auto-generating subdomains and one solution was to create virtual hosts and then restart my nginx. It's a solution but I would prefer not to have to restart my web server everytime a new account is created. If there are any other ways on how to do automated subdomain creation, that would be great as well! Thanks!
ubuntu /usr/bin/env: python: No such file or directory
66,512,967
7
91
161,757
0
python,ubuntu-9.04
@mchid's answer is the one you should go for it. just FYI, if you do this: $ python it will say Command 'python' not found ... But if you do this: $ python3, it should work. So, just modify the shebang line from !#/usr/bin/env python to !#/usr/bin/env python3, you're good to go. (which is automatically done by doing sudo apt install python-is-python3)
0
1
0
0
2010-09-07T02:06:00.000
7
1
false
3,655,306
0
0
0
1
I update the kernel, after that the Ubuntu doesn't work well, PS: I try to exec "meld" command, it will report that "/usr/bin/env: python: No such file or directory", then I exec "sudo apt-get install python" and get the result "python is already the newest version.", what should I do for it. I'm not good at linux, can you tell me how to revert my linux to the last right status, or reinstall the python normally.
reading .bash_history file through python script
3,656,550
0
1
696
0
python
Just some basic ideas, with important python functions for that: read the file; open go through all lines and sum up the number of occurences of a line; for, dict in case you only want to check parts of a command (for example treat cd XY and cd .. the same), normalize the lines by removing the command arguments after the space; split sort the sums and print out the command with the highest sum.
0
1
0
1
2010-09-07T07:16:00.000
3
0
false
3,656,500
0
0
0
1
I want to write a python script which reads the '.bash_history' file and prints the statistics. Also, I would like to print the command which was used the most. I was able to read the bash history through the terminal but I'm not able to do it through python programming. Can someone please help me with how to start with it?
Twisted and connection to SQL Server
4,059,366
1
0
1,128
1
python,sql-server,twisted
If you want to have portable mssql server library, you can try the module from www.pytds.com. It works with 2.5+ and 3.1, have a good stored procedure support. It's api is more "functional", and has some good features you won't find anywhere else.
0
1
0
0
2010-09-07T09:07:00.000
2
0.099668
false
3,657,271
0
0
0
1
I have a Twisted application that runs in an x86 64bit machine with Win 2008 server. It needs to be connected to a SQL Server database that runs in another machine (in a cloud actually but I have IP, port, db name, credentials). Do I need to install anything more that Twisted to my machine? And which API should be used?
How to execute another python script from your script and be able to debug?
3,658,022
2
11
7,883
0
python,debugging,command-line,runpy
Do you have control over another.py? It would be a good idea to change it and add a main() method. Main() can then be invoked if __name__ == '__main__'. This will alleviate your problems a great deal. It is also unit testing friendly.
0
1
0
0
2010-09-07T10:51:00.000
4
0.099668
false
3,657,955
1
0
0
1
You have wrapper python script that is calling another python script, currently using os.system('python another.py some-params'). You want to be able to debug both scripts and if you use os.system() you'll loose the debugger, so it does make sense to load the second script using the same interpretor instead of starting another one. import doesn't to the expected thing because it does not run the __main__. Other variants, like exec() or runpy seams to miss the argv parameters. What solution do you see for this issue? I'm looking for a solution that does not require you to modify the another.py script. Probably this will require to modify the sys.argv before executing it.
Is it possible to stream a windows (7 / vista / xp) webcams via Gstreamer
3,661,651
1
0
1,416
0
python,windows,streaming,gstreamer
For Windows streaming, I would suggest VLC.
0
1
0
0
2010-09-07T14:07:00.000
2
1.2
true
3,659,382
0
0
0
1
I very new to the world of gstreamer. I was wondering, if it's possible to stream windows webcam via gstreamer? The only package i have seen so far is for linux. v4l2 (video for linux). Is there also a package for windows webcams? what is the correct python syntax? DJ
compile python script in linux
3,674,482
0
7
12,788
0
python,linux,binary,compilation
In linux, try to avoid such things. Most package managers handle dependencies quite fine, just distribute your script and tell what dependencies it needs.
0
1
0
0
2010-09-08T20:06:00.000
3
0
false
3,671,466
0
0
0
1
So I have a python script that relies on a couple modules. Specifically pexpect and pyinoitify. I know you can compile a python script into a .exe in windows, but is there something relatively equivalent in linux? I don't care about it being a binary, I'd just like to be able to distribute my script without requiring the separate installation of pexpect and pyinotify. Is that possible/worthwhile?
How to connect to Cassandra inside a Pylons app?
3,687,133
2
10
885
1
python,pylons,cassandra
Well. I worked a little more. In fact, using a connection manager was probably not a good idea as this should be the template context. Additionally, opening a connection for each thread is not really a big deal. Opening a connection per request would be. I ended up with just pycassa.connect_thread_local() in app_globals, and there I go.
0
1
0
0
2010-09-08T20:14:00.000
2
1.2
true
3,671,535
0
0
0
1
I created a new Pylons project, and would like to use Cassandra as my database server. I plan on using Pycassa to be able to use cassandra 0.7beta. Unfortunately, I don't know where to instantiate the connection to make it available in my application. The goal would be to : Create a pool when the application is launched Get a connection from the pool for each request, and make it available to my controllers and libraries (in the context of the request). The best would be to get a connexion from the pool "lazily", i.e. only if needed If a connexion has been used, release it when the request has been processed Additionally, is there something important I should know about it ? When I see some comments like "Be careful when using a QueuePool with use_threadlocal=True, especially with retries enabled. Synchronization may be required to prevent the connection from changing while another thread is using it.", what does it mean exactly ? Thanks. -- Pierre
which language (python/perl/tcl) on linux doesn't need to install the third-party libs?
3,675,682
2
1
317
0
java,python,linux,perl,tcl
On Linux you should use the distribution's native package format (DEB, RPM, …) to deploy applications. The package managers included in the distributions can handle dependencies automatically. Apart from that, I think Perl is the only language that is available in most Linux systems out of the box. Python is very popular, too, but probably not as ubiquitous.
0
1
0
0
2010-09-09T10:17:00.000
5
0.07983
false
3,675,659
0
0
0
1
When deploy java app on linux, we don't need to install anything, all third-party libs are jar files and we only update classpath in script file. But java needs jre which is quite large. So is there any other language supported by linux can do that? By default our server only support perl/python/tcl, no gcc available, sigh.
Execute external application and send some key events to it
3,754,755
0
3
2,394
0
python,wxpython
Thanks for answering. I tried using the subprocess.Popen(), but it seems that it doesn't work. Sending the '\t' string does not work... It simply does nothing... Notice that the application is not python based (it's an installation application - basically, they are auto-extracting zip files (.exe) and I have hundreds of them...) I'll try the other idea with some windows modules... but I really would prefer using something Mac and PC compatible...
0
1
0
0
2010-09-10T12:29:00.000
3
0
false
3,684,594
0
0
0
1
I wasn't able to find a solution for Python. I am abelt o launch the application (using subprocess.Popen or subprocess.call), but I can't find a way to do the other part: I want to send a serie of keys (kind of macro) to the application I just opened. Like: Tab Tab Enter Tab Tab Delete ... Is there a way to do this that is Mac and PC compatible ? Or, in case not, only PC ? Thanks for your help, Basil PS. I know there are some application to automate some keys event, but I want to make my own.
Killing a program using multiprocessing
3,686,703
23
12
5,670
0
python
Hit Ctrl-Z to suspend the Python process, then do kill %1 to kill it. You can also just hit Ctrl-\ (backslash), but that may cause the process to leave a core file.
0
1
0
0
2010-09-10T17:07:00.000
3
1.2
true
3,686,677
1
0
0
1
I'm using the multiprocessing module to do parallel processing in my program. When I'm testing it, I'll often want to kill the program early when I notice a bug, since it takes a while to run to completion. In my Linux environment, I run my program from a terminal, and use Ctrl+C to kill it. With multiprocessing, this causes all the processes to be killed, but I never get the bash prompt back, and have to close the terminal and open a new one (and navigate back to my working directory) which is quite annoying. Is there any way to get around this?
How to Install rpy2 on Mac OS X
3,792,577
2
6
7,010
0
python,macos,osx-snow-leopard,rpy2
easy_install and rpy2 work fine together (just did it) but you need to have easy_install in sync with your specific python version. This comes down to controlling your $PATH and $PYTHONPATH environment variables so that the first Python directory that appears is the version you want and also has the easy_install version you want. Do not try to solve this by taking out the factory installed version of Python. You set your path variables in your home directory. If you are using the default bash shell, check .bash_profile for $ echo $PYTHONPATH /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ which will tell you where and in what order installed packages are searched for and $ echo $PATH /opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin: Rather than giving a recipe for how to set these if needed, I encourage you to consult the usual sources because a little knowledge is dangerous and rendering the shell inoperative by reasonable, but wrong, guesses is a real danger.
0
1
0
1
2010-09-10T20:04:00.000
2
1.2
true
3,687,939
1
0
0
1
I am trying, so far unsuccessfully, at installing the rpy2 for python on my Mac OSX. I have tried Macports and DarwinPorts but have had no luck with import rpy2 within the python shell environment. I don't know much about programming in Mac and I am a wiz at installing modules on a Windoze based system, but for the life of me cannot do a simple port on my Mac at home. What I am after, if someone would be so kind, are "dumbed down" instructions for a successful install of rpy2 for Mac OSX Snow Leopard. Hopefully someone here has done this successfully and can outline the process they took? At least that is what I am hoping. Many thanks in advance!
I can't delete a folder that I just extracted from a zip file in python
3,688,484
4
1
2,123
0
python,windows,windows-vista,operating-system,zip
Many reasons possible. You need to use os.rmdir to remove directories You need to empty the folder first - remember, the Windows command rmdir needs a /S option to remove the contents, and Python probably uses that. Is the unzip also using the archive's attributes? Read-only attributes may be applied. Are you reading anything from that folder, before you delete? You may not have closed it. Windows can cause similar problems with filenames containing unusual characters
0
1
0
0
2010-09-10T21:24:00.000
2
1.2
true
3,688,456
1
0
0
2
So here's my problem. I have a python script that takes a zipfile and extracts its contents. Then based on some constraint, I will try to delete the folder whose contents were just extracted. For some reason I get an error, WindowsError: [Error 5] Access is denied: 'Foldername' when i try to delete that folder. The simple code looks like the following wzip = zipfile.ZipFile('zipfile.zip') wzip.extractall() wzip.close() os.remove('ExtractedFolder') If I run this in the interpreter I get the following: Traceback (most recent call last): File "", line 1, in WindowsError: [Error 5] Access is denied: 'ExtractedFolder' I'm using Python 2.6 on Windows Vista 32-bit and I'm kinda baffled as to why this might be happening.
I can't delete a folder that I just extracted from a zip file in python
3,691,118
1
1
2,123
0
python,windows,windows-vista,operating-system,zip
I see a possible problem on Windows, which is that you could have an opened file in this directory. Make sure that you close explicitly all the files that you have opened using file.close() (your sample code looks right, though). Also, it might be useful to have a look at shutils.rmtree: it can recursively remove directories, and capture errors.
0
1
0
0
2010-09-10T21:24:00.000
2
0.099668
false
3,688,456
1
0
0
2
So here's my problem. I have a python script that takes a zipfile and extracts its contents. Then based on some constraint, I will try to delete the folder whose contents were just extracted. For some reason I get an error, WindowsError: [Error 5] Access is denied: 'Foldername' when i try to delete that folder. The simple code looks like the following wzip = zipfile.ZipFile('zipfile.zip') wzip.extractall() wzip.close() os.remove('ExtractedFolder') If I run this in the interpreter I get the following: Traceback (most recent call last): File "", line 1, in WindowsError: [Error 5] Access is denied: 'ExtractedFolder' I'm using Python 2.6 on Windows Vista 32-bit and I'm kinda baffled as to why this might be happening.
Security considerations - office website/portal on GAE
3,692,597
1
0
182
0
python,django,security,google-app-engine
There is always the choice between usabiity and secutity. The more security features you implent, the more difficult it gets to use it. can we host the apps on GAE (appspot.com) with https? Yes, but not on your own domain, only on appspot.com. If you are serving your app off of an own domain, you must direct all secure traffic through your app's appspot domain (on your own domain, you'd have to buy a SSL certificate, and you would need a dedicated IP etc.). If you really have to, there are ways to route SSL traffic over your own domain, but as this requires another server running something like stunnel, it gives attackers another attack target. If your app has username/password authentication, the app is really as safe as how safely one keeps his password, if you have no bugs in your code that could be exploited. About the "hackish way": on GAE, you don't have to care about server security, the only possible attack target is your code. These are some strategies for securing your app: good QA and code review to find critical bugs; Django has already built-in protection against most trivial attacks like XSRF and SQL injection, so look at the parts of your own code that are related to critical data and authentication think of other authentication methods like client side certificates (easy to use for the end user, most browser support this natively and modern operating systems have a certificate storage; probably not an easy thing to do on GAE) the weakest point of every secure enviromnent is the user, so you should inform the users about good practices on handling sensitive data and passwords (BTW, requiring a password change every few months does not improves security at all as it usally results in users writing down their passwords as they can't remember it, you loose more security than you gain) you should have good intrusion detection to lock out an attacker as soon as possible, as example behaviour analysis; Example: if a user from the USA logs in from an IP in Estonia, this is suspicious network access restrictions: you could block all IP ranges except those from your enterprise of accessing critical data, if a password gets leaked, this minimizes the possible impact improve end user security: if one of the users have a trojan on their computer that makes screen captures or keylogs, all your security is lost as the attacker could just watch the user while he's vieweing sensitive data; you should have a good security police in your enterprise force users to access your site over SSL, you should not let the users choose if they prefer security ocer comfort of not
0
1
0
0
2010-09-11T20:23:00.000
1
1.2
true
3,692,526
0
0
1
1
If one needs to create an office website (that serves as a platform for clients/customers/employees) to login and access shared data, what are the security considerations. to give you some more detail, The office portal has been developed in django/python and hosted through GAE. Essentially, the end point comes with a login/password to enter into the portal and access data. I would like to know: a) what are the things we can do to bring in a high level of security. Essentially the data is critical and hence need to be accessed by authorized people only. So would like to make it such that "The app is as safe as - how safely one keeps his password. Meaning, the only way to enter the system (unauthorized) is through a password leak (by the person) and not in any hackish way." :) b) can we host the apps on GAE (appspot.com) with https? c) are there better ways to secure other than passwords (i have heard about ssh keys/certificates). But the ultimate users may not be highly tech savvy.
Using scp to transfer a single file into a remote folder that doesn't exist
3,693,682
0
2
5,882
0
python,scp
It's not exactly scp, but sftp can take the -b parameter with a batch file. You can send a mkdir and a put.
0
1
0
1
2010-09-12T03:54:00.000
3
0
false
3,693,666
0
0
0
3
I'm working on a python script that monitors a directory and uploads files that have been created or modified using scp. That's fine, except I want this to be done recursively, and I'm having a problem if a user creates a directory in the watch directory, and then modifies a file inside that new directory. I can detect the directory creation and file nested file creation/modification just fine. But if I try to upload that file to the remote server, it won't work since the directory on the remote site won't exist. Is there a simple way to do this WITHOUT recursively copying the created directory? I want to avoid this because I don't want to delete the remote folder if it exists. Also, please don't suggest rsync. It has to only use ssh and scp.
Using scp to transfer a single file into a remote folder that doesn't exist
3,693,690
2
2
5,882
0
python,scp
Since you have ssh, can't you just create the directory first? For example, given a file with absolute path /some/path/file.txt, issue a mkdir -p /home/path before uploading file.txt. UPDATE: If you're looking to lower the number of transactions, a better method might be to make a tar file locally, transfer that, and untar it.
0
1
0
1
2010-09-12T03:54:00.000
3
1.2
true
3,693,666
0
0
0
3
I'm working on a python script that monitors a directory and uploads files that have been created or modified using scp. That's fine, except I want this to be done recursively, and I'm having a problem if a user creates a directory in the watch directory, and then modifies a file inside that new directory. I can detect the directory creation and file nested file creation/modification just fine. But if I try to upload that file to the remote server, it won't work since the directory on the remote site won't exist. Is there a simple way to do this WITHOUT recursively copying the created directory? I want to avoid this because I don't want to delete the remote folder if it exists. Also, please don't suggest rsync. It has to only use ssh and scp.
Using scp to transfer a single file into a remote folder that doesn't exist
4,294,064
1
2
5,882
0
python,scp
While I imagine your specific application will have its own quirks (as does mine), this may put you on the right path. Below is a short snippet from a script I use to put files onto a remote EC2 instance using Fabric built on paramiko. Also note I where I put the sudo commands as Fabric has its own "sudo" class. This is one of those quirks I was referring to. Hope this helps someone. from fabric.api import env, run, put, settings, cd from fabric.contrib.files import exists ''' sudo apt-get install fabric Initially setup for interaction with an AWS EC2 instance At the terminal prompt run: fab ec2 makeRemoteDirectory changePermissions putScript ''' TARGETPATH = '/your/path/here' def ec2(): env.hosts = ['your EC2 Instance or remote address'] env.user = 'user_name' env.key_filename = '/path/to/your/private_key.pem' def makeRemoteDirectory(): if not exists('%s'%TARGETPATH): run('sudo mkdir %s'%TARGETPATH) def changePermissions(): run('sudo chown -R %(user)s:%(user)s %(path)s'%{'user': env.user, 'path': TARGETPATH}) def putScript(): fileName = '/path/to/local/file' dirName = TARGETPATH put(fileName, dirName)
0
1
0
1
2010-09-12T03:54:00.000
3
0.066568
false
3,693,666
0
0
0
3
I'm working on a python script that monitors a directory and uploads files that have been created or modified using scp. That's fine, except I want this to be done recursively, and I'm having a problem if a user creates a directory in the watch directory, and then modifies a file inside that new directory. I can detect the directory creation and file nested file creation/modification just fine. But if I try to upload that file to the remote server, it won't work since the directory on the remote site won't exist. Is there a simple way to do this WITHOUT recursively copying the created directory? I want to avoid this because I don't want to delete the remote folder if it exists. Also, please don't suggest rsync. It has to only use ssh and scp.
windows python script to traverse directory to remove folders, restart PC and continue the next line of the script?
3,696,438
1
0
472
0
python,windows,directory,traversal
In a nutshell, here's what you'll need to do. You can delete the files and folders by using the remove() and rmdir() or removedirs() methods in the os module (assuming your user/program has administrative rights). To restart your script you will first need to add some command line argument handling to it that allows it to be told whether to start from the beginning or continue from the other point. To get the script to run after restart, you'll need to set a value in the Windows registry. I believe they're stored under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceand HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOncekeys. There you can add a string value (type REG_SZ) which contains a command line to invoke your script and pass it the appropriate command line argument(s) which will tell it to continue and re-install the program.
0
1
0
0
2010-09-12T07:07:00.000
1
0.197375
false
3,694,051
1
0
0
1
I want to remove a incorrectly installed program and reinstall it. I can remove the program with subprocess.Popen calling the msiexe on it and install new program the same way BUT ONLY with two independent scripts. But i also need to remove some folders in C:\Programs files and also in C:\Doc& Settings. How can i traverse through the directory structure and remove the folders?Also how can i continue the script after restart the PC from the next line to install the new program.
changing python path on mac?
61,142,084
0
18
91,910
0
python,macos
i managed to fixed mine by removing python2, i don't if it's a good practice
0
1
0
0
2010-09-12T18:56:00.000
4
0
false
3,696,124
0
0
0
1
I would like to change my PATH from Python 2.6.1 to 3.1.2. I have both versions installed on my computer, but when I type python --version in the terminal I get Python 2.6.1. So, thats the current version it's "pointing" to. Now if I type python3.1 it loads the version I want to use, although the PATH is still pointing to 2.6.1. Downloaded along with the Python 3.1 package comes an Update Shell Profile.command - when I run it and then run nano ~/.bash_profile it says: Setting PATH for Python 3.1 the orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.1/bin:${PATH}" export PATH. Does this mean that I have changed the PATH, or does it just giving me instructions how to?
Python Installation Manager
7,931,136
0
0
141
0
python,distutils
More precisely, it may be the product of the distutils bdist_winsinst command, or the bdist_msi command, or maybe the product of py2exe, a third-party project building on distutils.
0
1
0
0
2010-09-12T19:16:00.000
2
0
false
3,696,183
1
0
0
1
Often when I install .exe files made from python files I get an installation manager that is blue and has the logo "python powered". What is the name of this manager? I'd like to use it to make some installable python files.
prefer windows or unix line ending for code?
3,698,117
9
4
1,627
0
c++,python,multiplatform,line-endings
Use a version control system that's smart enough to ignore line-endings on check-in, and use the correct value for the platform on check-out.
0
1
0
0
2010-09-13T05:56:00.000
3
1.2
true
3,698,084
1
0
0
3
I writing code that should compiled and run on both Windows and unix like Linux. I know about difference between line endings, but question is which to prefer for my code? Does it matter? I want it to be consistent - say all my code uses LF only, or is it better CRLF only? Are there critaria for comparing? If it matters mostly I care for C++ and Python codes
prefer windows or unix line ending for code?
3,698,106
2
4
1,627
0
c++,python,multiplatform,line-endings
For the code itself, it does not matter. All reasonably modern editors and compilers handle both just as well (I presume you are not using notepad :-) ). Just use the line ending of the main development platform.
0
1
0
0
2010-09-13T05:56:00.000
3
0.132549
false
3,698,084
1
0
0
3
I writing code that should compiled and run on both Windows and unix like Linux. I know about difference between line endings, but question is which to prefer for my code? Does it matter? I want it to be consistent - say all my code uses LF only, or is it better CRLF only? Are there critaria for comparing? If it matters mostly I care for C++ and Python codes
prefer windows or unix line ending for code?
3,698,642
2
4
1,627
0
c++,python,multiplatform,line-endings
IME the easiest is to use *NIX line endings. Windows' compilers and IDEs can deal with it fine and it is native for *NIX tools. Using DOS line endings creates, if not problems, inconveniences with some (even the more popular) text editors on *NIX. You often get ugly '^M' at the end of the line then and you have to explicitly convert or tell your editor it has DOS line endings.
0
1
0
0
2010-09-13T05:56:00.000
3
0.132549
false
3,698,084
1
0
0
3
I writing code that should compiled and run on both Windows and unix like Linux. I know about difference between line endings, but question is which to prefer for my code? Does it matter? I want it to be consistent - say all my code uses LF only, or is it better CRLF only? Are there critaria for comparing? If it matters mostly I care for C++ and Python codes
How can we call the CLI executables commands using Python
3,699,299
0
1
170
0
python,django,web-services,api,soap
Depends on how you want to design your software. You could do stand-alone scripts as servers listening for requests on specific ports, or you could use a webserver which runs python scripts so you just have to access a URL. REST is one option to implement the latter. You should then look for frameworks for REST development with python, or if it’s simple logic with not so many possible requests can do it on your own as a web-script.
0
1
1
0
2010-09-13T09:41:00.000
3
0
false
3,699,268
0
0
0
1
How can we call the CLI executables commands using Python For example i have 3 linux servers which are at the remote location and i want to execute some commands on those servers like finding the version of the operating system or executing any other commands. So how can we do this in Python. I know this is done through some sort of web service (SOAP or REST) or API but i am not sure....... So could you all please guide me.
Google App Engine's db.UserProperty with rpxnow
3,707,639
1
0
389
1
python,google-app-engine,rpxnow
You can only get a User object if you're using one of the built-in authentication methods. User objects provide an interface to the Users API, which is handled by the App Engine infrastructure. If you're using your own authentication library, regardless of what protocol it uses, you will have to store user information differently.
0
1
0
0
2010-09-13T10:55:00.000
2
1.2
true
3,699,751
0
0
1
1
We have a Django project which runs on Google App Engine and used db.UserProperty in several models. We don't have an own User model. My boss would like to use RPXNow (Janrain) for authentication, but after I integrated it, the users.get_current_user() method returned None. It makes sense, because not Google authenticated me. But what should I use for db.UserProperty attributes? Is it possible to use rpxnow and still can have Google's User object as well? After this I tried to use OpenID authentication (with federated login) in my application, and it works pretty good: I still have users.get_current_user() object. As far as I know, rpxnow using openID as well, which means (for me) that is should be possible to get User objects with rpxnow. But how? Cheers, psmith
How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
15,379,528
5
435
1,708,519
0
python,windows,environment-variables,pythonpath
To augment PYTHONPATH, run regedit and navigate to KEY_LOCAL_MACHINE \SOFTWARE\Python\PythonCore and then select the folder for the python version you wish to use. Inside this is a folder labelled PythonPath, with one entry that specifies the paths where the default install stores modules. Right-click on PythonPath and choose to create a new key. You may want to name the key after the project whose module locations it will specify; this way, you can easily compartmentalize and track your path modifications. thanks
0
1
0
0
2010-09-13T15:04:00.000
22
0.045423
false
3,701,646
0
0
1
5
I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly. I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it still doesn't read the coltrane module and generates this error: Error: No module named coltrane
How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
13,650,817
2
435
1,708,519
0
python,windows,environment-variables,pythonpath
This PYTHONPATH variable needs to be set for ArcPY when ArcGIS Desktop is installed. PYTHONPATH=C:\arcgis\bin (your ArcGIS home bin) For some reason it never was set when I used the installer on a Windows 7 32-bit system.
0
1
0
0
2010-09-13T15:04:00.000
22
0.01818
false
3,701,646
0
0
1
5
I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly. I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it still doesn't read the coltrane module and generates this error: Error: No module named coltrane
How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
38,088,508
6
435
1,708,519
0
python,windows,environment-variables,pythonpath
The python 2.X paths can be set from few of the above instructions. Python 3 by default will be installed in C:\Users\\AppData\Local\Programs\Python\Python35-32\ So this path has to be added to Path variable in windows environment.
0
1
0
0
2010-09-13T15:04:00.000
22
1
false
3,701,646
0
0
1
5
I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly. I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it still doesn't read the coltrane module and generates this error: Error: No module named coltrane
How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
14,753,412
61
435
1,708,519
0
python,windows,environment-variables,pythonpath
Just append your installation path (ex. C:\Python27\) to the PATH variable in System variables. Then close and open your command line and type 'python'.
0
1
0
0
2010-09-13T15:04:00.000
22
1
false
3,701,646
0
0
1
5
I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly. I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it still doesn't read the coltrane module and generates this error: Error: No module named coltrane
How to add to the PYTHONPATH in Windows, so it finds my modules/packages?
58,418,095
1
435
1,708,519
0
python,windows,environment-variables,pythonpath
While this question is about the 'real' Python, it did come up in a websearch for 'Iron Python PYTHONPATH'. For Iron Python users as confused as I was: It turns out that Iron Python looks for an environment variable called IRONPYTHONPATH. Linux/Mac/POSIX users: Don't forget that not only does Windows use \ as path separators, but it also uses ; as path delimiters, not :.
0
1
0
0
2010-09-13T15:04:00.000
22
0.009091
false
3,701,646
0
0
1
5
I have a directory which hosts all of my Django apps (C:\My_Projects). I want to add this directory to my PYTHONPATH so I can call the apps directly. I tried adding C:\My_Projects\; to my Windows Path variable from the Windows GUI (My Computer > Properties > Advanced System Settings > Environment Variables). But it still doesn't read the coltrane module and generates this error: Error: No module named coltrane
Python: How to use platform.win32_ver() on a remote machine?
3,954,806
0
1
1,156
0
python,windows
I had to use remote registry... HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion ProductName, EditionID, CurrentVersion, CurrentBuild
0
1
0
0
2010-09-14T21:17:00.000
2
1.2
true
3,712,992
0
0
0
1
So of course I'm new to Python and to programming in general... I am trying to get OS version information from the network. For now I only care about the windows machines. using PyWin32 I can get some basic information, but it's not very reliable. This is an example of what I am doing right now: win32net.NetWkstaGetInfo(myip, 100) However, it appears as though this would provide me with more appropriate information: platform.win32_ver() I have no idea how get the info from a remote machine using this. I need to specify an IP or a range of IP's... I intend on using Google's ipaddr to get a list of network ranges to scan. I will eventually need to scan a large network for this info. Can someone provide an example?
Is python's shutil.move() atomic on linux?
3,716,361
20
19
4,324
0
python,file,unix,atomic
It is not atomic if the files are on different filsystems. In that case, python opens the source and destination file, loops on reading from the source and writing to the desination and finally unlinks the source file. If the source and destination file are on the same file system, python uses the rename() C call, which is atomic.
0
1
0
0
2010-09-15T09:27:00.000
1
1.2
true
3,716,325
1
0
0
1
I am wondering whether python's shutil.move is atomic on linux ? Is the behavior different if the source and destination files are on two different partitions or is it same as when they are present on the same partition ? I am more concerned to know whether the shutil.move is atomic if the source and destination files are on the same partition !
How do you properly determine the current script directory?
6,236,300
5
358
156,322
0
python
Just use os.path.dirname(os.path.abspath(__file__)) and examine very carefully whether there is a real need for the case where exec is used. It could be a sign of troubled design if you are not able to use your script as a module. Keep in mind Zen of Python #8, and if you believe there is a good argument for a use-case where it must work for exec, then please let us know some more details about the background of the problem.
0
1
0
1
2010-09-15T14:34:00.000
16
0.062419
false
3,718,657
0
0
0
1
I would like to see what is the best way to determine the current script directory in Python. I discovered that, due to the many ways of calling Python code, it is hard to find a good solution. Here are some problems: __file__ is not defined if the script is executed with exec, execfile __module__ is defined only in modules Use cases: ./myfile.py python myfile.py ./somedir/myfile.py python somedir/myfile.py execfile('myfile.py') (from another script, that can be located in another directory and that can have another current directory. I know that there is no perfect solution, but I'm looking for the best approach that solves most of the cases. The most used approach is os.path.dirname(os.path.abspath(__file__)) but this really doesn't work if you execute the script from another one with exec(). Warning Any solution that uses current directory will fail, this can be different based on the way the script is called or it can be changed inside the running script.
Python subprocess how to determine if child process hangs?
3,724,308
1
2
2,476
0
python,process,subprocess,parent-child
I guess, you are asking, how do you find if the child process is hung while operating. You can't tell easily. A process could be doing a long running operation. The context is important to understand when a process is hung. If you are expecting a process to respond to a user input and is not responsive for a long period then we consider it hung. Process is running probably waiting for some thing that will never happen. "Hung Process" is humanly way of saying that a program has reached a dead end and will be no more useful. You could have a program calculating prime numbers one after another and can run for eons and can not be called a hung process.
0
1
0
0
2010-09-16T06:35:00.000
2
0.099668
false
3,724,238
1
0
0
2
How do I know is there my child process got hang while operating?