Available Count
int64
1
31
AnswerCount
int64
1
35
GUI and Desktop Applications
int64
0
1
Users Score
int64
-17
588
Q_Score
int64
0
6.79k
Python Basics and Environment
int64
0
1
Score
float64
-1
1.2
Networking and APIs
int64
0
1
Question
stringlengths
15
7.24k
Database and SQL
int64
0
1
Tags
stringlengths
6
76
CreationDate
stringlengths
23
23
System Administration and DevOps
int64
0
1
Q_Id
int64
469
38.2M
Answer
stringlengths
15
7k
Data Science and Machine Learning
int64
0
1
ViewCount
int64
13
1.88M
is_accepted
bool
2 classes
Web Development
int64
0
1
Other
int64
1
1
Title
stringlengths
15
142
A_Id
int64
518
72.2M
1
3
0
7
2
0
1
0
how can i check admin-privileges for my script during running?
0
python,unix,root,sudo
2009-05-17T12:09:00.000
1
874,476
The concept of "admin-privileges" in our day of fine grained privilege control is becoming hard to define. If you are running on unix with "traditional" access control model, getting the effective user id (available in os module) and checking that against root (0) could be what you are looking for. If you know accessing a file on the system requires the privileges you want your script to have, you can use the os.access() to check if you are privileged enough. Unfortunately there is no easy nor portable method to give. You need to find out or define the security model used, what system provided APIs are available to query and set privileges and try to locate (or possibly implement yourself) the appropriate python modules that can be used to access the API. The classic question, why do you need to find out? What if your script tries to do what it needs to do and "just" catches and properly handles failures?
0
2,996
false
0
1
Admin privileges for script
874,519
1
6
0
3
13
0
0.099668
0
Brand new to web design, using python. Got Apache up and running, test python script working in cgi-bin directory. Get valid results when I type in the URL explicitly: ".../cgi-bin/showenv.py" But I don't want the URL to look that way. Here at stackoverflow, for example, the URLs that display in my address bar never have the messy details showing the script that was used to run them. They're clean of cgi-bin, .py, etc. extensions. How do I do that? EDIT: Thanks for responses, every single one helpful, lots to learn. I'm going with URL Rewriting for now; example in the docs looks extremely close to what I actually want to do. But I'm committed to python, so will have to look at WSGI down the road.
0
python,cgi
2009-05-19T12:24:00.000
1
882,430
Just use some good web framework e.g. django and you can have such URLs more than URLs you will have a better infrastructure, templates, db orm etc
0
10,240
false
0
1
How to hide "cgi-bin", ".py", etc from my URLs?
882,444
1
3
0
1
2
0
0.066568
0
I have a python cgi script that accepts user uploads (via sys.stdin.read). After receiving the file (whether successfully or unsuccessfully), the script needs to do some cleanup. This works fine when upload finishes correctly, however if the user closes the client, the cgi script is silently killed on the server, and as a result no cleanup code gets executed. How can i force the script to always finish.
0
python,cgi
2009-05-20T07:44:00.000
0
886,653
The script is probably not killed silently; you just don't see the exception which python throws. I suggest to wrap the whole script in try-except and write any exception to a log file. This way, you can see what really happens. The logging module is your friend.
0
1,833
false
0
1
Making a python cgi script to finish gracefully
886,956
6
26
0
8
971
1
1
0
I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten? I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various definitions of it) and the reduced coding clarity - should it be avoided? This reminds me of overflowing (buffer overflow) of C types - pointing to the top variable and overloading to set the other field values. It feels like sort of a techie showmanship but maintenance coder nightmare.
0
python,function,lambda,closures
2009-05-20T20:40:00.000
0
890,128
Lambdas are deeply linked to functional programming style in general. The idea that you can solve problems by applying a function to some data, and merging the results, is what google uses to implement most of its algorithms. Programs written in functional programming style, are easily parallelized and hence are becoming more and more important with modern multi-core machines. So in short, NO you should not forget them.
0
576,496
false
0
1
How are lambdas useful?
890,156
6
26
0
6
971
1
1
0
I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten? I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various definitions of it) and the reduced coding clarity - should it be avoided? This reminds me of overflowing (buffer overflow) of C types - pointing to the top variable and overloading to set the other field values. It feels like sort of a techie showmanship but maintenance coder nightmare.
0
python,function,lambda,closures
2009-05-20T20:40:00.000
0
890,128
I'm just beginning Python and ran head first into Lambda- which took me a while to figure out. Note that this isn't a condemnation of anything. Everybody has a different set of things that don't come easily. Is lambda one of those 'interesting' language items that in real life should be forgotten? No. I'm sure there are some edge cases where it might be needed, but given the obscurity of it, It's not obscure. The past 2 teams I've worked on, everybody used this feature all the time. the potential of it being redefined in future releases (my assumption based on the various definitions of it) I've seen no serious proposals to redefine it in Python, beyond fixing the closure semantics a few years ago. and the reduced coding clarity - should it be avoided? It's not less clear, if you're using it right. On the contrary, having more language constructs available increases clarity. This reminds me of overflowing (buffer overflow) of C types - pointing to the top variable and overloading to set the other field values...sort of a techie showmanship but maintenance coder nightmare.. Lambda is like buffer overflow? Wow. I can't imagine how you're using lambda if you think it's a "maintenance nightmare".
0
576,496
false
0
1
How are lambdas useful?
890,217
6
26
0
26
971
1
1
0
I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten? I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various definitions of it) and the reduced coding clarity - should it be avoided? This reminds me of overflowing (buffer overflow) of C types - pointing to the top variable and overloading to set the other field values. It feels like sort of a techie showmanship but maintenance coder nightmare.
0
python,function,lambda,closures
2009-05-20T20:40:00.000
0
890,128
Pretty much anything you can do with lambda you can do better with either named functions or list and generator expressions. Consequently, for the most part you should just one of those in basically any situation (except maybe for scratch code written in the interactive interpreter).
0
576,496
false
0
1
How are lambdas useful?
890,151
6
26
0
2
971
1
0.015383
0
I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten? I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various definitions of it) and the reduced coding clarity - should it be avoided? This reminds me of overflowing (buffer overflow) of C types - pointing to the top variable and overloading to set the other field values. It feels like sort of a techie showmanship but maintenance coder nightmare.
0
python,function,lambda,closures
2009-05-20T20:40:00.000
0
890,128
Lambda is a procedure constructor. You can synthesize programs at run-time, although Python's lambda is not very powerful. Note that few people understand that kind of programming.
0
576,496
false
0
1
How are lambdas useful?
890,192
6
26
0
5
971
1
0.038443
0
I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten? I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various definitions of it) and the reduced coding clarity - should it be avoided? This reminds me of overflowing (buffer overflow) of C types - pointing to the top variable and overloading to set the other field values. It feels like sort of a techie showmanship but maintenance coder nightmare.
0
python,function,lambda,closures
2009-05-20T20:40:00.000
0
890,128
I started reading David Mertz's book today 'Text Processing in Python.' While he has a fairly terse description of Lambda's the examples in the first chapter combined with the explanation in Appendix A made them jump off the page for me (finally) and all of a sudden I understood their value. That is not to say his explanation will work for you and I am still at the discovery stage so I will not attempt to add to these responses other than the following: I am new to Python I am new to OOP Lambdas were a struggle for me Now that I read Mertz, I think I get them and I see them as very useful as I think they allow a cleaner approach to programming. He reproduces the Zen of Python, one line of which is Simple is better than complex. As a non-OOP programmer reading code with lambdas (and until last week list comprehensions) I have thought-This is simple?. I finally realized today that actually these features make the code much more readable, and understandable than the alternative-which is invariably a loop of some sort. I also realized that like financial statements-Python was not designed for the novice user, rather it is designed for the user that wants to get educated. I can't believe how powerful this language is. When it dawned on me (finally) the purpose and value of lambdas I wanted to rip up about 30 programs and start over putting in lambdas where appropriate.
0
576,496
false
0
1
How are lambdas useful?
890,997
6
26
0
11
971
1
1
0
I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten? I'm sure there are some edge cases where it might be needed, but given the obscurity of it, the potential of it being redefined in future releases (my assumption based on the various definitions of it) and the reduced coding clarity - should it be avoided? This reminds me of overflowing (buffer overflow) of C types - pointing to the top variable and overloading to set the other field values. It feels like sort of a techie showmanship but maintenance coder nightmare.
0
python,function,lambda,closures
2009-05-20T20:40:00.000
0
890,128
As stated above, the lambda operator in Python defines an anonymous function, and in Python functions are closures. It is important not to confuse the concept of closures with the operator lambda, which is merely syntactic methadone for them. When I started in Python a few years ago, I used lambdas a lot, thinking they were cool, along with list comprehensions. However, I wrote and have to maintain a big website written in Python, with on the order of several thousand function points. I've learnt from experience that lambdas might be OK to prototype things with, but offer nothing over inline functions (named closures) except for saving a few key-stokes, or sometimes not. Basically this boils down to several points: it is easier to read software that is explicitly written using meaningful names. Anonymous closures by definition cannot have a meaningful name, as they have no name. This brevity seems, for some reason, to also infect lambda parameters, hence we often see examples like lambda x: x+1 it is easier to reuse named closures, as they can be referred to by name more than once, when there is a name to refer to them by. it is easier to debug code that is using named closures instead of lambdas, because the name will appear in tracebacks, and around the error. That's enough reason to round them up and convert them to named closures. However, I hold two other grudges against anonymous closures. The first grudge is simply that they are just another unnecessary keyword cluttering up the language. The second grudge is deeper and on the paradigm level, i.e. I do not like that they promote a functional-programming style, because that style is less flexible than the message passing, object oriented or procedural styles, because the lambda calculus is not Turing-complete (luckily in Python, we can still break out of that restriction even inside a lambda). The reasons I feel lambdas promote this style are: There is an implicit return, i.e. they seem like they 'should' be functions. They are an alternative state-hiding mechanism to another, more explicit, more readable, more reusable and more general mechanism: methods. I try hard to write lambda-free Python, and remove lambdas on sight. I think Python would be a slightly better language without lambdas, but that's just my opinion.
0
576,496
false
0
1
How are lambdas useful?
3,961,969
1
1
0
3
2
0
1.2
0
Can anyone share some pointers on building a Donations module for Satchmo? I'm comfortable customizing Satchmo's product models etc but unable to find anything related to Donations I realize it's possible to create a Donations virtual product but as far as I can tell this still requires setting the amount beforehand ($5, $10 etc). I want users to be able to donate arbitrary amounts
0
python,django,e-commerce,satchmo
2009-05-21T08:46:00.000
0
891,934
It looks like the satchmo_cart_details_query signal is the way to go about doing this. It allows you to add a price change value (in my case, donation amount) to a cart item I'll post the full solution if anyone is interested
0
253
true
1
1
Satchmo donations
901,050
1
3
0
0
0
0
0
1
buildin an smtp client in python . which can send mail , and also show that mail has been received through any mail service for example gmail !!
0
python,smtp
2009-05-21T10:04:00.000
0
892,196
Depends what you mean by "received". It's possible to verify "delivery" of a message to a server but there is no 100% reliable guarantee it actually ended up in a mailbox. smtplib will throw an exception on certain conditions (like the remote end reporting user not found) but just as often the remote end will accept the mail and then either filter it or send a bounce notice at a later time.
0
769
false
0
1
How would one build an smtp client in python?
892,264
2
3
0
0
0
0
0
0
Assuming the webserver is configured to handle .exe, Can i compile a python CGI file into an exe for speed. What would some pros and cons be to such a desession?
0
python
2009-05-21T21:06:00.000
0
895,163
Since the RDBMS and the network are the bottlenecks, I see no value in fussing around creating an EXE. On average, most of a web site's transfers are static content (images, .CSS, .JS, etc.) which is best handled by Apache without any Python in the loop. This has huge impact. Reserve Python for the "interesting" and "complex" parts of creating the dynamic HTML. Use a framework.
0
712
false
0
1
Compiled Python CGI
895,181
2
3
0
1
0
0
0.066568
0
Assuming the webserver is configured to handle .exe, Can i compile a python CGI file into an exe for speed. What would some pros and cons be to such a desession?
0
python
2009-05-21T21:06:00.000
0
895,163
You probably don't want to run Python as a CGI if you want it fast. Look at proxies, mod_python, WSGI or FastCGI, as those techinques avoid re-loading python runtime and your app on each request.
0
712
false
0
1
Compiled Python CGI
895,211
3
4
0
3
11
1
0.148885
0
How do I set up module imports so that each module can access the objects of all the others? I have a medium size Python application with modules files in various subdirectories. I have created modules that append these subdirectories to sys.path and imports a group of modules, using import thisModule as tm. Module objects are referred to with that qualification. I then import that module into the others with from moduleImports import *. The code is sloppy right now and has several of these things, which are often duplicative. First, the application is failing because some module references aren't assigned. This same code does run when unit tested. Second, I'm worried that I'm causing a problem with recursive module imports. Importing moduleImports imports thisModule, which imports moduleImports . . . . What is the right way to do this?
0
python,python-import
2009-05-22T02:09:00.000
0
896,112
You won't get recursion on imports because Python caches each module and won't reload one it already has.
0
16,427
false
0
1
Properly importing modules in Python
896,128
3
4
0
6
11
1
1
0
How do I set up module imports so that each module can access the objects of all the others? I have a medium size Python application with modules files in various subdirectories. I have created modules that append these subdirectories to sys.path and imports a group of modules, using import thisModule as tm. Module objects are referred to with that qualification. I then import that module into the others with from moduleImports import *. The code is sloppy right now and has several of these things, which are often duplicative. First, the application is failing because some module references aren't assigned. This same code does run when unit tested. Second, I'm worried that I'm causing a problem with recursive module imports. Importing moduleImports imports thisModule, which imports moduleImports . . . . What is the right way to do this?
0
python,python-import
2009-05-22T02:09:00.000
0
896,112
Few pointers You may have already split functionality in various module. If correctly done most of the time you will not fall into circular import problems (e.g. if module a depends on b and b on a you can make a third module c to remove such circular dependency). As last resort, in a import b but in b import a at the point where a is needed e.g. inside function. Once functionality is properly in modules group them in packages under a subdir and add a __init__.py file to it so that you can import the package. Keep such pakages in a folder e.g. lib and then either add to sys.path or set PYTHONPATH env variable from module import * may not be good idea. Instead, import whatever is needed. It may be fully qualified. It doesn't hurt to be verbose. e.g. from pakageA.moduleB import CoolClass.
0
16,427
false
0
1
Properly importing modules in Python
896,137
3
4
0
4
11
1
0.197375
0
How do I set up module imports so that each module can access the objects of all the others? I have a medium size Python application with modules files in various subdirectories. I have created modules that append these subdirectories to sys.path and imports a group of modules, using import thisModule as tm. Module objects are referred to with that qualification. I then import that module into the others with from moduleImports import *. The code is sloppy right now and has several of these things, which are often duplicative. First, the application is failing because some module references aren't assigned. This same code does run when unit tested. Second, I'm worried that I'm causing a problem with recursive module imports. Importing moduleImports imports thisModule, which imports moduleImports . . . . What is the right way to do this?
0
python,python-import
2009-05-22T02:09:00.000
0
896,112
The way to do this is to avoid magic. In other words, if your module requires something from another module, it should import it explicitly. You shouldn't rely on things being imported automatically. As the Zen of Python (import this) has it, explicit is better than implicit.
0
16,427
false
0
1
Properly importing modules in Python
897,001
1
4
0
0
0
0
1.2
0
It seems that IronPython 2.0.1 executes a script file about 3x slower than IronPython 1.x. I'm not convinced that it isn't something I'm doing so I'm wondering if others have had a similar experience. I have a 200k python script that takes 5 seconds to execute from a file on IP 1.x and nearly 18 seconds in IP 2.0.1!
0
ironpython
2009-05-22T17:25:00.000
0
898,993
Does your timings include startup time? IronPython 2.6 Beta has radical improvements to startup time and code compilation/execution. Suggest you try that release if you can. Cheers, Davy
0
441
true
0
1
IronPython 2.0 executes code slowly
924,632
2
2
0
0
0
0
0
0
Following on my previous question, if I have some hosting how can I put a python script on their that I can then run from there? Do I need to do something special to run it/install something? EDIT-Clarification-I would like to be able to upload the script which does stuff on the internet-no data is stored on my computer. I then need to schedule it to run once a day.
0
python,hosting
2009-05-25T08:42:00.000
0
905,902
Usually python is already installed, but it depends on your hoster. Ask them.
0
243
false
0
1
Storing Python scripts on a webserver
905,924
2
2
0
1
0
0
0.099668
0
Following on my previous question, if I have some hosting how can I put a python script on their that I can then run from there? Do I need to do something special to run it/install something? EDIT-Clarification-I would like to be able to upload the script which does stuff on the internet-no data is stored on my computer. I then need to schedule it to run once a day.
0
python,hosting
2009-05-25T08:42:00.000
0
905,902
You have to ensure your hoster system supports Python. You can ask them about that. To run the script once it is there, you can act in several ways, depending on what you want to do. You can have your server side language to invoke it (i.e. from the backend of a web page), or if you have a shell access to the machine you can invoke it manually. Btw, very often hosting providers give a scheduling tool (i.e. an interface for crontab or at) via the hosting plan administration panel, which you could use to start your script. First thing, anyway, you have to ask your hoster and check Python availability.
0
243
false
0
1
Storing Python scripts on a webserver
906,016
1
2
0
3
2
0
0.291313
0
I have an application written in python. I created a plugin system for the application that uses egg files. Egg files contain compiled python files and can be easily decompiled and used to hack the application. Is there a way to secure this system? I'd like to use digital signature for this - sign these egg files and check the signature before loading such egg file. Is there a way to do this programmatically from python? Maybe using winapi?
0
python,plugins,signing
2009-05-25T22:39:00.000
0
908,285
Is there a way to secure this system? The answer is "that depends". The two questions you should ask is "what are people supposed to be able to do" and "what are people able to do (for a given implementation)". If there exists an implementation where the latter is a subset of the former, the system can be secured. One of my friend is working on a programming competition judge: a program which runs a user-submitted program on some test data and compares its output to a reference output. That's damn hard to secure: you want to run other peoples' code, but you don't want to let them run arbitrary code. Is your scenario somewhat similar to this? Then the answer is "it's difficult". Do you want users to download untrustworthy code from the web and run it with some assurance that it won't hose their machine? Then look at various web languages. One solution is not offering access to system calls (JavaScript) or offering limited access to certain potentially dangerous calls (Java's SecurityManager). None of them can be done in python as far as I'm aware, but you can always hack the interpreter and disallow the loading of external modules not on some whitelist. This is probably error-prone. Do you want users to write plugins, and not be able to tinker with what the main body of code in your application does? Consider that users can decompile .pyc files and modify them. Assume that those running your code can always modify it, and consider the gold-farming bots for WoW. One Linux-only solution, similar to the sandboxed web-ish model, is to use AppArmor, which limits which files your app can access and which system calls it can make. This might be a feasible solution, but I don't know much about it so I can't give you advice other than "investigate". If all you worry about is evil people modifying code while it's in transit in the intertubes, standard cryptographic solutions exist (SSL). If you want to only load signed plugins (because you want to control what the users do?), signing code sounds like the right solution (but beware of crafty users or evil people who edit the .pyc files and disables the is-it-signed check).
0
1,311
false
0
1
Secure plugin system for python application
908,846
1
2
0
3
2
0
1.2
0
Good afternoon, I would ask some suggestion about the best way to monitor events over the serial port. I'm using PySerial to write "commands" over the serial port towards some devices and I would like to receive feedback about the status of this devices. Wich is the best way: 1) fullfill a pipe and read into, 2) a new thread delegated to read only, or what? Can I also ask for a simple code to implement the solution?
0
python,pyserial
2009-05-26T14:46:00.000
0
911,089
For general tips on working with pyserial, look at the search S.Lott suggested in the comment. Regarding the best strategy to implement your application - it all depends on how your protocols are defined. Do the devices immediately respond to queries? Or do they continually send data that must be monitored? This is important to define, as it certainly affects the way you'll want to handle the communication. Generally, I've found it simple and stable to have a separate thread reading everything from the serial port and just pumping the data into a Queue. The main application logic then can query this queue whenever it needs to and read the data.
0
6,847
true
0
1
python monitoring over serial port
911,772
1
6
0
1
13
1
0.033321
0
While it is fairly trivial in Python to import a "child" module into another module and list its attributes, it becomes slightly more difficult when you want to import all child modules. I'm building a library of tools for an existing 3D application. Each tool has its own menu item and sub menus. I'd like the tool to be responsible for creating its own menus as many of them change based on context and templates. I'd like my base module to be able to find all child modules and check for a create_menu() function and call it if it finds it. What is the easiest way to discover all child modules?
0
python,module,package,python-import
2009-05-26T18:25:00.000
0
912,025
The solution above traversing the filesystem for finding submodules is ok as long as you implement every plugin as a filesystem based module. A more flexible way would be an explicit plugin list in your main module, and have every plugin (whether a module created by file, dynamically, or even instance of a class) adding itself to that list explicitly. Maybe via a registerPlugin function. Remember: "explicit is better than implicit" is part of the zen of python.
0
6,221
false
0
1
How to find all child modules in Python?
7,338,242
1
2
0
5
4
1
1.2
0
I'm migrating a legacy codebase at work from python 2.4 to python 2.6. This is being done as part of a push to remove the 'legacy' tag and make a maintainable, extensible foundation for active development, so I'm getting a chance to "do things right", including refactoring to use new 2.6 features if that leads to cleaner, more robust code. (I'm already in raptures over the 'with' statement :)). Any good tips for the migration? Best practices, design patterns, etc? I'm mostly a ruby programmer; I've learnt some python 2.4 while working with this code but know nothing about modern python design principles, so feel free to suggest things that you might think are obvious.
0
python
2009-05-27T11:03:00.000
0
915,135
Read the Python 3.0 changes. The point of 2.6 is to aim for 3.0. From 2.4 to 2.6 you gained a lot of things. These are the the most important. I'm making this answer community wiki so other folks can edit it. Generator functions and the yield statement. More consistent use of various types like list and dict -- they can be extended directly. from __future__ import with_statement from __future__ import print_function Exceptions are new style classes, and there's more consistent exception handling. String exceptions have been removed. Attempting to use them raises a TypeError
0
3,565
true
0
1
Migrating from python 2.4 to python 2.6
915,195
4
6
0
8
17
1
1
0
I'm basically wondering if Python has any OOP shortcomings like PHP does. PHP has been developing their OOP practices for the last few versions. It's getting better in PHP but it's still not perfect. I'm new to Python and I'm just wondering if Python's OOP support is better or just comparable. If there are some issues in Python OOP which don't follow proper OOP practices I would definitely like to know those. PHP for instance, doesn't allow for multiple inheritance as far as I'm aware. Thanks Everyone! Edit: How about support for Public and Private? or support of variable types. I think these are important regarding building OOP software.
0
php,python,oop,comparison
2009-05-27T17:09:00.000
0
916,962
Python's OOP support is very strong; it does allow multiple inheritance, and everything is manipulable as a first-class object (including classes, methods, etc). Polymorphism is expressed through duck typing. For example, you can iterate over a list, a tuple, a dictionary, a file, a web resource, and more all in the same way. There are a lot of little pedantic things that are debatably not OO, like getting the length of a sequence with len(list) rather than list.len(), but it's best not to worry about them.
0
3,813
false
0
1
How does Python OOP compare to PHP OOP?
917,005
4
6
0
20
17
1
1.2
0
I'm basically wondering if Python has any OOP shortcomings like PHP does. PHP has been developing their OOP practices for the last few versions. It's getting better in PHP but it's still not perfect. I'm new to Python and I'm just wondering if Python's OOP support is better or just comparable. If there are some issues in Python OOP which don't follow proper OOP practices I would definitely like to know those. PHP for instance, doesn't allow for multiple inheritance as far as I'm aware. Thanks Everyone! Edit: How about support for Public and Private? or support of variable types. I think these are important regarding building OOP software.
0
php,python,oop,comparison
2009-05-27T17:09:00.000
0
916,962
I would say that Python's OOP support is much better given the fact that it was introduced into the language in its infancy as opposed to PHP which bolted OOP onto an existing procedural model.
0
3,813
true
0
1
How does Python OOP compare to PHP OOP?
916,974
4
6
0
3
17
1
0.099668
0
I'm basically wondering if Python has any OOP shortcomings like PHP does. PHP has been developing their OOP practices for the last few versions. It's getting better in PHP but it's still not perfect. I'm new to Python and I'm just wondering if Python's OOP support is better or just comparable. If there are some issues in Python OOP which don't follow proper OOP practices I would definitely like to know those. PHP for instance, doesn't allow for multiple inheritance as far as I'm aware. Thanks Everyone! Edit: How about support for Public and Private? or support of variable types. I think these are important regarding building OOP software.
0
php,python,oop,comparison
2009-05-27T17:09:00.000
0
916,962
Also: Python has native operator overloading, unlike PHP (although it does exist an extension). Love it or hate it, it's there.
0
3,813
false
0
1
How does Python OOP compare to PHP OOP?
917,052
4
6
0
1
17
1
0.033321
0
I'm basically wondering if Python has any OOP shortcomings like PHP does. PHP has been developing their OOP practices for the last few versions. It's getting better in PHP but it's still not perfect. I'm new to Python and I'm just wondering if Python's OOP support is better or just comparable. If there are some issues in Python OOP which don't follow proper OOP practices I would definitely like to know those. PHP for instance, doesn't allow for multiple inheritance as far as I'm aware. Thanks Everyone! Edit: How about support for Public and Private? or support of variable types. I think these are important regarding building OOP software.
0
php,python,oop,comparison
2009-05-27T17:09:00.000
0
916,962
If you are looking for "more pure" OOP, you should be looking at SmallTalk and/or Ruby. PHP has grown considerably with it's support for OOP, but because of the way it works (reloads everything every time), things can get really slow if OOP best practices are followed. Which is one of the reasons you don't hear about PHP on Rails much.
0
3,813
false
0
1
How does Python OOP compare to PHP OOP?
917,054
1
4
0
4
20
1
0.197375
0
How do I read back all of the cookies in Python without knowing their names?
0
python,cookies
2009-05-28T15:35:00.000
0
921,532
Look at the Cookie: headers in the HTTP response you get, parse their contents with module Cookie in the standard library.
0
43,214
false
0
1
Retrieving all Cookies in Python
921,544
1
2
0
0
5
0
0
0
Is it possible to run "paster shell blah.ini" (or a variant thereof) and have it automatically load certain libraries? I hate having to always type "from foo.bar import mystuff" as the first command in every paster shell, and would like the computer to do it for me.
0
python,pylons,paster
2009-05-28T18:01:00.000
0
922,351
If you set the environment variable PYTHONSTARTUP to the name of a file, it will execute that file on opening the interactive prompt. I don't know anything about paster shell, but I assume it works similarly. Alternatively you could look into iPython, which has much more powerful features (particularly when installed with the readline library). For example %run allows you to run a script in the current namespace, or you can use history completion. Edit: Okay. Having looked into it a bit more, I'm fairly certain that paster shell just does a set of useful imports, and could be easily replicated with a short script and ipython and then %run myscript.py Edit: Having looked at the source, it would be very hard to do (I was wrong about the default imports. It parses your config file as well), however if you have Pylons and iPython both installed, then paster shell should use iPython automagically. Double check that both are installed properly, and double check that paster shell isn't using iPython already (it might be looking like normal python prompt).
0
1,107
false
0
1
Is it possible to launch a Paster shell with some modules pre-imported?
980,897
2
2
1
0
2
0
0
0
I'm am trying to roll out a test application to test the feasibility of righting a Click Once Smart Client app that also uses a rules engine customizable by embedding IronPython. So far all users but me get this error (below) when invoking the script engine. Do I need to do something special to force deployment of the IronPython and Scripting assemblies? I thought that would be automatic because they were referenced in my project. Is this just not feasible in .NET 2.0? Thoughts? ************** Exception Text ************** System.MissingMethodException: Method not found: 'Void System.Reflection.Emit.DynamicMethod..ctor(System.String, System.Type, System.Type[], Boolean)'. at Microsoft.Scripting.Utils.Helpers.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes) at Microsoft.Linq.Expressions.Compiler.Snippets.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes) at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CreateDynamicLambdaCompiler(CompilerScope scope, String methodName, Type returnType, IList`1 paramTypes, IList`1 paramNames, Boolean closure, Boolean emitDebugSymbols, Boolean forceDynamic) at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CompileLambda(LambdaExpression lambda, Type delegateType, Boolean emitDebugSymbols, Boolean forceDynamic, MethodInfo& method) at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CompileLambda[T](LambdaExpression lambda, Boolean emitDebugSymbols) at Microsoft.Linq.Expressions.LambdaExpression.Compile[T](Boolean emitDebugSymbols) at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope) at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at UAP.UI.Form1.button1_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
0
c#,.net,scripting,ironpython
2009-05-28T19:14:00.000
0
922,681
If you right click your project and go to Properties theres a Publish tab, that allows you to specify prerequisite installs for your application. Presumably you can supply a path to the IronPython install executable here.
0
1,241
false
0
1
IronPython, Click Once, .NET 2.0 Error - thoughts?
922,701
2
2
1
4
2
0
0.379949
0
I'm am trying to roll out a test application to test the feasibility of righting a Click Once Smart Client app that also uses a rules engine customizable by embedding IronPython. So far all users but me get this error (below) when invoking the script engine. Do I need to do something special to force deployment of the IronPython and Scripting assemblies? I thought that would be automatic because they were referenced in my project. Is this just not feasible in .NET 2.0? Thoughts? ************** Exception Text ************** System.MissingMethodException: Method not found: 'Void System.Reflection.Emit.DynamicMethod..ctor(System.String, System.Type, System.Type[], Boolean)'. at Microsoft.Scripting.Utils.Helpers.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes) at Microsoft.Linq.Expressions.Compiler.Snippets.CreateDynamicMethod(String name, Type returnType, Type[] parameterTypes) at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CreateDynamicLambdaCompiler(CompilerScope scope, String methodName, Type returnType, IList`1 paramTypes, IList`1 paramNames, Boolean closure, Boolean emitDebugSymbols, Boolean forceDynamic) at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CompileLambda(LambdaExpression lambda, Type delegateType, Boolean emitDebugSymbols, Boolean forceDynamic, MethodInfo& method) at Microsoft.Linq.Expressions.Compiler.LambdaCompiler.CompileLambda[T](LambdaExpression lambda, Boolean emitDebugSymbols) at Microsoft.Linq.Expressions.LambdaExpression.Compile[T](Boolean emitDebugSymbols) at Microsoft.Scripting.Runtime.OptimizedScriptCode.InvokeTarget(LambdaExpression code, Scope scope) at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at UAP.UI.Form1.button1_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
0
c#,.net,scripting,ironpython
2009-05-28T19:14:00.000
0
922,681
IronPython requiers .NET 2.0SP1 or later to run. This exception is happening due to an overload that was added in SP1.
0
1,241
false
0
1
IronPython, Click Once, .NET 2.0 Error - thoughts?
923,395
3
7
0
2
12
0
0.057081
0
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate? I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
0
python,templates,mako
2009-05-28T19:34:00.000
0
922,771
What I ended up doing was naming my Mako Templates with .html suffix and thus getting the usual HTML syntax highlighting etc. that I am used to. Alternatively I could have associated .mako suffix with the HTML handler. While this does not address Mako specifically, it was enough for me, since I find most of the template is plain HTML anyway.
0
5,178
false
1
1
Syntax Highlight for Mako in Eclipse or TextMate?
923,030
3
7
0
0
12
0
0
0
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate? I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
0
python,templates,mako
2009-05-28T19:34:00.000
0
922,771
Windows (menu) > Preference > General > Editor > File Associations Add *.mako in File Types (upper box) and add Html editor in Associated editor (lower box) Windows (menu) > Preference > General > Editor > Content Types Under Text find HTML and add *.mako in File associations.
0
5,178
false
1
1
Syntax Highlight for Mako in Eclipse or TextMate?
30,838,894
3
7
0
1
12
0
0.028564
0
Does anyone know of a syntax highlight for Mako templates for Eclipse or for TextMate? I know that there is a .mako syntax highlighter for the default text editor in Ubuntu.
0
python,templates,mako
2009-05-28T19:34:00.000
0
922,771
You can go to: Preferences->General->Editors->File Associations. Click to add a new file type and type *.mak and click OK. In File types click on *.mak and under Associated editors add HTML editor(default), Text Editor, Text Editor(studio) and Web Browser. This colors the text, works OK for me :) P.S. Be sure to have the Aptana plugin installed.
0
5,178
false
1
1
Syntax Highlight for Mako in Eclipse or TextMate?
8,544,623
2
3
0
1
1
0
0.066568
0
Scenario: I have a php page in which I call a python script. Python script when run on the command line (Linux) shows output on the command line, as well as writes the output to a file. Python script when run through php, doesn't do either. Elaboration: I use a simple system command in PHP to run the python script as: /var/www/html/1.php: system('/usr/python/bin/python3 ../cgi-bin/tabular.py 1'); /var/www/cgi-bin/tabular.py --This python file basically parses a data file, uses python's regular expression to search for specific headings and outputs the headings to the stdout, as well as write it to a file. This python script has a few routines in it which get executed, so I put print statements to debug. I noticed only a few initial print statements' output in the PHP page, all the ones from the function that actually does something are not seen. Also, as part of my test, I thought well the py script is in a different folder so let me change it to the /var/www/html folder, no go. I hope I captured the problem statement with sufficient detail and someone is able to reproduce this issue at their end. If I make any progress on this one myself, I'll annotate this question. Thanks everyone. Gaurav
0
php,python,linux
2009-05-28T23:21:00.000
0
923,680
A permission problem is most likely the case. If apache is running as apache, then it will not have access to write to a file unless The file is owned by apache The file is in the group apache and group writable The file is world writable This is a "sticky" problem on a multi-user machine, as different people have access to Apache. Try chmod 666 output.txt on the file and then re-run your test. Considerations: Have the python script write the output to a database Use PHP's popen functionality to open the process and communicate over pipes Re-write using PHP's regular expressions Write the output file to /tmp and then read the results using PHP as soon as the python script is done. etc...
0
1,882
false
0
1
When calling a Python script from a PHP script, temporary file that is created on a console run, is not created via the PHP invocation
924,481
2
3
0
0
1
0
0
0
Scenario: I have a php page in which I call a python script. Python script when run on the command line (Linux) shows output on the command line, as well as writes the output to a file. Python script when run through php, doesn't do either. Elaboration: I use a simple system command in PHP to run the python script as: /var/www/html/1.php: system('/usr/python/bin/python3 ../cgi-bin/tabular.py 1'); /var/www/cgi-bin/tabular.py --This python file basically parses a data file, uses python's regular expression to search for specific headings and outputs the headings to the stdout, as well as write it to a file. This python script has a few routines in it which get executed, so I put print statements to debug. I noticed only a few initial print statements' output in the PHP page, all the ones from the function that actually does something are not seen. Also, as part of my test, I thought well the py script is in a different folder so let me change it to the /var/www/html folder, no go. I hope I captured the problem statement with sufficient detail and someone is able to reproduce this issue at their end. If I make any progress on this one myself, I'll annotate this question. Thanks everyone. Gaurav
0
php,python,linux
2009-05-28T23:21:00.000
0
923,680
Check that the user the python script is running is has write permissions in CWD. Also, try shell_exec() or passthru() to call the script, rather than system().
0
1,882
false
0
1
When calling a Python script from a PHP script, temporary file that is created on a console run, is not created via the PHP invocation
923,761
4
8
0
0
2
0
0
0
I am writing automation code in python to test the behavior of a network application. As such, my code needs to be able to start a process/script (say, tcpdump or a python script) on a server in the network, disconnect, run other processes and then later return and shutdown/evaluate the process started earlier. My network is a mix of windows and linux machines and all of the machines have sshd and python running (via Cygwin for the windows machines). I've considered a couple of ideas, namely: - Starting a process and moving it to the background via a trailing ampersand (&) - Using screen in some fashion - Using python threads What else should I be considering? In your experience what have you found to be the best way to accomplish a task like this?
0
python,testing,scripting
2009-05-28T23:25:00.000
1
923,691
Most commercial products install an "Agent" on the remote machines. In the linux world, you have numerous such agents. rexec and rlogin and rsh all jump to mind. These are all clients that communication with daemons running on the remote hosts. If you don't want to use these agents, you can read about them and reinvent these wheels in pure Python. Essentially, the client (rexec for example) communicates with the server (rexecd) to send work requests.
0
2,588
false
0
1
How to start a process on a remote server, disconnect, then later collect output?
923,720
4
8
0
0
2
0
0
0
I am writing automation code in python to test the behavior of a network application. As such, my code needs to be able to start a process/script (say, tcpdump or a python script) on a server in the network, disconnect, run other processes and then later return and shutdown/evaluate the process started earlier. My network is a mix of windows and linux machines and all of the machines have sshd and python running (via Cygwin for the windows machines). I've considered a couple of ideas, namely: - Starting a process and moving it to the background via a trailing ampersand (&) - Using screen in some fashion - Using python threads What else should I be considering? In your experience what have you found to be the best way to accomplish a task like this?
0
python,testing,scripting
2009-05-28T23:25:00.000
1
923,691
As @Gandalf mentions, you'll need nohup in addition to the backgrounding &, or the process will be SIGKILLed when the login session terminates. If you redirect your output to a log file, you'll be able to look at it later easily (and not have to install screen on all your machines).
0
2,588
false
0
1
How to start a process on a remote server, disconnect, then later collect output?
923,719
4
8
0
3
2
0
0.07486
0
I am writing automation code in python to test the behavior of a network application. As such, my code needs to be able to start a process/script (say, tcpdump or a python script) on a server in the network, disconnect, run other processes and then later return and shutdown/evaluate the process started earlier. My network is a mix of windows and linux machines and all of the machines have sshd and python running (via Cygwin for the windows machines). I've considered a couple of ideas, namely: - Starting a process and moving it to the background via a trailing ampersand (&) - Using screen in some fashion - Using python threads What else should I be considering? In your experience what have you found to be the best way to accomplish a task like this?
0
python,testing,scripting
2009-05-28T23:25:00.000
1
923,691
nohup for starters (at least on *nix boxes) - and redirect the output to some log file where you can come back and monitor it of course.
0
2,588
false
0
1
How to start a process on a remote server, disconnect, then later collect output?
923,703
4
8
0
0
2
0
0
0
I am writing automation code in python to test the behavior of a network application. As such, my code needs to be able to start a process/script (say, tcpdump or a python script) on a server in the network, disconnect, run other processes and then later return and shutdown/evaluate the process started earlier. My network is a mix of windows and linux machines and all of the machines have sshd and python running (via Cygwin for the windows machines). I've considered a couple of ideas, namely: - Starting a process and moving it to the background via a trailing ampersand (&) - Using screen in some fashion - Using python threads What else should I be considering? In your experience what have you found to be the best way to accomplish a task like this?
0
python,testing,scripting
2009-05-28T23:25:00.000
1
923,691
If you are using python to run the automation... I would attempt to automate everything using paramiko. It's a versatile ssh library for python. Instead of going back to the output, you could collect multiple lines of output live and then disconnect when you no longer need the process and let ssh do the killing for you.
0
2,588
false
0
1
How to start a process on a remote server, disconnect, then later collect output?
20,889,031
2
3
0
2
0
0
0.132549
0
Fedora Core 9 includes Python 2.5.1. I can use YUM to get latest and greatest releases. To get ready for 2.6 official testing, I wanted to start with 2.5.4. It appears that there's no Fedora 9 YUM package, because 2.5.4 isn't an official part of FC9. I downloaded 2.5.4, did ./configure; make; make install and wound up with two Pythons. The official 2.5.1 (in /usr/bin) and the new 2.5.4. (in /usr/local/bin). None of my technology stack is installed in /usr/local/lib/python2.5. It appears that I have several choices for going forward. Anyone have any preferences? Copy /usr/lib/python2.5/* to /usr/local/lib/python2.5 to replicate my environment. This should work, unless some part of the Python libraries have /usr/bin/python wired in during installation. This is sure simple, but is there a down side? Reinstall everything by running easy_install. Except, easy_install is (currently) hard-wired to /usr/bin/python. So, I'd have to fix easy_install first, then reinstall everything. This takes some time, but it gives me a clean, new latest-and-greatest environment. But is there a down-side? [And why does easy_install hard-wire itself?] Relink /usr/bin/python to be /usr/local/bin/python. I'd still have to copy or reinstall the library, so I don't think this does me any good. [It would make easy_install work; but so would editing /usr/bin/easy_install.] Has anyone copied their library? Is it that simple? Or should I fix easy_install and simply step through the installation guide and build a new, clean, latest-and-greatest? Edit Or, should I Skip trying to resolve the 2.5.1 and 2.5.4 issues and just jump straight to 2.6?
0
python,fedora,easy-install
2009-05-29T13:29:00.000
1
925,965
I suggest you create a virtualenv (or several) for installing packages into.
0
1,989
false
0
1
Fedora Python Upgrade broke easy_install
926,006
2
3
0
2
0
0
0.132549
0
Fedora Core 9 includes Python 2.5.1. I can use YUM to get latest and greatest releases. To get ready for 2.6 official testing, I wanted to start with 2.5.4. It appears that there's no Fedora 9 YUM package, because 2.5.4 isn't an official part of FC9. I downloaded 2.5.4, did ./configure; make; make install and wound up with two Pythons. The official 2.5.1 (in /usr/bin) and the new 2.5.4. (in /usr/local/bin). None of my technology stack is installed in /usr/local/lib/python2.5. It appears that I have several choices for going forward. Anyone have any preferences? Copy /usr/lib/python2.5/* to /usr/local/lib/python2.5 to replicate my environment. This should work, unless some part of the Python libraries have /usr/bin/python wired in during installation. This is sure simple, but is there a down side? Reinstall everything by running easy_install. Except, easy_install is (currently) hard-wired to /usr/bin/python. So, I'd have to fix easy_install first, then reinstall everything. This takes some time, but it gives me a clean, new latest-and-greatest environment. But is there a down-side? [And why does easy_install hard-wire itself?] Relink /usr/bin/python to be /usr/local/bin/python. I'd still have to copy or reinstall the library, so I don't think this does me any good. [It would make easy_install work; but so would editing /usr/bin/easy_install.] Has anyone copied their library? Is it that simple? Or should I fix easy_install and simply step through the installation guide and build a new, clean, latest-and-greatest? Edit Or, should I Skip trying to resolve the 2.5.1 and 2.5.4 issues and just jump straight to 2.6?
0
python,fedora,easy-install
2009-05-29T13:29:00.000
1
925,965
I've had similar experiences and issues when installing Python 2.5 on an older release of ubuntu that supplied 2.4 out of the box. I first tried to patch easy_install, but this led to problems with anything that wanted to use the os-supplied version of python. I was often fiddling with the tool chain to fix different errors that might crop up with every install. Installing any python software via apt, or installing any software from apt that had a python easy_install script as part of the install, was often amusing. I'm sure I could probably have been more vigilant in patching easy_install, but I gave up. Instead, I copied the library, and everything worked. As you say, there may be issues depending on what you have installed, but I didn't run into issues. Double-checking Python's site.py module, I did see that it operates entirely on relative paths, building absolute paths dynamically; this gave me some confidence to try the "copy everything" approach. I double-checked any .pth files, then went for it.
0
1,989
false
0
1
Fedora Python Upgrade broke easy_install
926,636
2
6
0
0
25
0
0
0
How can I get the owner and group IDs of a directory using Python under Linux?
0
python,linux,directory,owner
2009-05-29T20:04:00.000
1
927,866
Use the os.stat function.
0
26,467
false
0
1
How to get the owner and group of a folder with Python on a Linux machine?
927,888
2
6
0
0
25
0
0
0
How can I get the owner and group IDs of a directory using Python under Linux?
0
python,linux,directory,owner
2009-05-29T20:04:00.000
1
927,866
If you are using Linux, it is much easier. Install tree with the command yum install tree. Then execute the command 'tree -a -u -g'
0
26,467
false
0
1
How to get the owner and group of a folder with Python on a Linux machine?
71,426,599
1
7
0
1
23
0
0.028564
0
Can someone please tell me if there is an equivalent for Python's lambda functions in Java?
0
java,python,function,lambda
2009-05-30T15:49:00.000
0
929,988
With the release of Java 8, lambda-expression is now available. And the lambda function in java is actually "more powerful" than the python ones. In Python, lambda-expression may only have a single expression for its body, and no return statement is permitted. In Java, you can do something like this: (int a, int b) -> { return a * b; }; and other optional things as well. Java 8 also introduces another interface called the Function Interface. You might want to check that out as well.
0
12,221
false
1
1
Equivalent for Python's lambda functions in Java?
41,144,957
1
8
0
-1
20
1
-0.024995
0
Is there a similar or equivalent function in Python to the PHP function htmlspecialchars()? The closest thing I've found so far is htmlentitydefs.entitydefs().
0
php,python,html-entities,htmlspecialchars
2009-05-31T05:58:00.000
0
931,423
If you are using django 1.0 then your template variables will already be encoded and ready for display. You also use the safe operator {{ var|safe }} if you don't want it globally turned on.
0
12,591
false
1
1
Is there a Python equivalent to the PHP function htmlspecialchars()?
931,442
2
3
0
0
3
0
0
0
Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resources?
0
c#,python,ruby,ironpython,ironruby
2009-06-01T07:14:00.000
0
933,822
IronPython 2.0 has a sample compiler called PYC on Codeplex.com/ironpython which can create DLL's (and applications if you need them too). IronPython 2.6 has a newer version of PYC under Tools\script. Cheers, Davy
0
520
false
1
1
Packaging script source files in IronPython and IronRuby
933,988
2
3
0
1
3
0
0.066568
0
Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resources?
0
c#,python,ruby,ironpython,ironruby
2009-06-01T07:14:00.000
0
933,822
You could add custom import hook that looks for embedded resources when an import is executed. This is slightly complex and probably not worth the trouble. A better technique would be to fetch all of the embedded modules at startup time, execute them with the ScriptEngine and put the modules you have created into the sys.modules dictionary associated with the engine. This automatically makes them available for import by Python code executed by the engine.
0
520
false
1
1
Packaging script source files in IronPython and IronRuby
934,609
2
2
0
1
4
0
0.099668
0
There seem to be a few good pure Python SSH2 client implementations out there, but I haven't been able to find one for SSH1. Is there some specific reason for this other than lack of interest in such a project? I am fully aware of the many SSH1 vulnerabilities, but a pure Python SSH1 client implementation would still be very useful to those of us who want to write SSH clients to manage older embedded devices which only support SSH1 (Cisco PIX for example). I also know I'm not the only person looking for this. The reason I'm asking is because I'm bored, and I've been thinking about taking a stab at writing this myself. I've just been hesitant to start, since I know there are a lot of people out there who are much smarter than me, and I figured there might be some reason why nobody has done it yet.
0
python,ssh
2009-06-01T21:06:00.000
1
936,783
Well, the main reason probably was that when people started getting interested in such things in VHLLs such as Python, it didn't make sense to them to implement a standard which they themselves would not find useful. I am not familiar with the protocol differences, but would it be possible for you to adapt an existing codebase to the older protocol?
0
1,865
false
0
1
Why no pure Python SSH1 (version 1) client implementations?
936,816
2
2
0
3
4
0
1.2
0
There seem to be a few good pure Python SSH2 client implementations out there, but I haven't been able to find one for SSH1. Is there some specific reason for this other than lack of interest in such a project? I am fully aware of the many SSH1 vulnerabilities, but a pure Python SSH1 client implementation would still be very useful to those of us who want to write SSH clients to manage older embedded devices which only support SSH1 (Cisco PIX for example). I also know I'm not the only person looking for this. The reason I'm asking is because I'm bored, and I've been thinking about taking a stab at writing this myself. I've just been hesitant to start, since I know there are a lot of people out there who are much smarter than me, and I figured there might be some reason why nobody has done it yet.
0
python,ssh
2009-06-01T21:06:00.000
1
936,783
SSHv1 was considered deprecated in 2001, so I assume nobody really wanted to put the effort into it. I'm not sure if there's even an rfc for SSH1, so getting the full protocol spec may require reading through old source code. Since there are known vulnerabilities, it's not much better than telnet, which is almost universally supported on old and/or embedded devices.
0
1,865
true
0
1
Why no pure Python SSH1 (version 1) client implementations?
940,483
1
6
0
9
8
0
1.2
0
I'm looking for a free library for python that can calculate your direction and your speed from GPS coordinates and maybe can calculate if you are in some boundaries or things like this. Are there Libraries that you know and that worked well for you? We are using python on a linux machine and getting the data from the gpsd. So I hope there is no need for a speciel library for only talking to the device. What I'm looking for is python code doing some basic calculations with the data. Such as comparing the last positions and calculate speed and direction.
0
python,gps,gpsd
2009-06-05T00:01:00.000
0
953,701
Apparently the python module that comes with gpsd is the best module to go with for us. The gps module coming with the gpsd has some very useful functions. The first one is getting the data from gpsd and transforming those data in a usable data structure. Then the moduls give you access to your speed, and your current heading relative to north. Also included is a function for calculating the distance between two coordinates on the earth taking the spherical nature of earth into account. The functions that are missing for our special case are: Calculating the heading between to points. Means I am at point a facing north to which degree do I have to turn to face the point I want to navigate to. Taking the data of the first function and our current heading to calculate a turn in degrees that we have to do to face a desired point (not a big deal because it is mostly only a subtraction) The biggest problem for working with this library is that it is mostly a wrapper for the gpsd so if you are programming on a different OS then you gpscode should work on like Windows or MacOS you are not able to run the code or to install the module.
0
32,709
true
0
1
Which gps library would you recommend for python?
973,022
1
2
0
11
11
0
1.2
0
I have been in love with zsh for a long time, and more recently I have been discovering the advantages of the ipython interactive interpreter over python itself. Being able to cd, to ls, to run or to ! is indeed very handy. But now it feels weird to have such a clumsy shell when in ipython, and I wonder how I could integrate my zsh and my ipython better. Of course, I could rewrite my .zshrc and all my scripts in python, and emulate most of my shell world from ipython, but it doesn't feel right. And I am obviously not ready to use ipython as a main shell anyway. So, here comes my question: how do you work efficiently between your shell and your python command-loop ? Am I missing some obvious integration strategy ? Should I do all that in emacs ?
0
python,shell,zsh,ipython
2009-06-10T03:11:00.000
1
973,520
I asked this question on the zsh list and this answer worked for me. YMMV. In genutils.py after the line if not debug: Remove the line: stat = os.system(cmd) Replace it with: stat = subprocess.call(cmd,shell=True,executable='/bin/zsh') you see, the problem is that that "!" call uses os.system to run it, which defaults to manky old /bin/sh . Like I said, it worked for me, although I'm not sure what got borked behind the scenes.
0
8,591
true
0
1
how to integrate ZSH and (i)python?
1,070,597
11
13
1
13
19
1
1
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
I've heard these complaints before about C++, but the fact is, programming in any language with which you are unfamiliar is time consuming. A good C++ programmer can probably crank out the app much faster than an okay Python programmer and visa versa. I think C++ often gets a bad reputation because it allows you get much lower level - pointers, memory management, etc, and if you aren't used to thinking about such things, it can take a bit of time. If you are used to working in that environment, it can become second nature. Unless choice of language is something imposed upon you by your company, team, client, etc. I usually recommend that folks go with the language they are most comfortable with OR most interested in learning more about. If speed is the issue you are concerned with, look at the learning curve for each language and your past experience. C++ tends to have a higher learning curve, but that too depends on the person. Kindof a non-answer I know.
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
977,443
11
13
1
24
19
1
1
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
There are two things that are relevant between C++ and Python that will affect your time-to-develop any project including a game. There are the languages themselves and the libraries. I've played with the SDL to some extent and peeked at PyGame and for your specific instance I don't think the libraries are going to be much of a factor. So I'll focus on the languages themselves. Python is a dynamically-typed, garbage-collected language. C++ is a statically-typed, non-garbage-collected language. What this means is that in C++ a lot of your development time will be spent managing memory and dealing with your type structure. This affords you a lot of power, but the question is do you really need it? If you're looking to write a simple game with some basic graphics and some good gameplay, then I don't think you truly need all the power that C++ will give you. If you're looking to write something that will push the envelope, be the next A-list game, be the next MMO, fit on a console or a handheld device, then you will likely need the power that C++ affords.
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
977,451
11
13
1
2
19
1
0.03076
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
It's time consuming because in C++ you have to deal with more low-level tasks. In Python you are free to focus on the development of the actual game instead of dealing with memory management etc.
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
977,412
11
13
1
0
19
1
0
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
Some people would argue that development time is slower in C++ when compared to Python. Wouldn't it be the case that the time you saved in developing an application (or game) in python is the time you gonna use in improving performance after its developed? and in the later part when you have least options left? It largely depends upon the purpose for which you are going to develop the application. If you are thinking for an enterprise application in which case it is going to be hit by millions (web-app) or an application with focus on low-footprint, faster loading into memory, faster execution, then your choice is C++. If you are projecting your application for not being use at this level, surely Python is the choice to go for. Maintainability is considerable, but disciplined code can overcome this. Largely depends upon long term projections. On how serious and critical the application is going to be.
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
4,546,946
11
13
1
0
19
1
0
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
Why limit yourself to those two options? With C# or Java you get access to a huge collection of useful libraries plus garbage collection and (in the case of C#) JIT compiling. Furthermore, you're saying that you're looking to do game development, but from your task description it sounds like you're also looking at coding your own engine. Is that part of the exercise? Otherwise you should definitely take a look at the available Indie engines out there - lots are cheap of not free and open source. Needless to say, working from an existing engine is definitely faster than going from scratch :)
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
1,079,100
11
13
1
2
19
1
0.03076
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
It takes about the same amount of time to write the same code in pretty much all of the high level languages. The win is that in certain languages it is easier to use other peoples code. In a lot of Python/Ruby/Perl apps, you write 10% of the code and import libraries to do the other 90%. That is harder in C/C++ since the libraries have different interfaces and other incompatibilities. C++ vs Python is a pretty personal choice. Personally I feel I lose more time with not having the C/Java class system (more run time errors/debugging time, don't have anywhere near as good auto completion, need to do more documentation and optimization) than I gain (not having to write interfaces/stub function and being able to worry less about memory managment). Other people feel the exact opposite. In the end it probably depends on the type of game. If your processor intensive go to C++ (maybe with a scripting language if it makes sense). Otherwise use whatever language you prefer
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
1,009,820
11
13
1
3
19
1
0.046121
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
Python has some big advantages over programming languages like C++. I myself have programmed a lot with C++, C and other programming languages. Lately I am also programming in Python and I got to like it very much! You can have a quick start with Python. Since it is rather simple to learn (at least with some programming experience and enough abstract thinking), you can have fast successes. Also the script-like behaviour makes starting easy and it is also possible, to quickly test some things in the integrated shell. This can also be good for debugging. The whole language is packed with powerful features and it has a good and rather complete set of libraries. There was the argument that with the "right library" you can develop as quickly with C++ as with Python. This might (partly) be, but I myself have never experienced it, because such libraries are rare. I had also a big library at hand, but still lacked many valuable features in C++. The so called "standard template library" STL makes things even worse in my opinion. It is a really powerful library. But it is also that complex, that it adds the complexity of an additional programming language to C++. I really disliked it and in a company I worked in, much worktime was lost, because the compiler was not able to give useful error-output in case of errors in the STL. Python is different. Instead of putting the "speed of the programm" on the throne -- sacrificing all else (as C++ and especially the STL does) -- it puts "speed of development" first. The language gives you a powerful toolkit and it is accompanied by a huge library. When you need speed, you can also implement time critical things in C or C++ and call it from Python. There is also at least one big online Game implemented in Python.
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
986,810
11
13
1
0
19
1
0
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
Do you have any programming experience at all? If not, I would start with Python which is easier to learn, even if it is not a better tool for game development. If you decide you want to program games for living, you'll probably need to switch to C++ at some point.
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
977,759
11
13
1
0
19
1
0
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
Short Answer Yes python is faster in terms of development time. There are many case studies in real life that show this. However, you don't want to do a 3d graphics engine in Python.
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
977,460
11
13
1
0
19
1
0
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
I'd focus more on choosing a framework to build your game on than trying to pick a language. Unless the goal is to learn how games work inside and out, you're going to want to use a framework. Try out a couple, and pick the one that meets your requirements and feels nice to you. Once you've picked the framework, the language choice becomes easy - use the language for which the framework is written. There are many options for game frameworks in C++ - pygame works for python. There are many that work with other languages/tools as well (including .NET, Lua, etc.)
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
977,452
11
13
1
2
19
1
0.03076
0
I'm thinking of trying to make some simple 2d games, but I've yet to choose a language. A lot of people recommend either C++ with SDL or python with pygame. I keep hearing that developement on C++ is fairly slow, and developement time with Python is fairly fast. Anyways, could anyone elaborate on this? What exactly makes development in C++ so time consuming? The programs I've made have been Project Euler-style in that they're very short and math-based, so I have no experience in larger projects.
0
c++,python
2009-06-10T18:33:00.000
0
977,404
there are many things that make c++ longer to develop in. Its lower level, has pointers, different libraries for different systems, the type system, and there are others I am sure I am missing.
0
5,902
false
0
1
C++ slow, python fast? (in terms of development time)
977,414
2
5
0
1
2
1
0.039979
0
I am kind of hitting a wall on this problem and I was wondering if some fresh brains could help me out. I have a large list of four element tuples in the format: (ID number, Type, Start Index, End Index) Previously in the code, I have searched through thousands of blocks of text for two specific types of substrings. These tuples store in which large chunk of text the substring was found, which of the two types of substrings it is, and the start and end index of this substring. The final goal is to look through this list to find all instances where a type 1 substring occurs before a type 2 substring in a block of text with the same ID. Then I would like to store these objects in the format (ID, Type 1, Start, End, Type2, Start, End). I've tried to mess around with a bunch of stuff that was super inefficient. I have the list sorted by ID then Start Index, and if been trying varying ways of popping the items off the list for comparisons. I have to imagine there is a more elegant solution. Any brilliant people out there wish to assist my tired brain??? Thanks in advance
0
python,algorithm,list,tuples
2009-06-12T18:47:00.000
0
988,346
I don't know how many types you have. But If we assume you have only type 1 and type 2, then it sounds like a problem similar to a merge sort. Doing it with a merge sort, you make a single pass through the list. Take two indexes, one for type 1 and one for type 2 (I1, I2). Sort the list by id, start1. Start I1 as the first instance of type1, and I2 as zero. If I1.id < I2.Id then increment I1. If I2.id < I1.id then increment I2. If I1.id = I2.id then check iStart. I1 can only stop on a type one record and I2 can only stop on a type 2 record. Keep incrementing the index till it lands on an appropriate record. You can make some assumptions to make this faster. When you find an block that succeeds, you can move I1 to the next block. Whenever I2 < I1, you can start I2 at I1 + 1 (WOOPS MAKE SURE YOU DONT DO THIS, BECAUSE YOU WOULD MISS THE FAILURE CASE!) Whenever you detect an obvious failure case, move I1 and I2 to the next block (on appropriate recs of course).
0
551
false
0
1
Efficient Tuple List Comparisons
988,462
2
5
0
0
2
1
0
0
I am kind of hitting a wall on this problem and I was wondering if some fresh brains could help me out. I have a large list of four element tuples in the format: (ID number, Type, Start Index, End Index) Previously in the code, I have searched through thousands of blocks of text for two specific types of substrings. These tuples store in which large chunk of text the substring was found, which of the two types of substrings it is, and the start and end index of this substring. The final goal is to look through this list to find all instances where a type 1 substring occurs before a type 2 substring in a block of text with the same ID. Then I would like to store these objects in the format (ID, Type 1, Start, End, Type2, Start, End). I've tried to mess around with a bunch of stuff that was super inefficient. I have the list sorted by ID then Start Index, and if been trying varying ways of popping the items off the list for comparisons. I have to imagine there is a more elegant solution. Any brilliant people out there wish to assist my tired brain??? Thanks in advance
0
python,algorithm,list,tuples
2009-06-12T18:47:00.000
0
988,346
Assuming there are lots of entries for each ID, I would (pseudo-code) for each ID: for each type2 substring of that ID: store it in an ordered list, sorted by start point for each type1 substring of that ID: calculate the end point (or whatever) look it up in the ordered list if there's anything to the right, you have a hit So, if you have control of the initial sort, then instead of (ID, start), you want them sorted by ID, then by type (2 before 1). Then within the type, sort by start point for type2, and the offset you're going to compare for type1. I'm not sure whether by "A before B" you mean "A starts before B starts" or "A ends before B starts", but do whatever's appropriate. Then you can do the whole operation by running over the list once. You don't need to actually construct an index of type2s, because they're already in order. Since the type1s are sorted too, you can do each lookup with a linear or binary search starting from the result of the previous search. Use a linear search if there are lots of type1s compared with type2s (so results are close together), and a binary search if there are lots of type2s compared with type1s (so results are sparse). Or just stick with the linear search as it's simpler - this lookup is the inner loop, but its performance might not be critical. If you don't have control of the sort, then I don't know whether it's faster to build the list of type2 substrings for each ID as you go; or to sort the entire list before you start into the required order; or just to work with what you've got, by writing a "lookup" that ignores the type1 entries when searching through the type2s (which are already sorted as required). Test it, or just do whatever results in clearer code. Even without re-sorting, you can still use the merge-style optimisation unless "sorted by start index" is the wrong thing for the type1s.
0
551
false
0
1
Efficient Tuple List Comparisons
988,650
1
3
0
5
7
0
1.2
0
First, my question is not about password hashing, but password encryption. I'm building a desktop application that needs to authentificate the user to a third party service. To speed up the login process, I want to give the user the option to save his credentials. Since I need the password to authentificate him to the service, it can't be hashed. I thought of using the pyCrypto module and its Blowfish or AES implementation to encrypt the credentials. The problem is where to store the key. I know some applications store the key directly in the source code, but since I am coding an open source application, this doesn't seem like a very efficient solution. So I was wondering how, on Linux, you would implement user specific or system specific keys to increase password storing security. If you have a better solution to this problem than using pyCrypto and system/user specific keys, don't hesitate to share it. As I said before, hashing is not a solution and I know password encryption is vulnerable, but I want to give the option to the user. Using Gnome-Keyring is not an option either, since a lot of people (including myself) don't use it.
0
python,linux,encryption,passwords
2009-06-16T14:09:00.000
1
1,001,744
Encrypting the passwords doesn't really buy you a whole lot more protection than storing in plaintext. Anyone capable of accessing the database probably also has full access to your webserver machines. However, if the loss of security is acceptable, and you really need this, I'd generate a new keyfile (from a good source of random data) as part of the installation process and use this. Obviously store this key as securely as possible (locked down file permissions etc). Using a single key embedded in the source is not a good idea - there's no reason why seperate installations should have the same keys.
0
2,912
true
0
1
How To Reversibly Store Password With Python On Linux?
1,001,833
1
7
0
0
1
0
0
0
I want to be able to execute openssh with some custom arguments and then be able to automatically login to the server. I want that my script will enter the password if needed and inject 'yes' if I'm prompted to add the fingerprint to the known hosts. I've found SharpSsh for C# that do that, but I also need to use -D parameter and use ProxyCommand that I define in SSH, and the library is quite lacking for that usage. Another thing that I've found was pexcept for Python that should do the trick but I couldn't find where to download it, on the offical page I'm being redirectred from sourceforge to some broken link. Any help would be appreciated, Bill.
0
c#,python,windows,ssh
2009-06-16T16:34:00.000
1
1,002,627
pexpect can't import on Windows. So, I use plink.exe with a Python subprocess to connect to the ssh server.
0
3,061
false
0
1
Automate SSH login under windows
11,246,704
1
6
0
1
7
0
0.033321
0
In a POSIX system, I want to see if a given process (PID 4356, for example) is running. It would be even better if I could get metadata about that process.
0
python,posix
2009-06-17T09:12:00.000
1
1,005,972
Look at /proc/pid. This exists only of the process is running, and contains lots of information.
0
2,206
false
0
1
What is the easiest way to see if a process with a given pid exists in Python?
1,006,030
1
5
0
3
5
1
0.119427
0
I manage the testing for a very large financial pricing system. Recently our HQ have insisted that we verify that every single part of our project has a meaningful test in place. At the very least they want a system which guarantees that when we change something we can spot unintentional changes to other sub-systems. Preferably they want something which validates the correctness of every component in our system. That's obviously going to be quite a lot of work! It could take years, but for this kind of project it's worth it. I need to find out which parts of our code are not covered by any of our unit-tests. If I knew which parts of my system were untested then I could set about developing new tests which would eventually approach towards my goal of complete test-coverage. So how can I go about running this kind of analysis. What tools are available to me? I use Python 2.4 on Windows 32bit XP UPDATE0: Just to clarify: We have a very comprehensive unit-test suite (plus a seperate and very comprehensive regtest suite which is outside the scope of this exercise). We also have a very stable continuous integration platform (built with Hudson) which is designed to split-up and run standard python unit-tests across our test facility: Approx 20 PCs built to the company spec. The object of this exercise is to plug any gaps in our python unittest suite (only) suite so that every component has some degree of unittest coverage. Other developers will be taking responsibility for non Python components of the project (which are also outside of scope). "Component" is intentionally vague: Sometime it will be a class, other time an entire module or assembly of modules. It might even refer to a single financial concept (e.g. a single type of financial option or a financial model used by many types of option). This cake can be cut in many ways. "Meaningful" tests (to me) are ones which validate that the function does what the developer originally intended. We do not want to simply reproduce the regtests in pure python. Often the developer's intent is not immediatly obvious, hence the need to research and clarify anything which looks vague and then enshrine this knowledge in a unit-test which makes the original intent quite explicit.
0
python,testing
2009-06-17T10:20:00.000
0
1,006,189
"every single part of our project has a meaningful test in place" "Part" is undefined. "Meaningful" is undefined. That's okay, however, since it gets better further on. "validates the correctness of every component in our system" "Component" is undefined. But correctness is defined, and we can assign a number of alternatives to component. You only mention Python, so I'll assume the entire project is pure Python. Validates the correctness of every module. Validates the correctness of every class of every module. Validates the correctness of every method of every class of every module. You haven't asked about line of code coverage or logic path coverage, which is a good thing. That way lies madness. "guarantees that when we change something we can spot unintentional changes to other sub-systems" This is regression testing. That's a logical consequence of any unit testing discipline. Here's what you can do. Enumerate every module. Create a unittest for that module that is just a unittest.main(). This should be quick -- a few days at most. Write a nice top-level unittest script that uses a testLoader to all unit tests in your tests directory and runs them through the text runner. At this point, you'll have a lot of files -- one per module -- but no actual test cases. Getting the testloader and the top-level script to work will take a few days. It's important to have this overall harness working. Prioritize your modules. A good rule is "most heavily reused". Another rule is "highest risk from failure". Another rule is "most bugs reported". This takes a few hours. Start at the top of the list. Write a TestCase per class with no real methods or anything. Just a framework. This takes a few days at most. Be sure the docstring for each TestCase positively identifies the Module and Class under test and the status of the test code. You can use these docstrings to determine test coverage. At this point you'll have two parallel tracks. You have to actually design and implement the tests. Depending on the class under test, you may have to build test databases, mock objects, all kinds of supporting material. Testing Rework. Starting with your highest priority untested module, start filling in the TestCases for each class in each module. New Development. For every code change, a unittest.TestCase must be created for the class being changed. The test code follows the same rules as any other code. Everything is checked in at the end of the day. It has to run -- even if the tests don't all pass. Give the test script to the product manager (not the QA manager, the actual product manager who is responsible for shipping product to customers) and make sure they run the script every day and find out why it didn't run or why tests are failing. The actual running of the master test script is not a QA job -- it's everyone's job. Every manager at every level of the organization has to be part of the daily build script output. All of their jobs have to depend on "all tests passed last night". Otherwise, the product manager will simply pull resources away from testing and you'll have nothing.
0
3,113
false
0
1
How to do a meaningful code-coverage analysis of my unit-tests?
1,006,454
2
3
1
0
1
0
0
0
Can anyone tell me if its possible to redeclare a C# class in IronPython? If I have a C# class, would I be able to monkey-patch it from IronPython?
0
c#,ironpython,monkeypatching
2009-06-17T18:08:00.000
0
1,008,686
You can monkey-patch from IronPython, but IPy is the only environment that will respect your changes; i.e. if you tried to mock out File.Create from IronPython, this would work fine for any IPy code, but if you called a C# method which called File.Create, it would get the real one, not the mock.
0
324
false
1
1
Redeclare .net classes in IronPython
1,040,151
2
3
1
0
1
0
1.2
0
Can anyone tell me if its possible to redeclare a C# class in IronPython? If I have a C# class, would I be able to monkey-patch it from IronPython?
0
c#,ironpython,monkeypatching
2009-06-17T18:08:00.000
0
1,008,686
You cannot monkey patch from IronPython. IronPython treats all .NET classes just like CPython treats built-in types: they cannot be monkey patched. IronRuby on the other hand does support this.
0
324
true
1
1
Redeclare .net classes in IronPython
3,155,159
1
3
0
0
3
0
1.2
1
I'm trying to use python to sftp a file, and the code works great in the interactive shell -- even pasting it in all at once. When I try to import the file (just to compile it), the code hangs with no exceptions or obvious errors. How do I get the code to compile, or does someone have working code that accomplishes sftp by some other method? This code hangs right at the ssh.connect() statement: """ ProblemDemo.py Chopped down from the paramiko demo file. This code works in the shell but hangs when I try to import it! """ from time import sleep import os import paramiko sOutputFilename = "redacted.htm" #-- The payload file hostname = "redacted.com" ####-- WARNING! Embedded passwords! Remove ASAP. sUsername = "redacted" sPassword = "redacted" sTargetDir = "redacted" #-- Get host key, if we know one. hostkeytype = None hostkey = None host_keys = {} try: host_keys = paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts')) except IOError: try: # try ~/ssh/ too, because windows can't have a folder named ~/.ssh/ host_keys = paramiko.util.load_host_keys(os.path.expanduser('~/ssh/known_hosts')) except IOError: print '*** Unable to open host keys file' host_keys = {} if host_keys.has_key(hostname): hostkeytype = host_keys[hostname].keys()[0] hostkey = host_keys[hostname][hostkeytype] print 'Using host key of type %s' % hostkeytype ssh = paramiko.Transport((hostname, 22)) ssh.connect(username=sUsername, password=sPassword, hostkey=hostkey) sftp = paramiko.SFTPClient.from_transport(ssh) sftp.chdir (sTargetDir) sftp.put (sOutputFilename, sOutputFilename) ssh.close()
0
python,shell,compilation,sftp
2009-06-18T14:45:00.000
0
1,013,064
Weirdness aside, I was just using import to compile the code. Turning the script into a function seems like an unnecessary complication for this kind of application. Searched for alternate means to compile and found: import py_compile py_compile.compile("ProblemDemo.py") This generated a pyc file that works as intended. So the lesson learned is that import is not a robust way to compile python scripts.
0
6,518
true
0
1
Why does this python code hang on import/compile but work in the shell?
1,013,366
2
4
0
8
6
1
1.2
0
I am learning Python because it appeals to me as a mathematician but also has many useful libraries for scientific computing, image processing, web apps, etc etc. It is frustrating to me that for certain of my interests (eletronic music or installation art) there are very specific programming languages which seem better suited to these purposes, such as Max/MSP, PureData, and ChucK -- all quite fascinating. My question is, how should one approach these different languages? Should I simply learn Python and manage the others by using plugins and Python interpreters in them? Are there good tools for integrating the languages, or is the proper way simply to learn all of them?
0
python,chuck,puredata
2009-06-19T04:04:00.000
0
1,016,301
I would say learn them all. While it's true that many languages can do many things, specialised languages are usually more expressive and easier to use for a particular task. Case-in-point is while most languages allow shell interaction and process control very few are as well suited to the task as bash scripts. Plugins and libraries can bridge the gap between general and specialised languages but in my experience this is not always without drawbacks - be they speed, stability or complexity. It isn't uncommon to have to compile additional libraries or apply patches or use untrusted and poorly supported modules. It also isn't uncommon that the resulting interface is still harder to use than the original language. I know about 15 languages well and a few of those very well. I do not use my prefered languages when another is more suitable.
0
1,140
true
0
1
Synthesis of general programming language (Python) with tailored language (PureData/MaxMSP/ChucK)
1,016,318
2
4
0
4
6
1
0.197375
0
I am learning Python because it appeals to me as a mathematician but also has many useful libraries for scientific computing, image processing, web apps, etc etc. It is frustrating to me that for certain of my interests (eletronic music or installation art) there are very specific programming languages which seem better suited to these purposes, such as Max/MSP, PureData, and ChucK -- all quite fascinating. My question is, how should one approach these different languages? Should I simply learn Python and manage the others by using plugins and Python interpreters in them? Are there good tools for integrating the languages, or is the proper way simply to learn all of them?
0
python,chuck,puredata
2009-06-19T04:04:00.000
0
1,016,301
This thread is a little old, but I wanted to point out that the majority of the mature audio development environments e.g. supercollider/max-msp/pure data can be controlled via open sound control. You can google up a better description of OSC, but suffice it to say that it allows you to send control data to synths built in these environments similar to how MIDI works, but way more extensive. This does not solve the problem of actually building synths in python per se but it allows you to "drive" these other environments without having to know the ins and outs of the language.
0
1,140
false
0
1
Synthesis of general programming language (Python) with tailored language (PureData/MaxMSP/ChucK)
1,716,786
1
1
0
3
6
0
1.2
1
I'm trying to build some statistics for an email group I participate. Is there any Python API to access the email data on a GoogleGroup? Also, I know some statistics are available on the group's main page. I'm looking for something more complex than what is shown there.
0
python,google-groups
2009-06-19T12:48:00.000
0
1,017,794
There isn't an API that I know of, however you can access the XML feed and manipulate it as required.
0
1,163
true
0
1
Is there an API to access a Google Group data?
1,017,810
3
12
0
0
16
0
0
0
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications. So I need to create some kind of sandbox for the apps. At the most basic level, I'd like to restrict access to the file system to some specified directories. I cannot use chroot jails directly, since the web app is not running as a privileged user. I guess a suid executable which sets up the jail would be an option. The uploaded programs would be rather small, so they should execute quickly (a couple of seconds at most). Hence, I can kill the process after a preset timeout, but how do I ensure that it doesn't spawn new processes? Or if I can't, is killing the entire pgid a reliable method? What would be the best way to go about this - other than "don't do it at all"? :) What other glaring security problems have I missed? FWIW, the web app will be written in Python.
0
python,c,linux,security,sandbox
2009-06-19T19:35:00.000
1
1,019,707
I think your solutions must concentrate on analyzing the source code. I don't know any tools, and I think this would be pretty hard with C, but, for example, a Pascal program which doesn't include any modules would be pretty harmless in my opinion.
0
7,104
false
1
1
Sandboxing in Linux
1,029,301
3
12
0
-2
16
0
-0.033321
0
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications. So I need to create some kind of sandbox for the apps. At the most basic level, I'd like to restrict access to the file system to some specified directories. I cannot use chroot jails directly, since the web app is not running as a privileged user. I guess a suid executable which sets up the jail would be an option. The uploaded programs would be rather small, so they should execute quickly (a couple of seconds at most). Hence, I can kill the process after a preset timeout, but how do I ensure that it doesn't spawn new processes? Or if I can't, is killing the entire pgid a reliable method? What would be the best way to go about this - other than "don't do it at all"? :) What other glaring security problems have I missed? FWIW, the web app will be written in Python.
0
python,c,linux,security,sandbox
2009-06-19T19:35:00.000
1
1,019,707
About the only chance you have is running a VirtualMachine and those can have vulnerabilities. If you want your machine hacked in the short term just use permissions and make a special user with access to maybe one directory. If you want to postpone the hacking to some point in the future then run a webserver inside a virtual machine and port forward to that. You'll want to keep a backup of that because you'll probably have that hacked in under an hour and want to restart a fresh copy every few hours. You'll also want to keep an image of the whole machine to just reimage the whole thing once a week or so in order to overcome the weekly hackings. Don't let that machine talk to any other machine on your network. Blacklist it everywhere. I'm talking about the virtual machine and the physical machine IP addresses. Do regular security audits on any other machines on your other machines on the network. Please rename the machines IHaveBeenHacked1 and IHaveBeenHacked2 and prevent access to those in your hosts lists and firewalls. This way you might stave off your level of hackage for a while.
0
7,104
false
1
1
Sandboxing in Linux
1,019,986
3
12
0
0
16
0
0
0
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications. So I need to create some kind of sandbox for the apps. At the most basic level, I'd like to restrict access to the file system to some specified directories. I cannot use chroot jails directly, since the web app is not running as a privileged user. I guess a suid executable which sets up the jail would be an option. The uploaded programs would be rather small, so they should execute quickly (a couple of seconds at most). Hence, I can kill the process after a preset timeout, but how do I ensure that it doesn't spawn new processes? Or if I can't, is killing the entire pgid a reliable method? What would be the best way to go about this - other than "don't do it at all"? :) What other glaring security problems have I missed? FWIW, the web app will be written in Python.
0
python,c,linux,security,sandbox
2009-06-19T19:35:00.000
1
1,019,707
Spawning a new VM under KVM or qemu to compile and run the code looks like the way to go. Running the code under jail/LXC can compromise the machine if it exploits the unsecured parts of the OS like networking code. Advantage of running under a VM are obvious. One can only hack the VM but not the machine itself. But the side effect is you need lots of resources (CPU and Memory) to spawn a VM for each request.
0
7,104
false
1
1
Sandboxing in Linux
15,609,095
3
5
0
2
14
1
0.07983
0
My background is C and C++. I like Python a lot, but there's one aspect of it (and other interpreted languages I guess) that is really hard to work with when you're used to compiled languages. When I've written something in Python and come to the point where I can run it, there's still no guarantee that no language-specific errors remain. For me that means that I can't rely solely on my runtime defense (rigorous testing of input, asserts etc.) to avoid crashes, because in 6 months when some otherwise nice code finally gets run, it might crack due to some stupid typo. Clearly a system should be tested enough to make sure all code has been run, but most of the time I use Python for in-house scripts and small tools, which ofcourse never gets the QA attention they need. Also, some code is so simple that (if your background is C/C++) you know it will work fine as long as it compiles (e.g. getter-methods inside classes, usually a simple return of a member variable). So, my question is the obvious - is there any way (with a special tool or something) I can make sure all the code in my Python script will "compile" and run?
0
python,parsing,code-analysis
2009-06-22T12:36:00.000
0
1,026,966
Others have mentioned tools like PyLint which are pretty good, but the long and the short of it is that it's simply not possible to do 100%. In fact, you might not even want to do it. Part of the benefit to Python's dynamicity is that you can do crazy things like insert names into the local scope through a dictionary access. What it comes down to is that if you want a way to catch type errors at compile time, you shouldn't use Python. A language choice always involves a set of trade-offs. If you choose Python over C, just be aware that you're trading a strong type system for faster development, better string manipulation, etc.
0
1,051
false
0
1
How can I make sure all my Python code "compiles"?
1,061,573
3
5
0
1
14
1
0.039979
0
My background is C and C++. I like Python a lot, but there's one aspect of it (and other interpreted languages I guess) that is really hard to work with when you're used to compiled languages. When I've written something in Python and come to the point where I can run it, there's still no guarantee that no language-specific errors remain. For me that means that I can't rely solely on my runtime defense (rigorous testing of input, asserts etc.) to avoid crashes, because in 6 months when some otherwise nice code finally gets run, it might crack due to some stupid typo. Clearly a system should be tested enough to make sure all code has been run, but most of the time I use Python for in-house scripts and small tools, which ofcourse never gets the QA attention they need. Also, some code is so simple that (if your background is C/C++) you know it will work fine as long as it compiles (e.g. getter-methods inside classes, usually a simple return of a member variable). So, my question is the obvious - is there any way (with a special tool or something) I can make sure all the code in my Python script will "compile" and run?
0
python,parsing,code-analysis
2009-06-22T12:36:00.000
0
1,026,966
I think what you are looking for is code test line coverage. You want to add tests to your script that will make sure all of your lines of code, or as many as you have time to, get tested. Testing is a great deal of work, but if you want the kind of assurance you are asking for, there is no free lunch, sorry :( .
0
1,051
false
0
1
How can I make sure all my Python code "compiles"?
1,026,984
3
5
0
0
14
1
0
0
My background is C and C++. I like Python a lot, but there's one aspect of it (and other interpreted languages I guess) that is really hard to work with when you're used to compiled languages. When I've written something in Python and come to the point where I can run it, there's still no guarantee that no language-specific errors remain. For me that means that I can't rely solely on my runtime defense (rigorous testing of input, asserts etc.) to avoid crashes, because in 6 months when some otherwise nice code finally gets run, it might crack due to some stupid typo. Clearly a system should be tested enough to make sure all code has been run, but most of the time I use Python for in-house scripts and small tools, which ofcourse never gets the QA attention they need. Also, some code is so simple that (if your background is C/C++) you know it will work fine as long as it compiles (e.g. getter-methods inside classes, usually a simple return of a member variable). So, my question is the obvious - is there any way (with a special tool or something) I can make sure all the code in my Python script will "compile" and run?
0
python,parsing,code-analysis
2009-06-22T12:36:00.000
0
1,026,966
Your code actually gets compiled when you run it, the Python runtime will complain if there is a syntax error in the code. Compared to statically compiled languages like C/C++ or Java, it does not check whether variable names and types are correct – for that you need to actually run the code (e.g. with automated tests).
0
1,051
false
0
1
How can I make sure all my Python code "compiles"?
1,027,032
1
3
0
5
6
0
1.2
0
Firstly, what is the best/simplest way to detect if X11 is running and available for a python script. parent process? session leader? X environment variables? other? Secondly, I would like to have a utility (python script) to present a gui if available, otherwise use a command line backed tool. Off the top of my head I thought of this -main python script (detects if gui is available and launches appropriate script) -gui or command line python script starts -both use a generic module to do actual work I am very open to suggestions to simplify this.
0
python,user-interface
2009-06-22T15:38:00.000
0
1,027,894
You could simply launch the gui part, and catch the exception it raises when X (or any other platform dependent graphics system is not available. Make sure you really have an interactive terminal before running the text based part. Your process might have been started without a visible terminal, as is common in graphical user environments like KDE, gnome or windows.
0
3,965
true
0
1
Detect if X11 is available (python)
1,027,918
2
4
0
0
8
0
0
0
I have quite a few years experience of developing PHP web applications, and have recently started to delve into Python as well. Recently I've been interested in getting into desktop applications as well, but have absolutely no experience in that area. I've seen very little written about PHP-gtk and wonder whether it's really a good area to get stuck in to. What I'm really looking for is something that will allow me to quite quickly develop some decent small/medium sized apps, and be able to deploy them in Linux and Windows. Something in Python or PHP would be great (but I'd be happy to learn something else if it has big advantages). What do you guys recommend? Thanks
0
php,python,gtk,desktop,pygtk
2009-06-22T21:15:00.000
1
1,029,435
Why would you like to develop a desktop app in php?? Get yourself a descent programming environment (c/java/c#/) instead of abusing php especially with c# and java you get pretty quick very nice results. And both are cross platform (although java is easier for cross platform stuff). C(++) in combination with QT or GTK is also possible, but there the results appear slower
0
1,720
false
0
1
PHP desktop applications
1,029,459
2
4
0
2
8
0
0.099668
0
I have quite a few years experience of developing PHP web applications, and have recently started to delve into Python as well. Recently I've been interested in getting into desktop applications as well, but have absolutely no experience in that area. I've seen very little written about PHP-gtk and wonder whether it's really a good area to get stuck in to. What I'm really looking for is something that will allow me to quite quickly develop some decent small/medium sized apps, and be able to deploy them in Linux and Windows. Something in Python or PHP would be great (but I'd be happy to learn something else if it has big advantages). What do you guys recommend? Thanks
0
php,python,gtk,desktop,pygtk
2009-06-22T21:15:00.000
1
1,029,435
Python and Java are both excellent for working on both Linux and Windows environment. They are generally hassle-free as long as you're not doing any OS specific type of work. Python for creating desktop apps is fairly simple and easy to learn as well if you're coming from a PHP background, especially if you're used to doing object oriented PHP.
0
1,720
false
0
1
PHP desktop applications
1,029,486
1
4
0
5
5
1
0.244919
0
I am making a little webgame that has tasks and solutions, the solutions are solved by entering a code given to user after completion of a task. To have some security (against cheating) i dont want to store the codes genereted by the game in plain text. But since i need to be able to give a player the code when he has accomplished the task i cant hash it since then i cant retrive it. So what is the most secure way to encrypt/decrypt something using python?
0
python,security,encryption
2009-06-25T12:52:00.000
0
1,043,735
The most secure encryption is no encryption. Passwords should be reduced to a hash. This is a one-way transformation, making the password (almost) unrecoverable. When giving someone a code, you can do the following to be actually secure. (1) generate some random string. (2) give them the string. (3) save the hash of the string you generated. Once. If they "forget" the code, you have to (1) be sure they're authorized to be given the code, then (2) do the process again (generate a new code, give it to them, save the hash.)
0
4,268
false
0
1
What is the most secure python "password" encryption
1,043,762
2
3
0
1
2
0
0.066568
0
i am using Solaris 10 OS(x86). i installed beanstalkd and it starts fine by using command "beanstalkd -d -l hostip -p 11300". i have Python 2.4.4 on my system i installed YAML and beanstalkc python libraries to connect beanstalkd with python my problem is when i try to write some code: import beanstalkc beanstalk = beanstalkc.Connection(host='hostip', port=11300) no error so far but when i try to do someting on beanstalk like say listing queues. nothing happens. beanstalk.tubes() it just hangs and nothing returns. if i cancel the operation(using ctr+c on python env.) or stop the server i immediately see an output: Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 134, in tubes return self._interact_yaml('list-tubes\r\n', ['OK']) File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 83, in _interact_yaml size, = self._interact(command, expected_ok, expected_err) File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 57, in _interact status, results = self._read_response() File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 66, in _read_response response = self.socket_file.readline().split() File "/usr/lib/python2.4/socket.py", line 332, in readline data = self._sock.recv(self._rbufsize) any idea whats going? i am an Unix newbie so i have no idea what i did setup wrong to cause this. edit: seems like the problem lies within BeanStalkd itself, anyone have used this on Solaris 10? if so which version did you use? The v1.3 labeled one doesnt compile on Solaris while the latest from git code repository compiles it causes the above problem(or perhaps there is some configuration to do on Solaris?). edit2: i installed and compiled same components with beanstalkd, PyYAML, pythonbeanstalc and libevent to an UBUNTU machine and it works fine. problems seems to be about compilation of beanstalkd on solaris, i have yet to produce or read any solution.
0
python,solaris,yaml,beanstalkd
2009-06-25T15:06:00.000
1
1,044,473
After looking in the code (beanstalkc): your client has send his 'list-tubes' message, and is waiting for an answer. (until you kill it) your server doesn't answer or can't send the answer to the client. (or the answer is shorter than the client expect) is a network-admin at your side (or site) :-)
0
394
false
0
1
BeanStalkd on Solaris doesnt return anything when called from the python library
1,048,086
2
3
0
1
2
0
1.2
0
i am using Solaris 10 OS(x86). i installed beanstalkd and it starts fine by using command "beanstalkd -d -l hostip -p 11300". i have Python 2.4.4 on my system i installed YAML and beanstalkc python libraries to connect beanstalkd with python my problem is when i try to write some code: import beanstalkc beanstalk = beanstalkc.Connection(host='hostip', port=11300) no error so far but when i try to do someting on beanstalk like say listing queues. nothing happens. beanstalk.tubes() it just hangs and nothing returns. if i cancel the operation(using ctr+c on python env.) or stop the server i immediately see an output: Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 134, in tubes return self._interact_yaml('list-tubes\r\n', ['OK']) File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 83, in _interact_yaml size, = self._interact(command, expected_ok, expected_err) File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 57, in _interact status, results = self._read_response() File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 66, in _read_response response = self.socket_file.readline().split() File "/usr/lib/python2.4/socket.py", line 332, in readline data = self._sock.recv(self._rbufsize) any idea whats going? i am an Unix newbie so i have no idea what i did setup wrong to cause this. edit: seems like the problem lies within BeanStalkd itself, anyone have used this on Solaris 10? if so which version did you use? The v1.3 labeled one doesnt compile on Solaris while the latest from git code repository compiles it causes the above problem(or perhaps there is some configuration to do on Solaris?). edit2: i installed and compiled same components with beanstalkd, PyYAML, pythonbeanstalc and libevent to an UBUNTU machine and it works fine. problems seems to be about compilation of beanstalkd on solaris, i have yet to produce or read any solution.
0
python,solaris,yaml,beanstalkd
2009-06-25T15:06:00.000
1
1,044,473
I might know what is wrong: don't start it in daemon (-d) mode. I have experienced the same and by accident I found out what is wrong. Or rather, I don't know what is wrong, but it works without running it in daemon mode. ./beanstalkd -p 9977 & as an alternative.
0
394
true
0
1
BeanStalkd on Solaris doesnt return anything when called from the python library
1,093,128
12
12
0
1
4
1
0.016665
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
IF you are looking for reasons to convert them, I can think of a few. These don't necessarily mean you should, these are just possible reasons in the "recode" corner. Maintainability If you have a dev-shop that is primarily C# focused, then have python applications around may not be useful for maintainability reasons. It would mean that they need to keep python staffers around (assuming it's a complicated app) in order to maintain it. This probably isn't a restriction they want, especially if they don't intend to write anything in python from here on out. Consistency This sort of falls under maintainability, but it is of a different flavour. If they wanted to integrate part of this (python) application into a C# application, but not the whole thing, it's possible to write some boilerplate code, but again, that's messy to maintain. Ultimately, you would want to code of P_App to be able to be seamlessly integrated into C#_App, and not have to run them separately. On the other side of the coin, it is fair to point out that you are throwing time and money at converting something which already works.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,606
12
12
0
8
4
1
1
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
There's IronPython , a python implementation for .NET. You could port it to that if you really need to get away from the "standard" python vm and onto the .NET platform
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,361
12
12
0
-1
4
1
-0.016665
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
i will convert it from language a to language b for 1 million dollars. <--- this would be the only business reason I would consider legit.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,479
12
12
0
1
4
1
0.016665
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
Short and to the point answer: No, there is no reason.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,046,028
12
12
0
0
4
1
0
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
Some reasons that come to mind: Performance Easier to find developers Huge huge huge developer and tools ecosystem But I second what the others have stated: if it ain't broke, don't fix it. Unless your boss is saying, "hey, we're moving all our crap to .NET", or you're presented with some other business reason for migrating, just stick with what you've got.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,561
12
12
0
0
4
1
0
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
The only thing I can think of is the performance boost C# will give you.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,532
12
12
0
1
4
1
0.016665
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
As long as the application is running fine there is no reason to switch to C#.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,512
12
12
0
6
4
1
1
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
Leave them as Python unless you hear a very good business reason to convert.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,356
12
12
0
4
4
1
0.066568
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
Changing languages just for the sake of changing languages is rarely a good idea. If the app is doing its obj then let it do its job. If you've got a corporate mandate to only use C#, that may be a different story (estimate the work involved, give the estimate to management, let them decide to pursue it or write up an exception). Even if there isn't a strong (or any) knowledge of Python across the organization, developers are rather proficient at picking up new languages {it's a survival thing}, so that tends to be less of a concern. Moral of the story, if an app is to be rewritten, there should really be more of a justification to do the rewrite than just to change languages. If you were to add features that would be significantly easier to implement and maintain using another languages library/framework ... good justification. If maintaining the environment/framework for one language is causing a significant operational expense that could be saved by a re-write, cool. "Because our other code is in c#" ... not cool.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,446
12
12
0
1
4
1
0.016665
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
I would not convert unless you are converting as part of an enterprise-wide switch from one language to another. Even then I would avoid converting until absolutely necessary. If it works, why change it?
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,349
12
12
0
13
4
1
1.2
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
Quote: "If it doesn't break, don't fix it." Unless your company is moving towards .NET and/or there are no more qualified Python developer available anymore, then don't.
0
406
true
0
1
Is there any good reason to convert an app written in python to c#?
1,045,351
12
12
0
3
4
1
0.049958
0
I have written several Python tools for my company. Is there any good reason to convert them from Python to C# now that their usefulness has been proven? Would I be better off just leaving them in Python?
0
c#,.net,python
2009-06-25T17:59:00.000
0
1,045,334
If you're the only Python developer in a C# shop, then it makes plenty of sense to convert. If you quit tomorrow, no one will be able to maintain these systems.
0
406
false
0
1
Is there any good reason to convert an app written in python to c#?
1,045,378
9
11
0
3
6
0
0.054491
0
Let's say I'm programming in Java or Python or C++ for a simple problem, could be to build an TCP/UDP echo server or computation of factorial. Do I've to bother about the architecture details, i.e., if it is 32 or 64-bit? IMHO, unless I'm programming something to do with fairly low-level stuff then I don't have to bother if its 32 or 64 bit. Where am I going wrong? Or am I correct???
0
java,c++,python,64-bit,32-bit
2009-06-25T20:30:00.000
0
1,046,068
In Java and Python, architecture details are abstracted away so that it is in fact more or less impossible to write architecture-dependant code. With C++, this is an entirely different matter - you can certainly write code that does not depend on architecture details, but you have be careful to avoid pitfalls, specifically concerning basic data types that are are architecture-dependant, such as int.
0
1,267
false
0
1
Would one have to know the machine architecture to write code?
1,046,149