Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
3,847,202
2010-10-02T19:29:00.000
1
0
0
1
python,django,google-app-engine
14,967,904
4
false
1
0
I believe that Django is better because it gives more flexibility with features and also with hosts. Djangobook.com has a very good tutorial.
2
13
0
I've been learning Python and now I'd like to learn a Python-based web framework. I'm considering Google App Engine and Django. Which one should I choose? What are their unique features and learning curves?
Google App Engine or Django?
0.049958
0
0
5,657
3,847,803
2010-10-02T22:41:00.000
0
0
0
1
java,python,rest
3,881,996
1
false
1
0
Hmm, if you're into Python and open to a Java element, you might want to consider using the Java framework Restlet with Python code running in Jython. I'm a big fan of Restlet; its API embodies RESTful principles, so it encourages one to structure one's code and thinking according to those principles. It's also just a really high-quality, easy to use, well supported, and lightweight -- it's a framework, but in practice it can feel like a library. If you want to stick with pure Python, then I haven't been able to find any libraries or frameworks which directly embrace and encourage RESTful principles. However, there are some very good WSGI microframeworks which make it easy to implement RESTful applications -- you just need to devise your own approach to structuring your code -- not too big a deal. In particular I'd recommend Bottle and web.py, both of which can be used with more or less finagling with the excellent mimerender library for solid content negotiation.
1
1
0
I would like to build something like this Datastore | mycode.py | RESTful API | mywebapp.py(Django or Tornado) I checked Piston for Django but it seems that this way I am going to be tied to Django, I would rather have a RESTful API for mycode.py that is consumable by more than one REST client and also can consume it from a REST client api inside my django app. I checked stuff like Apache CFX, ApacheMQ, RabbitMQ, etc. with no real luck. Any thoughts? thnx
Deciding on RESTful Architecture for my Python code API
0
0
0
643
3,848,091
2010-10-03T00:41:00.000
6
0
1
0
python,set,iteration
3,848,337
7
false
0
0
The set's iteration order depends not only its contents, but on the order in which the items were inserted into the set, and whether there were deletions along the way. So you can create two different sets, using different insertions and deletions, and end up with the same set at the end, but with different iteration orders. As others have said: if you care about the order of the set, you have to create a sorted list from it.
4
33
0
Why does the iteration order of a Python set (with the same contents) vary from run to run, and what are my options for making it consistent from run to run? I understand that the iteration order for a Python set is arbitrary. If I put 'a', 'b', and 'c' into a set and then iterate them, they may come back out in any order. What I've observed is that the order remains the same within a run of the program. That is, if my program iterates the same set twice in a row, I get the same order both times. However, if I run the program twice in a row, the order changes from run to run. Unfortunately, this breaks one of my automated tests, which simply compares the output from two runs of my program. I don't care about the actual order, but I would like it to be consistent from run to run. The best solution I've come up with is: Copy the set to a list. Apply an arbitrary sort to the list. Iterate the list instead of the set. Is there a simpler solution? Note: I've found similar questions on StackOverlow, but none that address this specific issue of getting the same results from run to run.
Set iteration order varies from run to run
1
0
0
16,948
3,848,091
2010-10-03T00:41:00.000
13
0
1
0
python,set,iteration
3,848,111
7
true
0
0
What you want isn't possible. Arbitrary means arbitrary. My solution would be the same as yours, you have to sort the set if you want to be able to compare it to another one.
4
33
0
Why does the iteration order of a Python set (with the same contents) vary from run to run, and what are my options for making it consistent from run to run? I understand that the iteration order for a Python set is arbitrary. If I put 'a', 'b', and 'c' into a set and then iterate them, they may come back out in any order. What I've observed is that the order remains the same within a run of the program. That is, if my program iterates the same set twice in a row, I get the same order both times. However, if I run the program twice in a row, the order changes from run to run. Unfortunately, this breaks one of my automated tests, which simply compares the output from two runs of my program. I don't care about the actual order, but I would like it to be consistent from run to run. The best solution I've come up with is: Copy the set to a list. Apply an arbitrary sort to the list. Iterate the list instead of the set. Is there a simpler solution? Note: I've found similar questions on StackOverlow, but none that address this specific issue of getting the same results from run to run.
Set iteration order varies from run to run
1.2
0
0
16,948
3,848,091
2010-10-03T00:41:00.000
1
0
1
0
python,set,iteration
40,900,811
7
false
0
0
You can set the expected result to be also a set. And checks if those two sets are equal using ==.
4
33
0
Why does the iteration order of a Python set (with the same contents) vary from run to run, and what are my options for making it consistent from run to run? I understand that the iteration order for a Python set is arbitrary. If I put 'a', 'b', and 'c' into a set and then iterate them, they may come back out in any order. What I've observed is that the order remains the same within a run of the program. That is, if my program iterates the same set twice in a row, I get the same order both times. However, if I run the program twice in a row, the order changes from run to run. Unfortunately, this breaks one of my automated tests, which simply compares the output from two runs of my program. I don't care about the actual order, but I would like it to be consistent from run to run. The best solution I've come up with is: Copy the set to a list. Apply an arbitrary sort to the list. Iterate the list instead of the set. Is there a simpler solution? Note: I've found similar questions on StackOverlow, but none that address this specific issue of getting the same results from run to run.
Set iteration order varies from run to run
0.028564
0
0
16,948
3,848,091
2010-10-03T00:41:00.000
-1
0
1
0
python,set,iteration
3,848,182
7
false
0
0
Contrary to sets, lists have always a guaranteed order, so you could toss the set and use the list.
4
33
0
Why does the iteration order of a Python set (with the same contents) vary from run to run, and what are my options for making it consistent from run to run? I understand that the iteration order for a Python set is arbitrary. If I put 'a', 'b', and 'c' into a set and then iterate them, they may come back out in any order. What I've observed is that the order remains the same within a run of the program. That is, if my program iterates the same set twice in a row, I get the same order both times. However, if I run the program twice in a row, the order changes from run to run. Unfortunately, this breaks one of my automated tests, which simply compares the output from two runs of my program. I don't care about the actual order, but I would like it to be consistent from run to run. The best solution I've come up with is: Copy the set to a list. Apply an arbitrary sort to the list. Iterate the list instead of the set. Is there a simpler solution? Note: I've found similar questions on StackOverlow, but none that address this specific issue of getting the same results from run to run.
Set iteration order varies from run to run
-0.028564
0
0
16,948
3,848,490
2010-10-03T03:45:00.000
0
0
0
0
python,django
3,848,525
4
false
1
0
When you deploy and app as a standalone package, it is just another Python package, which happens to implement Django views, templates, template tags, etc. Therefore, Django's search path is the Python search path itself. This is why people say "Just make sure the package structure is correct and django can run without problems." Obviously, if the package name conflicts with someone else's package, you are going to get problems...
4
1
0
I learned Django following django book and the document. In the django book exmaple, the project is called mysite and there's an app called book inside this project. So in this case, the app is called "book". I've no problem with it. My confusion arises in front of reusable apps. Reusable apps usually reside outside the project. For example, django-registration only has an independent folder "registration". So what's its app name? "Registration", right? If that's the case, isn't there some inconsistency regarding the app naming? In the first case, app name seems to be a folder name (or sub package name) under the project while in the 2nd case, the app name is the top package name. I know most of you will say "Why are you obssessed with app name? Just make sure the package structure is correct and django can run without problems." Yes, in most case, app name is nothing but a name. Except in one occasion: specify AUTH_PROFILE_MODULE. As the document explains, To indicate that this model is the user profile model for a given site, fill in the setting AUTH_PROFILE_MODULE with a string consisting of the following items, separated by a dot: The name of the application (case sensitive) in which the user profile model is defined (in other words, the name which was passed to manage.py startapp to create the application). The name of the model (not case sensitive) class. If I have a model as a user profile in a resuable package, I have to know the app name to correctly specify AUTH_PROFILE_MODULE. Does django use certain path searching order to decide the app name?
Confusion about django app's name
0
0
0
5,314
3,848,490
2010-10-03T03:45:00.000
2
0
0
0
python,django
3,848,861
4
true
1
0
The name of the app is the name of the directory, capitalization and all, unless you go to the extra work to change the name in the appropriate __init__.py file. Django apps are, after all, just Python modules, and all the same rules apply. If you ever see an app or module name with different capitalization or other modifications, that doesn't reflect the actual app or module name. Instead, what you're seeing is the result of some "pretty-printing" that the Django admin app is known to do in some cases. This is for display only.
4
1
0
I learned Django following django book and the document. In the django book exmaple, the project is called mysite and there's an app called book inside this project. So in this case, the app is called "book". I've no problem with it. My confusion arises in front of reusable apps. Reusable apps usually reside outside the project. For example, django-registration only has an independent folder "registration". So what's its app name? "Registration", right? If that's the case, isn't there some inconsistency regarding the app naming? In the first case, app name seems to be a folder name (or sub package name) under the project while in the 2nd case, the app name is the top package name. I know most of you will say "Why are you obssessed with app name? Just make sure the package structure is correct and django can run without problems." Yes, in most case, app name is nothing but a name. Except in one occasion: specify AUTH_PROFILE_MODULE. As the document explains, To indicate that this model is the user profile model for a given site, fill in the setting AUTH_PROFILE_MODULE with a string consisting of the following items, separated by a dot: The name of the application (case sensitive) in which the user profile model is defined (in other words, the name which was passed to manage.py startapp to create the application). The name of the model (not case sensitive) class. If I have a model as a user profile in a resuable package, I have to know the app name to correctly specify AUTH_PROFILE_MODULE. Does django use certain path searching order to decide the app name?
Confusion about django app's name
1.2
0
0
5,314
3,848,490
2010-10-03T03:45:00.000
0
0
0
0
python,django
3,848,948
4
false
1
0
An app name is just the name of the Python module. Nothing more. A python module name is the case name of the root folder of the module, that must contains an init.py file. If you want to know what this name is, go to your site-packages folder and look for your module.
4
1
0
I learned Django following django book and the document. In the django book exmaple, the project is called mysite and there's an app called book inside this project. So in this case, the app is called "book". I've no problem with it. My confusion arises in front of reusable apps. Reusable apps usually reside outside the project. For example, django-registration only has an independent folder "registration". So what's its app name? "Registration", right? If that's the case, isn't there some inconsistency regarding the app naming? In the first case, app name seems to be a folder name (or sub package name) under the project while in the 2nd case, the app name is the top package name. I know most of you will say "Why are you obssessed with app name? Just make sure the package structure is correct and django can run without problems." Yes, in most case, app name is nothing but a name. Except in one occasion: specify AUTH_PROFILE_MODULE. As the document explains, To indicate that this model is the user profile model for a given site, fill in the setting AUTH_PROFILE_MODULE with a string consisting of the following items, separated by a dot: The name of the application (case sensitive) in which the user profile model is defined (in other words, the name which was passed to manage.py startapp to create the application). The name of the model (not case sensitive) class. If I have a model as a user profile in a resuable package, I have to know the app name to correctly specify AUTH_PROFILE_MODULE. Does django use certain path searching order to decide the app name?
Confusion about django app's name
0
0
0
5,314
3,848,490
2010-10-03T03:45:00.000
1
0
0
0
python,django
3,848,893
4
false
1
0
My confusion arises in front of reusable apps. Reusable apps usually reside outside the project. For example, django-registration only has an independent folder "registration". So what's its app name? "Registration", right? django-registration is the project name. The application name is registration: in application list you are using the application name only: registration in other places you will use import registration If that's the case, isn't there some inconsistency regarding the app naming? In the first case, app name seems to be a folder name (or sub package name) under the project while in the 2nd case, the app name is the top package name. Think of the project as a simple collection of applications: you could store the apps as subfolders, or place them in a separate folder (that must be included in PYTHONPATH). In both cases the application name is the same. Update manage.py adds to the PYTHONPATH both the current folder (so you could use import app.module) and the parent folder (so you can use project.settings and project.urls). So, if you can configure Pydev to add the project folder to the PYTHONPATH, then you could import the apps as app.module, independent of the project name.
4
1
0
I learned Django following django book and the document. In the django book exmaple, the project is called mysite and there's an app called book inside this project. So in this case, the app is called "book". I've no problem with it. My confusion arises in front of reusable apps. Reusable apps usually reside outside the project. For example, django-registration only has an independent folder "registration". So what's its app name? "Registration", right? If that's the case, isn't there some inconsistency regarding the app naming? In the first case, app name seems to be a folder name (or sub package name) under the project while in the 2nd case, the app name is the top package name. I know most of you will say "Why are you obssessed with app name? Just make sure the package structure is correct and django can run without problems." Yes, in most case, app name is nothing but a name. Except in one occasion: specify AUTH_PROFILE_MODULE. As the document explains, To indicate that this model is the user profile model for a given site, fill in the setting AUTH_PROFILE_MODULE with a string consisting of the following items, separated by a dot: The name of the application (case sensitive) in which the user profile model is defined (in other words, the name which was passed to manage.py startapp to create the application). The name of the model (not case sensitive) class. If I have a model as a user profile in a resuable package, I have to know the app name to correctly specify AUTH_PROFILE_MODULE. Does django use certain path searching order to decide the app name?
Confusion about django app's name
0.049958
0
0
5,314
3,848,658
2010-10-03T04:55:00.000
3
0
1
0
python,database,sqlite,encryption
3,850,560
2
true
0
0
This question comes up on the SQLite users mailing list about once a month. No matter how much encryption etc you do, if the database is on the client machine then the key to decrypt will also be on the machine at some point. An attacker will be able to get that key since it is their machine. A better way of looking at this is in terms of money - how much would a bad guy need to spend in order to get the data. This will generally be a few hundred dollars at most. And all it takes is any one person to get the key and they can then publish the database for everyone. So either go for a web service as mentioned by Donal or just spend a few minutes obfuscating the database. For example if you use APSW then you can write a VFS in a few lines that XORs the database content so regular SQLite will not open it, nor will a file viewer show the normal SQLite header. (There is example code in APSW showing how to do this.) Consequently anyone who does have the database content had to knowingly do so.
1
4
0
I have been working on developing this analytical tool to help interpret and analyze a database that is bundled within the package. It is very important for us to secure the database in a way that can only be accessed with our software. What is the best way of achieving it in Python? I am aware that there may not be a definitive solution, but deterrence is what really matters here. Thank you very much.
Encrypting a Sqlite db file that will be bundled in a pyexe file
1.2
1
0
4,184
3,848,671
2010-10-03T05:05:00.000
5
0
0
1
python,google-app-engine,runtime,yaml
3,849,039
3
true
1
0
No, but some of the data is available from os.environ - for example, os.environ['APPLICATION_ID'], and os.environ['CURRENT_VERSION_ID'].
1
3
0
Is it possible to programmatically retrieve any of the YAML parameters during run-time? Are they stored in the environment somewhere? Good example would be to automatically find the application version and to add it as a comment in the landing HTML page.
Retrieving YAML parameters during runtime in App Engine (Python)
1.2
0
0
1,038
3,849,632
2010-10-03T11:59:00.000
0
0
0
0
python,xml,xsd
5,188,517
1
false
0
0
If you are running Jython (http://jython.org/) then you could import trang and run it internally.
1
3
0
I have a list of xml examples I would like to turn into schemas (xsd files). Exactly what the trang tool does (http://www.thaiopensource.com/relaxng/trang.html). I don't like calling trang from my script (i.e doing os.system('java -jar trang...')) - is there a python package I can use instead?
Python: Is there a way to generate xsd files based on xml examples
0
0
1
387
3,849,762
2010-10-03T12:40:00.000
0
0
1
0
python,python-3.x
25,310,992
4
false
0
0
Notice that easy_install is shipped with Python 3.4 and higher
1
35
0
What is the current status of easy_install, pip and the repository (pypi.python.org) with regards to Python 3.x? Are there versions of easy_install and/or pip that can install the right versions of packages from there? Else, are they expected soon?
Python 3, easy_install, pip and pypi
0
0
0
58,539
3,850,022
2010-10-03T13:55:00.000
-1
0
0
0
python,performance,sqlite
3,850,164
10
false
0
0
sqlite supports in-memory databases. In python, you would use a :memory: database name for that. Perhaps you could open two databases (one from the file, an empty one in-memory), migrate everything from the file database into memory, then use the in-memory database further to do calculations.
2
72
0
I have an existing sqlite3 db file, on which I need to make some extensive calculations. Doing the calculations from the file is painfully slow, and as the file is not large (~10 MB), so there should be no problem to load it into memory. Is there a Pythonic way to load the existing file into memory in order to speed up the calculations?
How to load existing db file to memory in Python sqlite3?
-0.019997
1
0
46,619
3,850,022
2010-10-03T13:55:00.000
0
0
0
0
python,performance,sqlite
57,569,063
10
false
0
0
With the solution of Cenk Alti, I always had a MemoryError with Python 3.7, when the process reached 500MB. Only with the use of the backup functionality of sqlite3 (mentioned by thinwybk), I was able to to load and save bigger SQLite databases. Also you can do the same with just 3 lines of code, both ways.
2
72
0
I have an existing sqlite3 db file, on which I need to make some extensive calculations. Doing the calculations from the file is painfully slow, and as the file is not large (~10 MB), so there should be no problem to load it into memory. Is there a Pythonic way to load the existing file into memory in order to speed up the calculations?
How to load existing db file to memory in Python sqlite3?
0
1
0
46,619
3,850,708
2010-10-03T17:07:00.000
3
0
1
0
python,multiprocessing
3,850,730
3
false
0
0
If you use the multiprocessing package, every child process has is_alive method you can check. So one option to to hold a list of all running processes and periodically check is_alive and re-spawn dead processes. If you're on POSIX system, you can also catch SIGCHLD (using signal) and get notified when a child process dies.
1
0
0
I have a "master" process that needs to spawn some child processes. How can I manage these child processes? (for example, restart if the process is dead) Thanks!
Python multiprocessing
0.197375
0
0
1,144
3,851,884
2010-10-03T22:43:00.000
2
0
1
0
python,algorithm
3,851,940
2
false
0
0
Make recursive search over directory and for each file store md5 or sha checksum of file in dictionary as key and path/name as value. Make this dictionary for both directories. Then you can remove pairs from each directory and result is missing/different files. This will make simple O(n) algorhitm, where n is volume of directory.
1
2
0
I'm going to implement recursive folder comparison on python. What do you think would best algorithm for this? Get two lists of the files for the folders Sort both lists Compare using filecmp module for a file Repeat for every folder recursively In result I need to get only the list of the files that are different (content difference is not needed here), the list of the files that are missing in one of the comparable folders. Thank you.
Compare folders recursively using python
0.197375
0
0
1,820
3,852,146
2010-10-04T00:29:00.000
0
0
0
0
python,wxpython
3,855,400
3
false
0
1
DC's only use integers. Try using Cairo or wx.GraphicsContext.
1
1
1
I have input values of x, y, z coordinates in the following format: [-11.235865 5.866001 -4.604924] [-11.262565 5.414276 -4.842384] [-11.291885 5.418229 -4.849229] [-11.235865 5.866001 -4.604924] I want to draw polygons and succeeded with making a list of wx.point objects. But I need to plot floating point coordinates so I had to change it to point2D objects but DrawPolygon doesn't seem to understand floating points, which returns error message: TypeError: Expected a sequence of length-2 sequences or wxPoints. I can't find anywhere in the API that can draw shapes based on point2D coordinates, could anyone tell me a function name will do the job? Thanks
How to draw polygons with Point2D in wxPython?
0
0
0
1,320
3,853,038
2010-10-04T05:22:00.000
0
0
0
1
python,macos,command-line
3,853,095
2
false
0
0
have you tried using the nohup? lets say you have a launch script to start your program: launch.sh: nohup your_program & exit
1
2
0
For great help from stackoverflow, the development for the Mac version of my program is done. Now I need to deploy my program, and I was wondering if there is any way to "hide" my running Python code (it also runs .so library and it seems it makes a dock item to appear). The program is supposed to be running in the background and it would be great if I can hide any terminal or dock items. In Windows or linux, it was easy, but I am still not that used to Mac and could not figure out how to do this. Thank you, Joon
Run a python script and a compiled c code without terminal or dock item in Mac OS X
0
0
0
1,064
3,855,015
2010-10-04T12:02:00.000
12
1
1
0
python,object,methods,getattr
3,855,032
3
false
0
0
There is no difference. A method is also an attribute. (If you want the method to have an implicit "self" argument, though, you'll have to do some more work to "bind" the method).
1
16
0
When an attribute is not found object.__getattr__ is called. Is there an equivalent way to intercept undefined methods?
__getattr__ equivalent for methods
1
0
0
6,173
3,855,537
2010-10-04T13:12:00.000
4
1
1
0
python,arrays,performance,sorting
3,859,736
10
false
0
0
Radix sort theoretically runs in linear time (sort time grows roughly in direct proportion to array size ), but in practice Quicksort is probably more suited, unless you're sorting absolutely massive arrays. If you want to make quicksort a bit faster, you can use insertion sort] when the array size becomes small. It would probably be helpful to understand the concepts of algorithmic complexity and Big-O notation too.
1
20
1
What is the fastest way to sort an array of whole integers bigger than 0 and less than 100000 in Python? But not using the built in functions like sort. Im looking at the possibility to combine 2 sport functions depending on input size.
Fastest way to sort in Python
0.07983
0
0
57,933
3,856,314
2010-10-04T14:44:00.000
4
0
1
0
python,emacs
3,856,478
6
false
0
0
I'm spoiled by Intellisense too. The PyDev extensions for Eclipse offer a pretty good auto-complete substitute.
1
4
0
After using C# for long time I finally decided to switch to Python. The question I am facing for the moment has to do about auto-complete. I guess I am spoiled by C# and especially from resharper and I was expecting something similar to exist for Python. My editor of choice is emacs and after doing some research I found autocomplete.pl, yasnippet and rope although it is not clear to me if and how they can be installed in a cygwin based system which is what I use since all the related documentation appears to be linux specific... The version of emacs I currently use is 23.2.1 which bundles the python mode that although useful is far behind from whatever research has to offer. My question to python users has to do about how common is autocomplete vs manual typing (using M-/ where possible) ? I am thinking about just memorizing python build-in functions like len, append, extend etc. and revert close to a pre-autocomplete editing mode. How different such an approach is from what other pythonistas are doing?
Python Code Completion
0.132549
0
0
2,302
3,856,917
2010-10-04T15:57:00.000
1
0
1
0
python,lisp,common-lisp,python-2.x
3,878,723
5
false
0
0
Both Lisp's and Python's apply function do the same thing -- given a function f and a list of parameters p, apply f to p. The only difference is that Python's apply also accepts a dictionary for keyword arguments. In Lisp, these would be included in the parameter list as :keyword arguments.
2
2
0
Lisp's APPLY is for calling functions with computed argument stored in lists.(Modified from Rainer's comment) For example, the following code changes (list 1 2 3) to (+ 1 2 3). (apply #'+ '(1 2 3)) However, Python's apply does what Lisp's funcall does, except for some minor differences (input is given as tuple/list) (defun add (x y) (+ x y)) (funcall #'add 1 2) or (funcall #'(lambda (x y) (+ x y)) 10 2) apply(lambda x,y : x+y, [1,2]) What do you think? Are there more differences between Lisp's funcall and Python's apply?
Lisp's apply and funcall vs Python's apply
0.039979
0
0
4,779
3,856,917
2010-10-04T15:57:00.000
2
0
1
0
python,lisp,common-lisp,python-2.x
3,857,107
5
false
0
0
I don't see why you claim Lisp's apply() would do anything different than Python's. Both functions take a function and a list and then call the function with the list elements as arguments. ((+ 1 2 3) is an call to + with arguments 1, 2 and 3, isn't it?) To me it looks like both applys do exactly the same thing. funcall on the other hand tales a function and several separate arguments (not a list containing arguments) and applies the function to these arguments.
2
2
0
Lisp's APPLY is for calling functions with computed argument stored in lists.(Modified from Rainer's comment) For example, the following code changes (list 1 2 3) to (+ 1 2 3). (apply #'+ '(1 2 3)) However, Python's apply does what Lisp's funcall does, except for some minor differences (input is given as tuple/list) (defun add (x y) (+ x y)) (funcall #'add 1 2) or (funcall #'(lambda (x y) (+ x y)) 10 2) apply(lambda x,y : x+y, [1,2]) What do you think? Are there more differences between Lisp's funcall and Python's apply?
Lisp's apply and funcall vs Python's apply
0.07983
0
0
4,779
3,857,140
2010-10-04T16:22:00.000
6
0
0
0
python,google-app-engine,google-cloud-datastore
3,857,498
2
false
1
0
The 'low level' API is in google.appengine.api.datastore. There's no public documentation for it, but the module itself has fairly complete docstrings.
1
3
0
What is the alternative for Entity.java in python version? I do not want any data model. I want my entities without a predefined structure. I just want them to be key and value pairs as the above Entity.java is. Can I do it in Python version?
How to access lowlevel API for storing data in Google App Engine for python
1
0
0
304
3,857,883
2010-10-04T18:03:00.000
2
0
1
0
python,pdf-generation,pypdf
14,392,145
3
false
0
0
I had this problem, and was able to figure it out by looking at the original pdf side by side with the PyPDF one in a hex editor. The problem seems to be that PyPDF actually leaves off a byte - it looks like probably the first byte in each image stream is missing. When I added the bytes to the PyPDF file, the pdf opened up fine without the error.
2
3
0
I have a program in Python (using pyPDF) that merges a bunch of different PDF documents. Sometimes, the resulting pdf is fine, except for some blank pages in the middle. When I view these documents with Acrobat Reader, I get an error message saying "insufficient data for image". When I view the documents with FoxIT Reader, I get some blank pages and a munged image. The only odd thing about the PDF that creates the blank pages is that it seems to be PDF Version 1.4, and PyPdf seems to create files with PDF Version 1.3. 1) Does the version thing sound like the root cause of my problem? 2) Is there a way to get PyPdf to handle this correctly?
what causes "insufficient data for image" in a pdf
0.132549
0
0
6,035
3,857,883
2010-10-04T18:03:00.000
1
0
1
0
python,pdf-generation,pypdf
4,857,711
3
false
0
0
I suspect that the image XObject stream is Malformed. Without access to a PDF with the problem, all most folks can do is guess. For example, if the pdf info says the image is 10 pixels wide, 10 pixels high, and 8 bits per pixel, then the stream should uncompress to 100 bytes. If it uncompressed to less than that, I'd expect an error like the one you're seeing. The is probably a bug in pypdf regarding whatever image format you happen to be using. IIRC, there's is no scan-line padding in PDF and no concern for word boundaries, though the last bits are padded out to a byte if need be. Confusion there could easily lead to too many bytes, which isn't the problem here. It could also be a bad color space. If you've got an indexed color image (gif), and they translate it half way to an RGB image, but use the original indexed color bytes, you'd get a stream that might expect n*3 bits per pixel, but only have n bits per pixel. It's possible that this is an older bug that's been fixed in pypdf. Are you using the current version?
2
3
0
I have a program in Python (using pyPDF) that merges a bunch of different PDF documents. Sometimes, the resulting pdf is fine, except for some blank pages in the middle. When I view these documents with Acrobat Reader, I get an error message saying "insufficient data for image". When I view the documents with FoxIT Reader, I get some blank pages and a munged image. The only odd thing about the PDF that creates the blank pages is that it seems to be PDF Version 1.4, and PyPdf seems to create files with PDF Version 1.3. 1) Does the version thing sound like the root cause of my problem? 2) Is there a way to get PyPdf to handle this correctly?
what causes "insufficient data for image" in a pdf
0.066568
0
0
6,035
3,858,238
2010-10-04T18:56:00.000
4
0
0
1
python,c,linux,io,blocking
3,859,933
6
true
0
0
You have a misunderstanding of what non-blocking means. It does not imply asynchronous operation - you can have any combination of asynchronous/synchronous and blocking/non-blocking. A write() just hands data off to the kernel to take care of. When write() returns successfully, the kernel has now taken care of the data - this is true regardless of whether the file descriptor is blocking or non-blocking. Whether or not the kernel has actually finished writing it at this point is a separate matter (usually, the answer is "no" - most file descriptors are asynchronous). A write() cannot complete if the kernel has no more room to buffer the data you want to write, and this is the case that is affected by non-blocking versus blocking - in the blocking case, the write() will block until space is available. In the non-blocking case, write() will return an error (EAGAIN), and it is up to you to retry it later. If you wish to wait until all data written to a terminal device has actually been sent to the hardware, use tcdrain() - but this is likely to be unnecessary. Alternatively, if you wish write() to block until your data is accepted by the kernel, then you can use fcntl() to temporarily set the file descriptor to blocking.
6
0
0
If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write?
checking when all data is sent using non-blocking open
1.2
0
0
809
3,858,238
2010-10-04T18:56:00.000
3
0
0
1
python,c,linux,io,blocking
3,859,349
6
false
0
0
If you are writing to a tty (as you are in your example), you can use termios.tcdrain to wait until all written bytes have been transmitted. Your write systems calls will still be non-blocking, so you will need to handle EWOULDBLOCK/EAGAIN errors, and use select(2), poll(2) or epoll(7) to know when you can write to the file descriptor. These are designed to be used with non-blocking file descriptors.
6
0
0
If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write?
checking when all data is sent using non-blocking open
0.099668
0
0
809
3,858,238
2010-10-04T18:56:00.000
0
0
0
1
python,c,linux,io,blocking
3,858,262
6
false
0
0
Open two file descriptors to the same location - one for non-blocking reads and the other for blocking writes.
6
0
0
If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write?
checking when all data is sent using non-blocking open
0
0
0
809
3,858,238
2010-10-04T18:56:00.000
0
0
0
1
python,c,linux,io,blocking
3,858,291
6
false
0
0
Have you tried os.fsync(fd)?
6
0
0
If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write?
checking when all data is sent using non-blocking open
0
0
0
809
3,858,238
2010-10-04T18:56:00.000
1
0
0
1
python,c,linux,io,blocking
3,858,316
6
false
0
0
The O_NDELAY flag always affects both reading and writing. To achieve a blocking write on a non-blocking file you can select (Python module) the file and write when it becomes writable in a loop.
6
0
0
If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write?
checking when all data is sent using non-blocking open
0.033321
0
0
809
3,858,238
2010-10-04T18:56:00.000
0
0
0
1
python,c,linux,io,blocking
3,858,252
6
false
0
0
OS API write() returns count of written bytes. Checking this value against size of your input you can see when all input is sent.
6
0
0
If I open a a file as os.open( '/dev/ttyS2', O_RDWR | O_NDELAY ), is there any way that I can check when my 'write()' commands have finished? Or, can I open a file for non-blocking read but blocking write?
checking when all data is sent using non-blocking open
0
0
0
809
3,859,090
2010-10-04T21:04:00.000
0
0
0
0
python,sockets,networking
3,873,419
4
true
0
0
I figured it out. It turns out that the piece I was missing was adding the interface to the mreq structure that is used in adding membership to a multicast group.
1
6
0
I have a server with two separate Ethernet connections. When I bind a socket in python it defaults to one of the two networks. How do I pull a multicast stream from the second network in Python? I have tried calling bind using the server's IP address on the second network, but that hasn't worked.
Choosing multicast network interface in Python
1.2
0
1
9,358
3,859,526
2010-10-04T22:08:00.000
1
0
1
0
ironpython
3,869,609
1
true
0
0
The System.Dynamic assembly in .NET 4.0 actually includes no public surface area. It just has a bunch of internal types which are visible to the C# runtime assembly that are used for COM interop. The decision to make this all internal was made late enough in the product cycle that the assembly still remains. Likely you want Microsoft.Dynamic instead which contains a superset of the functionality in System.Dynamic. Microsoft.Dynamic is shipped w/ IronPython.
1
2
0
I'm obviously missing something trivial, but I can't seem to import from System.Dynamic; to wit: import clr clr.AddReference('System.Dynamic') which clearly adds the salient reference: clr.References[2] (< System.Dynamic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a>) but importing fails import System.Dynamic results in: Traceback (most recent call last): File "", line 1, in ImportError: No module named Dynamic What basic thing am I missing?
Problem importing System.Dynamic in IronPython
1.2
0
0
452
3,859,623
2010-10-04T22:26:00.000
2
0
1
0
python,m2crypto,python-2.7,cryptography
3,929,055
2
true
0
0
Actually, the M2Crypto package supports Python 2.7 just fine — I have been using it in a cryptography-heavy application with no problem. I suppose the problem here is that Windows does not come with a compiler, so you cannot easily install the .tar.gz off of PyPI? Or are you getting an error when you try to compile it? I would suggest that the best response to an error would be posting it to Stack Overflow so that we could fix it, instead of asking for alternative to what is — so far as I can tell — the premier cryptography library for Python. Update: I have now successfully built M2Crypto for Windows under Python 2.7, so I can personally confirm that it works fine with Python 2.7 on all major platforms.
1
3
0
Any recommendations on an AES encryption library that's compatible with Python 2.7 for Windows? In the past we've used m2crypto with Python 2.6, but there's no version of m2crypto for Python 2.7 and our attempts to build a version from source have failed. Thank you, Malcolm
AES encryption library compatible with Python 2.7 for Windows
1.2
0
0
1,361
3,860,386
2010-10-05T01:58:00.000
2
0
1
0
python,3d,maya
4,687,412
3
false
0
0
I will say that there is no big difference for Python version. Just like others mentioned, ThE_JacO does not involved in popular 3D apps. Maya, Pixar's RenderMan, Houdini, Blender, Realflow, ... all have Python 2.x binding. For Python 2.4, 2.5, and 2.6, there is rare difference in function interfaces. You can just ignore this issue. In our studio, we code Python scripts to work in 2.4, 2.5 and 2.6 because we uses different 3D apps version on different animation projects. There are some code snippets need modulation to make it all work well but they are really minor issues.
2
3
0
I have a couple small projects that I want to use to learn python. What version should I be using if I want to move to scripting for Maya, Blender, etc later? Also, what resources are there for scripting for those programs?
python version for maya and other 3d apps
0.132549
0
0
2,086
3,860,386
2010-10-05T01:58:00.000
5
0
1
0
python,3d,maya
3,860,414
3
true
0
0
If you are using Maya 2011 it comes bundled with and bound to py 2.6.4 already. You don't need a separate install, not even for pyMEL anymore. If you want to learn Python on its own before applying the knowledge to a 3D app, then pretty much any 2.x Python will do really, the version specific features only come into play a while away if you're at your first steps. 2.6.4 though would of course be a good choice, as it will be aligned to what you might be using in Maya and Softimage right out of the gate. Stay away from py3k for now as adoption in our field seems to be a long way away still. As for resources, for Python and Maya together, close to nothing, but most of the programming oriented material I've seen published insofar, with only a handful of notable exceptions such as Gould's material, is usually between underwhelming and plain amateurish. You're better off with a decent entry level book that doesn't assume the reader is drooling idiot (I still rate O'Reilly's learning Python very highly), sites like StackOverflow for idiomatic questions, and a lot of practice and browsing to make the necessary mental connection and exercise a bit when it comes to the specifics of the Maya scripting API. Having a look early at pyMEL, since it's now bundled, also won't hurt. The default, old maya commands and mel wrapper-like modules are truly atrocious and as far from Pythonic as they could make them. pyMEL, while not 100% of the way there, has a stronger object orientation and doesn't read like a large population of monkeys was suddenly handled typewriters.
2
3
0
I have a couple small projects that I want to use to learn python. What version should I be using if I want to move to scripting for Maya, Blender, etc later? Also, what resources are there for scripting for those programs?
python version for maya and other 3d apps
1.2
0
0
2,086
3,860,890
2010-10-05T04:41:00.000
0
0
0
0
python,igraph
3,976,063
2
false
0
0
This is not possible in the stable version of igraph (0.5.4 at the moment), but the development version (0.6) supports it. igraph_mincut gives you the minimum cut itself in the cut argument.
1
1
0
mincut_value in igraph for python returns the number of edges of the cut. Can I find the what edges are actually are returned by this function and print them?
finding the edges returned by mincut_value in igraph
0
0
0
217
3,861,027
2010-10-05T05:23:00.000
3
0
0
0
python,django,cherrypy
3,898,465
2
false
1
0
Django admin is much more, but is bound to Models. Without them, You will not gain much and as there is no such concept in CherryPy, I doubt there is similar application. However, Django admin is phpmyadmin for masses exploited. Don't be constrained by it and create much more usable admin apps, leveraging CherryPy simplicity ^_^
1
2
0
Is there a django.contrib.admin like app / module for cherrypy? I really like the simplicity of cherrypy, but it would be nice, to have the user authentication and password management type things taken care of... Or is it possible to run a cherrypy application behind the django admin app ?
django.contrib.admin like application for cherrypy
0.291313
0
0
570
3,861,102
2010-10-05T05:43:00.000
2
1
0
0
python,ruby,migration,administration
3,868,363
4
false
1
0
Have you considered writing your applications as Webmin modules? You get a lot of stuff for free when you do so (users and groups, tons of security features, a pretty big variety of helper functions related to config files, and tons of existing code for most aspects of a UNIX/Linux system). You also get a lot of stuff for nearly free, like action logging, packages and updates via wbm or apt or yum, an online help system, etc. There are some cons, as well. It's an old codebase, so it has some clunky bits in the API among other places. A lot of the old modules can be a bit hard to grok if you're not an old-school Perl programmer. But, it's a well-maintained codebase, and it's been banged on by millions of users for over a dozen years. It's pretty robust. The UI isn't beautiful, but it is relatively theme-able, and if you're distributing a minimized version it becomes easier to customize the UI. I suspect you can be up and running a lot faster than starting from scratch or using most existing frameworks that aren't targeted specifically to building systems management interfaces the way Webmin is. Also, it's BSD licensed, so you can do whatever you want with it, including building a custom commercial app with it (hundreds of companies have done so over the years).
3
0
0
We have an in house developed web-based admin console that uses a combination of C CGI and Perl scripts to administer our mail server stack. Of late we have been thinking of cleaning up the code (well, replacing most of it), making the implementation more secure, and improving the overall behavior. I don't have much programming knowledge, but I use Ruby on and off (mainly for writing erb templates), and hence was thinking of using ruby/rails for developing such an app (off-duty for now, I also need to learn stuff !). Before blindly picking up a language though, what would you folks suggest ? Please let me know if this is too vague a question, I'll try to supply more information, if needed.
Which language to use for writing an admin console à la webmin?
0.099668
0
0
155
3,861,102
2010-10-05T05:43:00.000
0
1
0
0
python,ruby,migration,administration
3,897,721
4
false
1
0
django has a nice admin interface
3
0
0
We have an in house developed web-based admin console that uses a combination of C CGI and Perl scripts to administer our mail server stack. Of late we have been thinking of cleaning up the code (well, replacing most of it), making the implementation more secure, and improving the overall behavior. I don't have much programming knowledge, but I use Ruby on and off (mainly for writing erb templates), and hence was thinking of using ruby/rails for developing such an app (off-duty for now, I also need to learn stuff !). Before blindly picking up a language though, what would you folks suggest ? Please let me know if this is too vague a question, I'll try to supply more information, if needed.
Which language to use for writing an admin console à la webmin?
0
0
0
155
3,861,102
2010-10-05T05:43:00.000
0
1
0
0
python,ruby,migration,administration
3,861,123
4
true
1
0
If you already know a bit of ruby, then there's no reason not to use that. If you're interested specifically in learning another language, then what you're trying to do could be done in pretty much any language/framework, it's just a matter of which one you want to learn.
3
0
0
We have an in house developed web-based admin console that uses a combination of C CGI and Perl scripts to administer our mail server stack. Of late we have been thinking of cleaning up the code (well, replacing most of it), making the implementation more secure, and improving the overall behavior. I don't have much programming knowledge, but I use Ruby on and off (mainly for writing erb templates), and hence was thinking of using ruby/rails for developing such an app (off-duty for now, I also need to learn stuff !). Before blindly picking up a language though, what would you folks suggest ? Please let me know if this is too vague a question, I'll try to supply more information, if needed.
Which language to use for writing an admin console à la webmin?
1.2
0
0
155
3,862,332
2010-10-05T09:20:00.000
0
0
0
1
php,python
3,862,362
3
false
1
0
You could connect its stdin to a FIFO and then have another daemon also connect to the FIFO and send commands. It might be better to have the control daemon start the Java daemon though, so that the Java daemon doesn't shut down if the control daemon does for some reason.
1
0
0
I have a java server application that, when its running, you can interact with it sending commands via stdin. I want to write a web interface that can send these commands to it. In order to do that I need some way of getting commands from php to the stdin for this backgrounded job. Is there a way to do this from console? or possibly write some kind of wrapper that controls the server job and can access its stdin ? could this be done in python?
send commands to a backgrounded jobs stdin
0
0
0
157
3,863,281
2010-10-05T11:40:00.000
4
0
0
0
python,sockets,socketserver
3,863,539
2
false
0
0
No the serve_forever is checking a flag on a regular basis (by default 0.5 sec). Calling shutdown will raise this flag and cause the serve_forever to end.
1
6
0
How can I call shutdown() in a SocketServer after receiving a certain message "exit"? As I know, the call to serve_forever() will block the server. Thanks!
Python SocketServer
0.379949
0
1
3,881
3,863,369
2010-10-05T11:55:00.000
1
1
0
0
python,eclipse,pydev
3,863,743
3
false
0
0
You can try refreshing your PYTHONPATH in Preferences > Pydev > Interpreter - Python and selecting AutoConfig for your interpreter, then manually choosing the libraries for your PYTHONPATH. This is pretty radical solution though. Making an insignificant change (like adding a space) and saving file should work in most cases. If not, you can also try temporary delete and then re-add the imports in file that is causing problems.
3
15
0
I am using PyDev/Eclipse for several monthes and I get ever and ever the same bugs with imports: PyDev underline in red an import and say Unresolved import xxx ; Found at yyy. When I click on yyy eclispe find and open the implementation of the module. (PyDev just inform me that it can't find the module xxx and in the same message that it can find it !) The module xxx is in the PYTHONPATH of eclipse. When I "explore" the interpreter of the project, I can find it without any problems. When I try to execute (from eclipse), I don't get any error and it works fine. Sometimes, the error message will stay for several days and will disappear. Sometimes, it won't. I've tried to refresh the projects but it has not impact on that. Somtimes, it works well on a project and I can use autocompletion and it don't work in another project (same interpreter) ... I just can't understand what is happenning ? So far, I have ignored these bugs because everything was fully fonctionnal but sometimes, it is a bit disturbing to have red markers "errors" when you are working. Did you find a way to avoid these bugs in PyDev ? Is it "normal" ? Is there a way to force PyDev to "refresh" ? Thank you. References : python 2.4.4 (built from sources) PyDev v 1.6.0 2010071813
PyDev bugs with imports
0.066568
0
0
6,201
3,863,369
2010-10-05T11:55:00.000
16
1
0
0
python,eclipse,pydev
3,864,323
3
true
0
0
This can happen if new modules are not cached by PyDev. For example, on my new laptop I first set up PyDev/Eclipse and later installed the Django package. That's why Django imports were marked as unresolved. You can refresh it using Pydev > Interpreter - Python > Libraries > Apply. Select the interpreter you want to "restore" (they could have chosen a better word) and click OK. PyDev will then reparse all installed modules. I'm using the nightly version of PyDev, but any 1.6.x version should work correctly. If that doesn't help, remove the interpreter configure and create a new one.
3
15
0
I am using PyDev/Eclipse for several monthes and I get ever and ever the same bugs with imports: PyDev underline in red an import and say Unresolved import xxx ; Found at yyy. When I click on yyy eclispe find and open the implementation of the module. (PyDev just inform me that it can't find the module xxx and in the same message that it can find it !) The module xxx is in the PYTHONPATH of eclipse. When I "explore" the interpreter of the project, I can find it without any problems. When I try to execute (from eclipse), I don't get any error and it works fine. Sometimes, the error message will stay for several days and will disappear. Sometimes, it won't. I've tried to refresh the projects but it has not impact on that. Somtimes, it works well on a project and I can use autocompletion and it don't work in another project (same interpreter) ... I just can't understand what is happenning ? So far, I have ignored these bugs because everything was fully fonctionnal but sometimes, it is a bit disturbing to have red markers "errors" when you are working. Did you find a way to avoid these bugs in PyDev ? Is it "normal" ? Is there a way to force PyDev to "refresh" ? Thank you. References : python 2.4.4 (built from sources) PyDev v 1.6.0 2010071813
PyDev bugs with imports
1.2
0
0
6,201
3,863,369
2010-10-05T11:55:00.000
1
1
0
0
python,eclipse,pydev
38,688,200
3
false
0
0
Just in case anyone else runs into this thread but above answers don't solve the issue, make sure that your script does not have the same name as the library that you are trying to import.
3
15
0
I am using PyDev/Eclipse for several monthes and I get ever and ever the same bugs with imports: PyDev underline in red an import and say Unresolved import xxx ; Found at yyy. When I click on yyy eclispe find and open the implementation of the module. (PyDev just inform me that it can't find the module xxx and in the same message that it can find it !) The module xxx is in the PYTHONPATH of eclipse. When I "explore" the interpreter of the project, I can find it without any problems. When I try to execute (from eclipse), I don't get any error and it works fine. Sometimes, the error message will stay for several days and will disappear. Sometimes, it won't. I've tried to refresh the projects but it has not impact on that. Somtimes, it works well on a project and I can use autocompletion and it don't work in another project (same interpreter) ... I just can't understand what is happenning ? So far, I have ignored these bugs because everything was fully fonctionnal but sometimes, it is a bit disturbing to have red markers "errors" when you are working. Did you find a way to avoid these bugs in PyDev ? Is it "normal" ? Is there a way to force PyDev to "refresh" ? Thank you. References : python 2.4.4 (built from sources) PyDev v 1.6.0 2010071813
PyDev bugs with imports
0.066568
0
0
6,201
3,864,223
2010-10-05T13:47:00.000
1
0
0
1
java,python,ruby,deployment
3,864,388
8
false
1
0
We use Ant or Maven for different projects we have in house (depending on the need and how old the project is too...). We tend to use Jenkins (formerly known as Hudson) as our build and deployment tool. And then we encourage developers to write code that does not hard code to DB's, URL's, etc. We try to abstract via the container (ie, Data Sources, pure JMS API's, etc) when running within an app server. And we tend to abstract environment specifics via properties files that we look up at runtime. The path to the properties file is to be defined as a variable on the server. This way we can be flexible enough to build code once and move it through to all our environments.
8
3
0
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)? Here we use Python, Java and Ruby, and may use other languages as well in the future. Update: I ended up using Puppet to manage all server setup, configs AND deploy. To trigger the deploy of newer versions I ended up using Python Fabric scripts.
Agnostic automated deployment
0.024995
0
0
520
3,864,223
2010-10-05T13:47:00.000
1
0
0
1
java,python,ruby,deployment
3,864,349
8
false
1
0
you can use maven, ant, ivy along with hudson for java projects.
8
3
0
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)? Here we use Python, Java and Ruby, and may use other languages as well in the future. Update: I ended up using Puppet to manage all server setup, configs AND deploy. To trigger the deploy of newer versions I ended up using Python Fabric scripts.
Agnostic automated deployment
0.024995
0
0
520
3,864,223
2010-10-05T13:47:00.000
1
0
0
1
java,python,ruby,deployment
3,864,310
8
false
1
0
I think the best choice you could do is using maven. Even if maven is mostly used for Java projects, you can with the right plugins (or the one you write) deploy anything anywhere.
8
3
0
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)? Here we use Python, Java and Ruby, and may use other languages as well in the future. Update: I ended up using Puppet to manage all server setup, configs AND deploy. To trigger the deploy of newer versions I ended up using Python Fabric scripts.
Agnostic automated deployment
0.024995
0
0
520
3,864,223
2010-10-05T13:47:00.000
1
0
0
1
java,python,ruby,deployment
3,864,298
8
false
1
0
For Python you could use Fabric or Paver For Ruby, there's capistrano and 'vlad the deployer' For Java, it's the Ant. For PHP/Python projects I also use Peritor Webistrano, a neat frontend for capistrano. It involves changing a few of the default recipes to remove the rails-specific stuff, but it's worth it once you get it setup correctly.
8
3
0
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)? Here we use Python, Java and Ruby, and may use other languages as well in the future. Update: I ended up using Puppet to manage all server setup, configs AND deploy. To trigger the deploy of newer versions I ended up using Python Fabric scripts.
Agnostic automated deployment
0.024995
0
0
520
3,864,223
2010-10-05T13:47:00.000
3
0
0
1
java,python,ruby,deployment
3,864,289
8
true
1
0
I use Puppet for some of the deployements / initial configuration of server. Maven and Ant for Java based projects.
8
3
0
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)? Here we use Python, Java and Ruby, and may use other languages as well in the future. Update: I ended up using Puppet to manage all server setup, configs AND deploy. To trigger the deploy of newer versions I ended up using Python Fabric scripts.
Agnostic automated deployment
1.2
0
0
520
3,864,223
2010-10-05T13:47:00.000
2
0
0
1
java,python,ruby,deployment
6,336,041
8
false
1
0
Go for KWateeSDCM. It comes with a straightforward web GUI and does not require obscure scripting and integrates nicely with your build chain via a REST API.
8
3
0
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)? Here we use Python, Java and Ruby, and may use other languages as well in the future. Update: I ended up using Puppet to manage all server setup, configs AND deploy. To trigger the deploy of newer versions I ended up using Python Fabric scripts.
Agnostic automated deployment
0.049958
0
0
520
3,864,223
2010-10-05T13:47:00.000
1
0
0
1
java,python,ruby,deployment
3,864,283
8
false
1
0
We use Maven and pull out to the ant-plugin when required. In turn the ant-plugin very occasionally calls out to some native scripting language/application/packager/whatever but we're finding that over time we can generally find a Maven or ANT plugin/task to do the trick. You might want to look up Continuous Deployment, it's a pretty hot topic in the build and CI space right now.
8
3
0
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)? Here we use Python, Java and Ruby, and may use other languages as well in the future. Update: I ended up using Puppet to manage all server setup, configs AND deploy. To trigger the deploy of newer versions I ended up using Python Fabric scripts.
Agnostic automated deployment
0.024995
0
0
520
3,864,223
2010-10-05T13:47:00.000
2
0
0
1
java,python,ruby,deployment
3,864,269
8
false
1
0
You could use Ant, Makefile, or a batch script. Or a combination of them.
8
3
0
What do you use to automatically deploy applications for various kinds of server applications (web, socket, daemon) that uses various technologies (different DBs, languages, etc)? Here we use Python, Java and Ruby, and may use other languages as well in the future. Update: I ended up using Puppet to manage all server setup, configs AND deploy. To trigger the deploy of newer versions I ended up using Python Fabric scripts.
Agnostic automated deployment
0.049958
0
0
520
3,865,283
2010-10-05T15:39:00.000
2
0
1
0
python,mongodb,nosql
3,865,523
4
false
0
0
I don't know about a noSQL solution, but sqlite+sqlalchemy's ORM works pretty well for me. As long as it gives you the interface and features you need, I don't see a reason to care whether it uses sql internally.
1
4
0
Looking around for a noSQL database implementation that has an ORM syntax (pref. like Django's), lets me store and retrieve nested dictionary attributes but written entirely in Python to ease deployment and avoids Javascript syntax for map/reduce. Even better if it has a context-aware (menus), python-based console, as well as being able to run as a separate daemon task. Is there such an initiative already (I can't find it) or should I start one?
Pure Python implementation of MongoDB?
0.099668
1
0
1,830
3,865,733
2010-10-05T16:32:00.000
1
0
0
0
python,sqlite,sqlalchemy,fts3
3,942,449
2
false
0
0
From elsewhere on the internet it seems it may be possible to surround each search term with double quotes "some-term". Since we do not need the subtraction operation, my solution was to replace hyphens - with underscores _ when populating the search index and when performing searches.
1
2
0
I'm using Python and SQLAlchemy to query a SQLite FTS3 (full-text) store and I would like to prevent my users from using the - as an operator. How should I escape the - so users can search for a term containing the - (enabled by changing the default tokenizer) instead of it signifying "does not contain the term following the -"?
How do I escape the - character in SQLite FTS3 queries?
0.099668
1
0
1,200
3,866,989
2010-10-05T19:28:00.000
1
0
0
0
python,mysql,django
3,868,544
2
true
1
0
You can't import sql dumps through django; import it through mysql directly, if you run mysql locally you can find various graphical mysql clients that can help you with doing so; if you need to do it remotely, find out if your server has any web interfaces for that installed!
1
0
0
I'm trying to restore the current working database to the data stored in a .sql file from within Django. Whats the best way to do this? Does django have an good way to do this or do I need to grab the connection string from the settings.py file and send command line mysql commands to do this? Thanks for your help.
How do I replace the current working MySQL database with a .sql file?
1.2
1
0
182
3,867,262
2010-10-05T20:03:00.000
8
0
1
0
python,list
3,867,296
4
true
0
0
Use something like if list1[:-1] == list2[:-1].
1
9
0
I have several long lists in python and have compare them and find the lists that are equal to each other except the last elements in the them. Which is the fastest way?
Comparing Python lists
1.2
0
0
18,130
3,867,377
2010-10-05T20:17:00.000
3
1
1
0
ironpython
3,869,625
1
true
0
0
It's interesting, there's actually no support for this at all right now. For the most part this has been used to implement built-in modules that exist in CPython and there's simply been no need for submodules yet. You could have a nested static class in the class used for the module but it wouldn't import as a module - it'd show up as a type object in Python.
1
2
0
While I'm familiar with making .net assemblies with the PythonModule assembly attribute, I'm a little curious as to how you could make submodules. Would this be a class within a class? i.e: if I have a class defined as an IronPython module such as: [assembly: PythonModule(mymodule),typeof(namespace.mymodule)] How could I define a submodule within mymodule, so that from python I could do: import mymodule.submodule Thanks in advance!
submodules in ironpython
1.2
0
0
183
3,867,500
2010-10-05T20:34:00.000
1
0
0
1
python,user-interface,wxpython,wxwidgets,command-line-interface
3,867,843
2
false
0
0
If you can call your data model's methods from your GUI and they don't depend on anything in the GUI, then yes, you should be able to call those same methods from another GUI, be it CLI, pyGTK or whatever.
1
0
0
HI, guys. I am developing a GUI to configure and call several external programs with Python and I use wxPython for the GUI toolkits. Basically, instead of typing commands and parameters in each shell for each application (one application via one shell), the GUI is visualizing these parameters and call them as subprocesses. I have built the data model and the relevant view/gui controls (mainly by using the observer pattern or try to separate model with the gui widgets), and it is OK. Now there is a request from my colleagues and many other people (even including myself), is it possible to have a command line interface for the subprocesses, or even for the whole configuration GUI, based on the data model I already have? This is due to the fact that many people prefer CLI, CLI is better in reliability, and also needs of programmer debugging and interfacing. As I am rather new to developing a CLI, I really need some help from you. I appreciate any advice and information from you. to be more specific, If I completely forget about the data model built for GUI, start from scratch. Is there some good materials or samples to have a reference? If I still want to utilize the data model built for GUI, is it possible? If possible, what shall I do and any samples to follow? Do I need to refactor the data model? Is it possible to have the CLI and GUI at the same time? I mean, can I take the CLI as another view of the data model? Or there is other right approach? Thank you very much for your help!!
how to make a Command Line Interface from a given data model used for GUI
0.099668
0
0
440
3,867,860
2010-10-05T21:24:00.000
1
1
1
0
python,localization,linguistics
3,868,983
6
false
0
0
the simplest way to do this is to make a dictionary that matches one language's words to another language's words. However, this is extremely silly and would not take into account grammar at all and it would literally take a very long time to create a translator, especially if you plan to use it for multiple languages. If grammar is not important to you (for example, if you were creating your own language for a game or story that doesn't have grammar different from english) than you could get away with using dictionaries and simply having a function look for a requested match in the dictionary
1
1
0
What is the best way to approach writing a program in Python to translate English words and/or phrases into other languages?
Python - English translator
0.033321
0
0
2,381
3,867,945
2010-10-05T21:36:00.000
1
0
1
0
python,design-patterns,oop
3,867,968
1
true
0
0
Have the Player ask the Turn to roll, by calling e.g. turn.roll_dice(). The Turn can then decide whether to roll the dice or e.g. to raise NotYourTurnError. You can't prevent the Player class directly calling die.roll(), although you can make roll private by renaming it __roll. However, since I assume the player is controlling the die via some sort of (G?) UI, you can simply not include any way of telling the die to roll in said interface. In general, you can't hide methods like this from arbitrary Python code with any degree of security; Python is so powerful that you'll almost certainly be able to find a way around the protection. Instead, you make them protected (_foo) or private (__foo) and assume that people who call them know what they're doing.
1
0
0
I'm writing a simulation in Python for a dice game, and am trying to find the best way to handle the following situation in an Object Oriented manner. I have a Dice class that handles rolling the dice and reporting things about the dice. This class's methods include a roll() method which modifies the dice values, and various reporting methods that describe the state of the dice, such as have_n_of_a_kind(), is_scoring_combination(), and get_roll_value(). There are two classes which make use of this Dice class. The Player, controlled directly by a human, is untrusted to always make legal moves. There is also a Turn class which enforces the rules of the game. So then, both the Player and Turn class need to be able to ask the Dice about its values by calling the state describing methods, but the Player cannot be allowed to directly call the roll() method, because the human Player might roll when it is not supposed to. Is there a good way for me to allow the Turn class to call a Dice object's roll() method but not allow a Player to do so?
Is there a design pattern for this: hide certain methods from certain classes
1.2
0
0
420
3,868,722
2010-10-06T00:24:00.000
0
0
0
0
python,html,pylons,mako
3,868,737
5
false
1
0
If your data are not too dynamic, you could store an optimised cache of the template output and serve this to web clients.
1
7
0
I'm using Mako + Pylons and I've noticed a horrendous amount of whitespace in my HTML output. How would I go about getting rid of it? Reddit manage to do it.
Strip whitespace from Mako template output (Pylons)
0
0
0
4,817
3,869,280
2010-10-06T03:15:00.000
0
0
1
0
python,windows,copy,overwrite
3,869,375
2
true
0
0
oops... Turns out that distutils.dir_util.copy_tree(src, dst) works. It's just that I got my directory path from environment variables and '\n' was stuck at the back of my path. Adding in a .strip() to my path variable solved the problem.
1
0
0
I'm trying to overwrite a directory with another directory that contains the same files. I've tried using distutils.dir_util.copy_tree(src, dst) but it tried to make a directory for dst instead. The objective is to overwrite the directory and its contents silently. Is there any other way to do so?
Python: Overwriting a directory with another directory containing the same files
1.2
0
0
925
3,869,435
2010-10-06T04:07:00.000
0
1
1
0
python,c,decompiling
3,869,481
11
false
0
1
Python scripts are analogous to a man looking at a to-do list written in English (or language he understands). The man has to do all the work, every time that list of things has to be done. If the man, instead of doing the steps on his own each time, creates and programs a robot which can carry out those steps again and again (and probably faster than him), that robot is analogous to the C program. The man in the python case is called the "interpreter" and in the C case is called the "compiler", and the C robot is called the compiled program/executable. When you look at the python program source, you see the to-do list. In case of the robot, you see the gears, motors and batteries, etc, which look very different from the to-do list. If you could get hold of the C "to-do" list, it looks somewhat like the python code, just in a different language.
7
3
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
Why do C programs require decompilers but python programs dont?
0
0
0
801
3,869,435
2010-10-06T04:07:00.000
5
1
1
0
python,c,decompiling
3,869,458
11
false
0
1
This is sorta a big topic. You should look into your local friendly Computer Science curriculum, you'll find a lot of great stuff on this subject there. The short answer is the Python is an "interpreted" language, which means that it requires a machine language program (the python interpreter) to run the python program, adding a layer of indirection. C or C++ are different. They are compiled directly to machine code, which runs directly on your processor. There is a lot of additional voodoo to be learned here, however. Technically Python is compiled to a bytecode, and modern interpreters do more and more "Just in Time" compilation, so the boundaries between compiled and interpreted code are getting fuzzier all the time.
7
3
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
Why do C programs require decompilers but python programs dont?
0.090659
0
0
801
3,869,435
2010-10-06T04:07:00.000
1
1
1
0
python,c,decompiling
3,869,445
11
false
0
1
because C code is complied to object (machine) code and python code is compiled into an intermediate byte code. I am not sure if you are even referring to the byte code of python - you must be referring to the source file itself which is directly executable (hiding the byte code from you!). C needs to be compiled and linked.
7
3
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
Why do C programs require decompilers but python programs dont?
0.01818
0
0
801
3,869,435
2010-10-06T04:07:00.000
0
1
1
0
python,c,decompiling
3,869,451
11
false
0
1
Python scripts are parsed and converted to binary only when they're run - i.e., they're text files and you can read them with an editor. C code is compiled and linked to an executable binary file before they can be run. Normally, only this executable binary file is distributed - hence you need a decompiler. You can always view the source code, if you've access to it.
7
3
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
Why do C programs require decompilers but python programs dont?
0
0
0
801
3,869,435
2010-10-06T04:07:00.000
0
1
1
0
python,c,decompiling
3,874,099
11
false
0
1
G-WAN executes ANSI C scripts on the fly -making it just like Python scripts. This can be server-side scripts (using G-WAN as a Web server) or any general-purpose C program and you can link any existing library. Oh, and G-WAN C scripts are much faster than Python, PHP or Java...
7
3
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
Why do C programs require decompilers but python programs dont?
0
0
0
801
3,869,435
2010-10-06T04:07:00.000
10
1
1
0
python,c,decompiling
3,869,443
11
false
0
1
Python is a script language, runs in a virtual machine through an interpeter. C is a compiled language, the code compiled to binary code which the computer can run without all that extra stuff Python needs.
7
3
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
Why do C programs require decompilers but python programs dont?
1
0
0
801
3,869,435
2010-10-06T04:07:00.000
2
1
1
0
python,c,decompiling
3,869,460
11
false
0
1
Yes, you can - it's called disassembling, and allows you to look at the code of Safari perfectly well. The thing is, C, among other languages, compiles to native code, i.e. code that your CPU can "understand" and execute. More or less obviously, the level of abstraction present in the instruction set of your CPU is much smaller than that of a high level language like Python. The CPU instructions are not concerned with "downloading that URI", but more "check if that bit is set in a hardware register". So, in conclusion, the level of complexity present in a native application is much higher when looking at the machine code, so many people simply can't make any sense of what is going on there, it's hard to get the big picture. With experience and time at your hands, it is possible though - people do it all the time, reversing applications and all.
7
3
0
If I write a python script, anyone can simply point an editor to it and read it. But for programming written in C, one would have to use decompilers and hex tables and such. Why is that? I mean I simply can't open up the Safari web browser and look at its code.
Why do C programs require decompilers but python programs dont?
0.036348
0
0
801
3,869,517
2010-10-06T04:34:00.000
0
1
0
0
python,image,python-imaging-library
3,869,781
3
false
0
0
In a pinch, convert the Image to a numpy array, modify it as you please, and convert back.
1
4
0
What I'm trying to do: I want to give the user the ability to upload a picture that is any size. This image is then resized if it is over 1024 wide or over 768 high. It then resizes the image to be within those bounds, but keeping proportions. Then it adds a semi-transparent watermark to the lower right corner, and saves the file. Before it adds the watermark, it will create a copy of the image and resize it down to a thumbnail size (also keeping proportions) and saves it in a separate folder. The Problems with PIL: As far as resizing goes, I was hoping it would have a way to do smart resizing (keep proportions). Also, I didn't seem to have much control over the quality level when saving it as a JPEG. I had to save it as a PNG to keep full quality which was pretty heavy. For the thumbnail, it sounds that it might be pretty difficult, reading through the documentation of PIL, but I could be wrong. The Question Are there any other, more advanced image libraries for Python that may be a bit more up to date, or include some features that I am looking for? Are there any public functions that do what I'm looking for that I could use? I don't mind writing this stuff myself, but wanted to check first. Thanks!
Simple Image Manipulation with Python
0
0
0
5,217
3,871,145
2010-10-06T09:32:00.000
2
0
0
0
python,validation,pylons
3,871,201
1
true
1
0
Having it all in one method, and detecting if the form has been posted via a check on request.method. This works okay, but it seems clumsy to have if request.method == 'post': ... else: ... I am not sure why you describe this as clumsy. Switching on request method is a valid idiom in the web app world across languages. For e.g. you'll find Django views having a single view that handles requests differently based on request.method. Similarly in Java, Servlets have doPost() and doGet() methods to provide different behavior for GET and POST requests. Update I'd just rather have them separated into different methods, if possible. Many other web frameworks do this Nothing wrong with this approach either. I was merely pointing out that having the same method handle them is equally valid.
1
1
0
What's the best way to handle form POST data in my Pylons app? I've tried: Having a seperate GET method and a POST method with a rest.restrict('post') decorator. Problem -- if there were validation errors then you can't redisplay the form with the data which the user entered because you have to redirect back to the GET method OR you have to render the template directly from the POST method. Unfortunately this looks weird, as the URL has to change to correspond to the POST action. Having it all in one method, and detecting if the form has been posted via a check on request.method. This works okay, but it seems clumsy to have if request.method == 'post': ... else: ...
Pylons - Handling GET and POST requests
1.2
0
0
1,052
3,871,613
2010-10-06T10:38:00.000
1
0
0
0
python,web-crawler,scrapy
8,830,983
5
false
1
0
I think jama22's answer is a little incomplete. In the snippet if self.FILTER_VISITED in x.meta:, you can see that you require FILTER_VISITED in your Request instance in order for that request to be ignored. This is to ensure that you can differentiate between links that you want to traverse and move around and item links that well, you don't want to see again.
2
15
0
Im using scrapy to crawl a news website on a daily basis. How do i restrict scrapy from scraping already scraped URLs. Also is there any clear documentation or examples on SgmlLinkExtractor.
Scrapy - how to identify already scraped urls
0.039979
0
1
9,648
3,871,613
2010-10-06T10:38:00.000
1
0
0
0
python,web-crawler,scrapy
13,578,588
5
false
1
0
Scrapy can auto-filter urls which are scraped, isn't it? Some different urls point to the same page will not be filtered, such as "www.xxx.com/home/" and "www.xxx.com/home/index.html".
2
15
0
Im using scrapy to crawl a news website on a daily basis. How do i restrict scrapy from scraping already scraped URLs. Also is there any clear documentation or examples on SgmlLinkExtractor.
Scrapy - how to identify already scraped urls
0.039979
0
1
9,648
3,872,033
2010-10-06T11:41:00.000
0
0
0
0
javascript,python,pyqt,qtwebkit
3,886,529
2
false
1
1
Could you post some source code? Once downloaded that data will stay in the /tmp/ folder for some time. You could likely use the data in the temp folder, my guess is you are not enforcing that policy.
1
1
0
I have a QWebView in my app which renders a html page stored in the app as a Qresource. This page, however requires meaty external Javascript libraries such as MathJax, which I would want to include as a resource due to its size. My problem is that it seems that QtWebkit does not cache these files as a regular browser would do, and every time I refresh the widget it downloads MathJax afresh. So my question is: is there any way to cache these libraries after first time they are downloaded, without having resorting to shipping it with the app as resource?
Caching external javascript for a QtWebkit widget in a PyQt app
0
0
0
1,071
3,872,861
2010-10-06T13:19:00.000
7
0
1
0
python,lua,bytecode,disassembly
3,877,403
4
false
0
0
The luac utility that comes with standard lua can create an assembly listing from Lua source using its -l option. For example, compiling from source on stdin: C:...> echo a=b | luac -l - main (3 instructions, 12 bytes at 00334C30) 0+ params, 2 slots, 0 upvalues, 0 locals, 2 constants, 0 functions 1 [1] GETGLOBAL 0 -2 ; b 2 [1] SETGLOBAL 0 -1 ; a 3 [1] RETURN 0 1 C:...>
2
7
0
In Python you have the ability to view the compiled bytecode of a user-defined function using dis. Is there a builtin equivalent to this for Lua? It would really useful!
Lua equivalent to Python dis()?
1
0
0
1,475
3,872,861
2010-10-06T13:19:00.000
0
0
1
0
python,lua,bytecode,disassembly
3,877,406
4
false
0
0
You can also use luac -l to compile a lua file and output the disassembly.
2
7
0
In Python you have the ability to view the compiled bytecode of a user-defined function using dis. Is there a builtin equivalent to this for Lua? It would really useful!
Lua equivalent to Python dis()?
0
0
0
1,475
3,873,115
2010-10-06T13:47:00.000
1
0
1
0
python
3,873,296
1
true
0
0
My question is whether that's sane It's sane. Doing import fish adds just one name to your namespace, that is not "namespace clutter". It's pretty much the big idea behind modules, grouping many things under one name! When you want to know what a module does, look at the documentation or call help, don't do dir. All names in Python are stored in dictonaries. This means that no matter how many names you see, looking up one of them takes constant time. So there is no speed drawback of any kind either.
1
2
0
I've noticed sometimes if you call dir() on a package/module, you'll see other modules in the namespace that were imported as part of the implementation and aren't meant for you to use. For instance, if I install the fish package from PyPI and import it, I see fish.sys, which just refers to the built-in sys module. My question is whether that's sane and what to do about it if it's not. I don't think the __all__ variable is too relevant, since that only affects the behavior of from X import *. The options I see are: structure your packages better, and at least push the namespace clutter down into submodules use import X as _X in your package to distinguish implementation details from your package API import things from inside your functions (blegh)
Keeping imported modules out of python package namespaces
1.2
0
0
208
3,873,212
2010-10-06T13:56:00.000
1
0
1
0
.net,vb.net,ironpython
3,873,713
1
true
0
0
The full name for the method is Microsoft.VisualBasic.DateAndTime.Year(DateTime). This is a compat function. Since you need to pass a DateTime argument anyway, you might as well use its Year property. Albeit that the VB version can be different because it uses the current culture calendar's GetYear() method. In other words, in Israel your program might get the year since the destruction of the temple in Jerusalem (I think). Not sure if that should be intentional in your case.
1
0
0
Since it's possible using the IsNumeric() and others VB.NET functions from IronPython by importing Microsoft.VisualBasic and using it as an object method, is it possible somehow to use the Year() VB.NET function from IronPython?
using the VB.NET Year function from IronPython
1.2
0
0
163
3,873,294
2010-10-06T14:04:00.000
20
0
1
0
python,virtualenv
3,874,179
2
false
1
0
I think all you have to do is create an empty file called no-global-site-packages.txt and put it into the virtualenv's python2.x folder (eg, lib/python2.6/, the one with all the modules). Then the normal site.py generated by virtualenv detects the difference and handles everything from there.
1
14
0
I can create a new virtualenv that ignores global site-packages with "--no-site-package". Is it possible to change an existing virtualenv (which was created without "--no-site-package") to also ignore the global site-packages? (So that it workes like it was created with "--no-site-package" in the first place.) thanks in advance, Sebastian
Can I change an an existing virtualenv to ignore global site packages? (like --no-site-package on a new one)
1
0
0
5,667
3,874,280
2010-10-06T15:41:00.000
1
0
1
0
javascript,jquery,python,html,parsing
3,874,358
4
false
1
0
jQuery itself does not contain an HTML/XML parser at all. It uses the browser to do all its parsing. Thus, even if you figure out how to run Javascript from Python, it won't do you any good.
1
3
0
I am attempting to create an html document parser with Python. I am very familiar with jQuery and I would like to use its traversing functionality to parse these html files and return the data gathered with jQuery back to my Python program. Is there any way to use javascript scripts through Python? Or is this just a pipe dream?
Javascript Execution Through Python
0.049958
0
0
624
3,874,422
2010-10-06T15:54:00.000
0
0
0
1
python,django,celery
58,684,713
4
false
1
0
After 5+ years of writing Celery tasks I have noticed a pattern I have developed that can help with testing and ease of development - I realised it is much better if my Celery tasks are thin wrappers around the regular Python functions that I typically put in myproject.impl package. Celery tasks may contain some strictly Celery related logic, like using distributed locking for an example, explicit retry logic, etc.
1
29
0
In development, it's a bit of a hassle to run the celeryd as well as the Django development server. Is it possible to, for example, ask celery to run tasks synchronously during development? Or something similar?
Developing with Django+Celery without running `celeryd`?
0
0
0
9,748
3,874,837
2010-10-06T16:37:00.000
0
0
1
0
python,compression,gzip,tar
3,874,884
4
false
0
0
As larsmans says, gzip compression is not used for directories, only single files. The usual way of doing things with linux is to put the directory in a tarball first and then compress it.
1
12
0
I'm creating Python software that compresses files/folders... How would I create a section of the code that asks for the user input of the folder location and then compresses it. I currently have the code for a single file but not a folder full of files. Please explain in detail how to do this.
How do I compress a folder with the Python GZip module?
0
0
0
24,451
3,876,114
2010-10-06T19:20:00.000
2
1
0
0
python,ssh-keys
3,876,193
3
false
0
0
Do you need the answer to be strictly python? You can do this with ssh-keygen -y -f privatekey
1
0
0
... or if not, can you provide me link or RFC number to full algorithm (from getting ASCII encoded Private key file/string to generation of ASCII encoded public key file/string). To show you a bigger picture - I started using a pylibssh2 library. This library has a method - userauth_publickey_fromfile (it raises NotImplementedException, but when you force launching python binding - it works). The problem is that this method wants private key (good) and public key (hell knows why). Of course, I can pass both of those keys as argumets to my functions, but I think it is unnecessary, and I don't want to expect one more variable just for that. So I want to generate public key from private one by myself. Maybe I'm missing something in pylibssh2 or even in libssh2 itself (I can write bindings for that as well) ? Thanks for any help!
Is there any way to generate public SSH key from private one using Python?
0.132549
0
0
1,486
3,876,348
2010-10-06T19:57:00.000
1
0
1
0
python,linux,file,pyinotify
3,876,723
3
false
0
0
If you have control of the writing process, you could call the file "foo.part" while it is being written to and rename it to "foo" when it has been closed.
1
7
0
I'm using pyinotify to watch a folder for when files are created in it. And when certain files are created I want to move them. The problem is that as soon as the file is created (obviously), my program tries to move it, even before it's completely written to disk. Is there a way to make pyinotify wait until a file is completely written to disk before notifying me that it's been created? Or is there any easy way to, after I'm notified, make python wait to move it until it's done being written?
Using pyinotify to watch for file creation, but waiting for it to be completely written to disk
0.066568
0
0
4,949
3,877,631
2010-10-06T23:28:00.000
0
1
0
0
python,google-app-engine,ip-address
3,877,766
1
true
1
0
I believe that I have figured out the reason for seeing so many warnings from google server IP addresses. It seems that immediately after a new user registers, the google crawlers are going to the same (registration) webpage (which I send information to as a GET instead of a POST for reasons which I will not get into). Of course, since many users are registering, but there are only a few crawler computers that are checking periodic updates to my website, I am triggering warning messages that a particular (google) IP is accessing a registration area repeatedly.
1
0
0
In order to make the registration process on my website easy, I allow users to enter their email address which I will send a verification code to or alternatively they can solve a captcha. The problem is that in order to prevent robots from registering accounts (with fake emails) I limit the number of registrations allowed per IP address and if this limit is exceeded I trigger a warning in the logs. However ... what seems to be happening is that I am using os.environ['REMOTE_ADDR'] to check the remote address -- but it seems that I am triggering warnings on addresses that are owned by Google (66.249.65.XXX). It is possible that this is happening only after I change the version (but not confirmed). Does anyone know how/why this might be happening? Shouldn't the REMOTE_ADDR return the address of the client computer (and hopefully in all cases it would do this)? I am curious if there is some behind the scenes re-directions going on, and if this is a normal event or if it only happens when a new version is installed (perhaps when a new version is installed the original server then proxies the user to the new server, therefore creating the illusion that the IP address is an internal IP?)
Google App Engine (Python)- Strange behaviour of REMOTE_ADDR
1.2
0
0
438
3,877,971
2010-10-07T00:54:00.000
2
1
0
0
python,pygame,3d-engine,panda3d
6,589,557
3
false
0
1
Been using Vizard for various VR and AR development for about 3 yrs now - it's NOT unity - i.e. a web enabled game engine (excellent though it is) - what Vizard provides is a highly optimized OpenGL engine, wrapped in user friendly python scripting environment BUT on top of this you get the ability to seamlessly distribute your simulations over a cluster or a network. Vizard keeps all things completely synched - invisible to the user. Connects to pretty much all known VR tracking equipment and display periphals and standard gaming equipment is also supported (Wiimote & Kinnect). Native support for frame sequential, side-by-side and anaglyph stereo, spatial sound engine and the ability to extend it with C and C++ plugins or GLSL shaders. Didn't actually mean to write that much and I don't want to come across as a Vizard evangelist, it is not perfect, BUT comparing it to Panda3D, Unity or other game engines I feel is an unfair comparison - not like-for-like :o)
2
1
0
Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.
How does Worldviz Vizard compares to Panda3D and Pygame?
0.132549
0
0
1,459
3,877,971
2010-10-07T00:54:00.000
0
1
0
0
python,pygame,3d-engine,panda3d
4,122,231
3
false
0
1
I only used Vizard, and that for one small project. It was easy to use, well documented, and had a good set of examples.
2
1
0
Is anybody familiar with Worldviz-Vizard's 3D engine for python? How does it compare to Panda3D? I have a feeling that it might be easier to learn but far more limited. They only support python 2.4 which also makes me not want to try it.
How does Worldviz Vizard compares to Panda3D and Pygame?
0
0
0
1,459
3,878,479
2010-10-07T03:33:00.000
0
1
1
0
python
3,878,507
2
false
0
0
Compiling the main script would be annoying for scripts in e.g. /usr/bin. The .pyc file is generated in the same directory, thus polluting the public location.
1
33
0
I understand that when you import a module, that file is compiled into a .pyc file to make it faster? Why is the main file also not compiled to a .pyc? Does this slow things down? Would it be better to keep the main file as small as possible then, or does it not matter?
Why are main runnable Python scripts not compiled to pyc files like modules?
0
0
0
26,157
3,878,593
2010-10-07T04:10:00.000
8
0
1
0
python
3,878,615
3
true
0
0
Depends. There are a few parts of the Python standard libraries that are only available on certain platforms. These parts are noted in the Python documentation. You also need to be careful of how you handle things like file paths - using os.path.join() and such to make sure paths are formatted in the right way.
2
2
0
If I write a python script using only python standard libraries, using Python 2.6 will it work on all Operating Systems as long as python 2.6 is installed?
Python programs on different Operating Systems
1.2
0
0
460
3,878,593
2010-10-07T04:10:00.000
0
0
1
0
python
3,878,609
3
false
0
0
yes, unless you are using modules that are os dependent. Edit : My reply seemed short and not too the point based on comments I am not addressing portable programming in general. That would mean taking care of binary data packing and manipulation, c extension issues, paths as in windows/unix, "\r\n" in windows text and many others. But with regard to portability of the python modules, there is no question. They are portable. How ever, there are modules that are available on specific platform only and if you use them, then your portability will be curtailed.
2
2
0
If I write a python script using only python standard libraries, using Python 2.6 will it work on all Operating Systems as long as python 2.6 is installed?
Python programs on different Operating Systems
0
0
0
460
3,878,873
2010-10-07T05:13:00.000
0
0
0
0
c#,c++,python,image,lua
3,895,535
5
false
0
1
Opencv has functions named like "cvHoughLines2" to detect lines.
4
0
0
How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.
transforming an image into an array of lines to draw
0
0
0
515
3,878,873
2010-10-07T05:13:00.000
1
0
0
0
c#,c++,python,image,lua
3,880,279
5
true
0
1
You are looking for a "raster to vector" algorithm. The term comes from early graphics display systems, that used a CRT (cathode ray tube) for the display itself. There were 2 approaches to displaying graphics: "raster" was the scan of a series of lines left to right, top to bottom, each line made up of on/off pixels. The controller of the CRT's electron gun simply scanned the same pattern over and over, just varying the intensity of the electron beam. On a "vector" display, the electron gun could draw a straight line between any two points - no aliasing, no pixelation, just a pure straight line. Vector displays were capable of higher resolution, but were limited by the number of lines they could draw - if a drawing had too many lines, then the display would begin to flicker as the time it would take to redraw the picture (to refresh the phosphors of the CRT) would take longer than the persistence of the CRT's phosphor surface. Raster displays were simpler to control, had much less flicker, but lower resolution.
4
0
0
How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.
transforming an image into an array of lines to draw
1.2
0
0
515
3,878,873
2010-10-07T05:13:00.000
1
0
0
0
c#,c++,python,image,lua
3,879,121
5
false
0
1
In general, bitmaps are stored in sequential memory, ideal for 'blitting' to the display; your GUI framework of choice will have a function for drawing bitmaps, and this function will be very carefully optimised. On the other hand, decomposing an image into lines - vectorizing the image - is the domain of specialist programs and ongoing research. In all cases, its going to be slower to computer and slower to draw than just blitting the bitmap.
4
0
0
How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.
transforming an image into an array of lines to draw
0.039979
0
0
515
3,878,873
2010-10-07T05:13:00.000
0
0
0
0
c#,c++,python,image,lua
3,879,102
5
false
0
1
How can you achieve with lines what you have to do with pixels? You need to draw each pixel individually I'd say.
4
0
0
How do I generate a list of lines to draw if I have pixel data for an image, so I don't have to draw every pixel? Any language will do, although I listed what I have a working knowledge for. C is ok as well. There was a limit to how many tags I could choose. Also, you can just point me toward an algorithm.
transforming an image into an array of lines to draw
0
0
0
515
3,879,265
2010-10-07T06:38:00.000
0
1
1
0
python,client,imaplib,gmail-imap,email-threading
34,061,867
2
false
0
0
As far as i know, Gmail uses an algorithm that is private, and it's not stated in RFCs. They use a combination of headers (like in-reply-to and references) and considering subject (but in a different way that THREAD=references does).
1
4
0
I want to create a gmail client with the ability to view emails as conversations (threads). In imaplib, there is a method: IMAP4.thread(threading_algorithm, charset, search_criterion[, ...]) I think it could be the solution. Anybody has experience using it? Please give an example. Thanks.
How to use thread search method in imaplib?
0
0
0
1,250