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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10,804,353 | 2012-05-29T18:04:00.000 | 0 | 0 | 1 | 0 | python,multithreading,activex | 10,804,788 | 2 | false | 0 | 0 | It's hard to say anything without seeing the code, but chances are that either:
Your ActiveX simply does not support multithreading (many of them do not) and you try to work with the object from different threads.
The DLL containing the ActiveX performs some per-thread initialization, but when you call it from another... | 1 | 1 | 0 | I have an ActiveX (COM) DLL that makes windows system calls (such as ReadFile() and WriteFile()). It works fine from the main Python GUI thread. But crashes my Python GUI when called from a thread. I am doing some research online and am thinking I need to do something with the GIL. Am I on the right track? Or please po... | ActiveX DLL called from Python thread | 0 | 0 | 0 | 398 |
10,805,356 | 2012-05-29T19:22:00.000 | 3 | 0 | 0 | 0 | java,python,image-processing,rgb | 10,807,433 | 4 | true | 0 | 0 | Typical white-balance issues are caused by differing proportions of red, green, and blue in the makeup of the light illuminating a scene, or differences in the sensitivities of the sensors to those colors. These errors are generally linear, so you correct for them by multiplying by the inverse of the error.
Suppose you... | 1 | 1 | 1 | I am working on a telescope project and we are testing the CCD. Whenever we take pictures things are slightly pink-tinted and we need true color to correctly image galactic objects. I am planning on writing a small program in python or java to change the color weights but how can I access the weight of the color in a... | Change color weight of raw image file | 1.2 | 0 | 0 | 1,116 |
10,805,751 | 2012-05-29T19:52:00.000 | 0 | 0 | 0 | 0 | python,canvas,tkinter | 10,807,933 | 2 | false | 0 | 1 | Assuming your code to display the data is correct, the only conclusion I can draw is that either you "load another data" function isn't actually loading anything, or your "display on canvas" code is not being given tne newly loaded data.
The other possibility is that there is an error in your drawing code that is gett... | 1 | 0 | 0 | I have been working on a Gui-based program using Tkinter. It needs data to display and there are a lot of different data. I tried to do it, but it did not show the right result. I mean, it cannot display other datasets and it just displays the first dataset.
Simply, its procedure is as following:
Load 1st data
Display... | How to apply to new data on tkinter's canvas | 0 | 0 | 0 | 583 |
10,807,246 | 2012-05-29T21:54:00.000 | 7 | 0 | 1 | 0 | python,github,pip | 10,807,359 | 1 | true | 0 | 0 | No it is not 100% "safe", github can go down while you need to checkout the source, the author can delete the repository (or do some disrupting change to it) ecc. ecc.
With pip you can specify a revision or a tag together with the repository link
eg.
git+git://github.com/misterx/projectname.git@840d25bb9db9fbc801b9
thi... | 1 | 6 | 0 | It is possible to use pip to install from a git repo using command
pip install git+https://github.com/...
but is this safe for a production environment? Is there a way to protect from it being deleted without forking it, hosting myself, and merging any future updates? | Is it safe to use pip with a git repo? | 1.2 | 0 | 0 | 212 |
10,809,214 | 2012-05-30T02:24:00.000 | 0 | 0 | 1 | 0 | python,oop,method-resolution-order | 10,809,219 | 3 | false | 0 | 0 | The jumps are caused by your functions calling another function which in tern calls another function. | 1 | 0 | 0 | I am trying to read some source code from some open source python project, like ipython. I often find it hard to follow the execution flow of methods in different classes, even using eclipse's debug tool and execute the code step by step. I don't quite know why the code jumps to certain methods in a distantly related c... | How to follow the method execution in python | 0 | 0 | 0 | 394 |
10,811,112 | 2012-05-30T06:36:00.000 | 2 | 1 | 1 | 0 | python,python-3.x,lamp,python-2.x | 10,811,163 | 3 | false | 0 | 0 | mod_wsgi didn't really work with 3.x until 3.2, so I'd stick with 2.7 for now. | 1 | 0 | 0 | I'm going to be building web pages and web interfaces. So far I have been using LAMP stack with PHP. I want to shift to python. Which of the two Python versions (2.7 or 3.1) is better for this use? | Python 2.7 or 3.0 for LAMP | 0.132549 | 0 | 0 | 670 |
10,811,720 | 2012-05-30T07:21:00.000 | 2 | 0 | 0 | 0 | python,pdf-generation,reportlab | 10,826,660 | 1 | true | 1 | 0 | If this is what you are tying to do you should look at using Platypus with ReportLab, a built in set of classes in ReportLab for building documents out of objects representing page elements. Or, if you want really simple, xhtml2pdf would probably be better. | 1 | 3 | 0 | For one of my python project I am using reportlab's canvas feature to generate pdf document.
Can anyone please help me to print small subset of html (p, strong, ul, ol, li, img, alignments) on reportlab canvas?
Thanks in advance... | Python: Printing Html in PDF using Reportlab Canvas | 1.2 | 0 | 1 | 4,178 |
10,814,353 | 2012-05-30T10:19:00.000 | 3 | 0 | 0 | 0 | python,integration,scipy,integral | 39,332,002 | 2 | false | 0 | 0 | There is only one method in SciPy that does cumulative integration which is scipy.integrate.cumtrapz() which does what you want as long as you don't specifically need to use the Simpson rule or another method. For that, you can as suggested always write the loop on your own. | 1 | 7 | 1 | I am trying to port from labview to python.
In labview there is a function "Integral x(t) VI" that takes a set of samples as input, performs a discrete integration of the samples and returns a list of values (the areas under the curve) according to Simpsons rule.
I tried to find an equivalent function in scipy, e.g. s... | Using scipy to perform discrete integration of the sample | 0.291313 | 0 | 0 | 26,770 |
10,815,286 | 2012-05-30T11:22:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 10,818,524 | 2 | false | 1 | 0 | When your user goes to the login url, there is a red SIGN UP button on the top. They can go sign up there.
It took me a second to find too, unfortunately you can't change the login page. | 1 | 0 | 0 | I am using GAE with python and I can ask users to sign in with Google using:
loginURL = (users.create_login_url(self.request.path))
This gives me a link that lets users sign in and get redirected to my site.
However some users do not have a Google ID,
Is there any way to let them sign up for one and be redirected to my... | Have user sign up with Google and get redirected back to the site afterwards? | 0.099668 | 0 | 0 | 688 |
10,816,962 | 2012-05-30T13:09:00.000 | 1 | 0 | 1 | 0 | python,ruby-on-rails,ruby,deployment,scrapy | 10,817,852 | 1 | true | 1 | 0 | Are all your (DTAP) environments using the same operating system and processor architecture?
If not, I wouldn't recommend shipping the Python interpreter with your project. Why don't you compile a more recent version of Python on your environments and install it in some non-standard path, like /opt/python27/ (or simili... | 1 | 0 | 0 | I have a Ruby on Rails project, using Python + Scrapy to scrape the web, and I would like to distribute and deploy the Rails project with all Python executables and libraries installed automatically.
The deployment environment ships by default a Python version lower than 2.6, and I would like users not to depend on OS... | Setting up a Python environment in a Rails project | 1.2 | 0 | 0 | 303 |
10,820,406 | 2012-05-30T16:29:00.000 | 1 | 0 | 1 | 0 | python,import,module,environment,virus | 10,820,509 | 2 | false | 0 | 0 | One option may be to do virtualization of different environments, either at a lower level, like with VirtualBox (https://www.virtualbox.org/), or at a higher level, like with virtualenv (http://pypi.python.org/pypi/virtualenv). | 1 | 1 | 0 | python 2.7
windows 7
I wan't to download a bunch of modules and run them. the programmer of these modules could make them contain a virus. to prevent this I would like to run these modules in an environment that won't let it import any modules unless I specify that it can import that certain module (a module I would le... | how to import a module in environment that won't let it be a hazard to my computer? (python) | 0.099668 | 0 | 0 | 70 |
10,821,300 | 2012-05-30T17:31:00.000 | 3 | 0 | 1 | 1 | python,windows,batch-file | 10,821,382 | 5 | true | 0 | 0 | You can't "send" a string. You can print it out and have the calling process capture it, but you can only directly return numbers from 0 through 255. | 2 | 3 | 0 | I have a batch file that runs a python script. I am running Python 3.2. I want to send a variable like an integer or string from the python script back to the batch file, is this possible?
I know I can accept command line arguments in the Python script with sys.argv. Was hoping there was some feature that allows me to ... | Python script to Batch file | 1.2 | 0 | 0 | 13,915 |
10,821,300 | 2012-05-30T17:31:00.000 | 1 | 0 | 1 | 1 | python,windows,batch-file | 10,821,423 | 5 | false | 0 | 0 | Ignacio is dead on. The only thing you can return is your exit status. What I've done previously is have the python script (or EXE in my case) output the next batch file to be run, then you can put in whatever values you'd like and run it. The batch file that calls the python script then calls the batch file you create... | 2 | 3 | 0 | I have a batch file that runs a python script. I am running Python 3.2. I want to send a variable like an integer or string from the python script back to the batch file, is this possible?
I know I can accept command line arguments in the Python script with sys.argv. Was hoping there was some feature that allows me to ... | Python script to Batch file | 0.039979 | 0 | 0 | 13,915 |
10,821,741 | 2012-05-30T18:00:00.000 | 0 | 0 | 1 | 0 | python,gnupg | 10,824,962 | 2 | false | 0 | 0 | Having re-read your question again after reading the python-gnupg documentation, I think you're asking about signing a document with several private keys at the same time you are encrypting it.
Unfortunately, that process is not supported by python-gnupg, because GnuPG does not support it either. You'll have to decide ... | 1 | 0 | 0 | I am encrypting a file using python-gnupg and it looks like encrypt_file onlys accepts a single key for the sign parameter. If I have a key file with multiple keys that I want to encrypt the document with, how can I do this? If I understand correctly I should be able to encrypt a file using multiple keys. | Encrypt a file in python-gnupg using multiple keys | 0 | 0 | 0 | 1,486 |
10,822,265 | 2012-05-30T18:39:00.000 | 0 | 0 | 1 | 0 | python,arrays,text,paragraph | 10,822,336 | 2 | false | 0 | 0 | Yes, there is a very easy way to do this. You parse the text file line by line. Store each line in a temp object. If a line is only one char long, and it is the new line char, then assign that temp object to the appropriate array position, then start appending the lines into the a new temp object. Look up basic pyt... | 1 | 1 | 0 | Is there an easy way in python to create an array entry for each paragraph in a text file with the new line character being the demarcation for a new entry?
The idea being that if my doc has 5 paragraphs with a new line between each, there will be 5 separate entries in the array.
Thanks. | create array entry for each paragraph in a text file | 0 | 0 | 0 | 3,427 |
10,823,033 | 2012-05-30T19:34:00.000 | 0 | 1 | 0 | 1 | python,batch-file,windows-xp | 69,202,173 | 2 | false | 0 | 0 | Another option is to write arguments right after the python script, following the example:
python your_script.py this that
If you are using Linux .sh file, remember to run dos2unix XXX.sh before you run:
bash XXX.sh.
The reason, in a simple version, is that dos and unix use different newline breakers. | 1 | 10 | 0 | I'm running Python 3.2 on Win XP. I run a python script thru a batch file via this:
C:\Python32\python.exe test.py %1
%1 is an argument that i pass to do some processing in the python script.
I have 2 variables in the batch file that I also want to send as arguments to the python script.
set $1=hey_hi_hello
set $2=hey... | Sending arguments from Batch file to Python script | 0 | 0 | 0 | 45,693 |
10,823,285 | 2012-05-30T19:52:00.000 | 3 | 0 | 0 | 0 | python,pygame | 10,823,436 | 2 | false | 0 | 1 | Colorkey lets you pick one color in a sprite (surface); any pixel of that color will be completely transparent. (If you remember .gif transparency, it's the same idea.)
'alpha' is a measure of opacity - 0 for completely transparent, 255 for completely opaque - and can be applied to an entire sprite (as an alpha plane) ... | 2 | 1 | 0 | I am new to using pygame and I was wondering if someone could explain the use of alpha values? I don't quite understand the difference between that and colorkey.
For my current situation I think I want to use alpha values but am not quite clear how.
In my game I have two sprites with .png files loaded to each surfac... | Pygame alpha values | 0.291313 | 0 | 0 | 399 |
10,823,285 | 2012-05-30T19:52:00.000 | 0 | 0 | 0 | 0 | python,pygame | 51,940,966 | 2 | false | 0 | 1 | Although if you want the sprites to fade until they've vanished, gradually reduce the alpha value after they've collided. When alpha reaches 0, use del sprite if you don't need the sprites anymore. | 2 | 1 | 0 | I am new to using pygame and I was wondering if someone could explain the use of alpha values? I don't quite understand the difference between that and colorkey.
For my current situation I think I want to use alpha values but am not quite clear how.
In my game I have two sprites with .png files loaded to each surfac... | Pygame alpha values | 0 | 0 | 0 | 399 |
10,824,112 | 2012-05-30T20:54:00.000 | 0 | 0 | 0 | 0 | user-interface,wxpython | 10,824,301 | 1 | true | 0 | 1 | If you are just starting out on GUI programming in Python I'll strongly recommend ditching wxPython for PySide/PyQt4. It has a simpler API and Qt-Designer is one of the best drag 'n' drop GUI designer I've used. Plus PySide/PyQt4 is well documented. | 1 | 2 | 0 | What is the best drag and drop GUI builder for wxPython?
I've tried wxGLade, but I strongly dislike it. | Best drag and drop GUI builder for wxPython | 1.2 | 0 | 0 | 1,452 |
10,824,532 | 2012-05-30T21:28:00.000 | 0 | 0 | 1 | 0 | python,python-2.7 | 10,825,322 | 1 | true | 0 | 0 | How much processing is there per line.
If not a lot then you might slow things down with multiple threads contending for the device the file is on? You might want to split the file beforehand and put the components on different devices? Then it's a simple matter of firing up a process per file or per group of files.
I'... | 1 | 0 | 0 | I have a huge file with hundreds of thousands of lines. I need to run the same process on each line. My plan was to make several threads to speed up the process. Whenever I multithreaded before I used treading and Queue modules. However I cannot figure out how to apply a queue. What I really need to do is read the fil... | threads with readline | 1.2 | 0 | 0 | 294 |
10,824,951 | 2012-05-30T22:08:00.000 | 1 | 0 | 1 | 0 | python,image,image-processing,python-imaging-library | 10,825,016 | 1 | true | 0 | 0 | You should pick a location to save the image when setting the filename variable.
filename = "/Users/clifgray/Desktop/filename.jpeg"
imgObj.save(filename) | 1 | 0 | 0 | I am using the Image.save method from PIL and I cannot find where the file is being placed. I have done a system search yet still no luck.
My code looks like this:
print imageObj.save(fileName, "JPEG")
and gives the proper None response to say that it is working. Any idea where they go and how I can find them?
Th... | Where does Python Imaging LIbrary Save Objects | 1.2 | 0 | 0 | 1,490 |
10,825,597 | 2012-05-30T23:16:00.000 | 1 | 0 | 0 | 0 | python,wxpython,wx.textctrl | 16,593,067 | 1 | false | 0 | 1 | I would stay away from trying to reimplement text selection controls if at all possible, since that is bound to turn very messy very fast. Another way you could tackle this issue would be to use a single multi-line textctrl widget with the other widgets tacked on over it. This is also messy, but less so.
You can place... | 1 | 2 | 0 | So I currently have a ScrolledPanel that contains a number of TextCtrls that are placed in a vertical BoxSizer programmatically. The reason I'm doing this instead of just appending lines to one big scrolled TextCtrl is so that I can also add other controls in between the TextCtrl, such as images or stylized expand/cont... | Select text over multiple TextCtrls in wxpython | 0.197375 | 0 | 0 | 431 |
10,826,266 | 2012-05-31T01:12:00.000 | 1 | 0 | 0 | 0 | python,mysql,django,migration,django-south | 10,872,504 | 6 | false | 1 | 0 | South isnt used everywhere. Like in my orgainzation we have 3 levels of code testing. One is local dev environment, one is staging dev enviroment, and third is that of a production .
Local Dev is on the developers hands where he can play according to his needs. Then comes staging dev which is kept identical to product... | 2 | 22 | 0 | From someone who has a django application in a non-trivial production environment, how do you handle database migrations? I know there is south, but it seems like that would miss quite a lot if anything substantial is involved.
The other two options (that I can think of or have used) is doing the changes on a test dat... | Database migrations on django production | 0.033321 | 1 | 0 | 11,397 |
10,826,266 | 2012-05-31T01:12:00.000 | 0 | 0 | 0 | 0 | python,mysql,django,migration,django-south | 70,559,647 | 6 | false | 1 | 0 | If its not trivial, you should have pre-prod database/ app that mimic the production one. To avoid downtime on production. | 2 | 22 | 0 | From someone who has a django application in a non-trivial production environment, how do you handle database migrations? I know there is south, but it seems like that would miss quite a lot if anything substantial is involved.
The other two options (that I can think of or have used) is doing the changes on a test dat... | Database migrations on django production | 0 | 1 | 0 | 11,397 |
10,827,751 | 2012-05-31T05:09:00.000 | 3 | 1 | 0 | 0 | python,logging | 10,827,794 | 2 | true | 1 | 0 | logging uses a hierarchy of loggers. Add a handler to the root logger and it will receive logged messages from child loggers, too.
To access the root logger use logging.getLogger(). | 1 | 1 | 0 | I'm working with an application where just about every module and every class emits logging messages.
I need a way to capture every single one of those messages without explicitly attaching a handler via .addHandler() to each logging instance (which is what I'm doing right now).
Is there any way to attach a handler to ... | Intercepting all logging messages | 1.2 | 0 | 0 | 1,549 |
10,830,829 | 2012-05-31T09:25:00.000 | 0 | 0 | 0 | 0 | python,tomcat,jetty,data-migration,web-inf | 10,833,110 | 1 | false | 1 | 0 | The ".dbx" suffix has been used by various softwares over the years so it could be almost anything. The only way to know what you really have here is to browse the source code of the legacy java app (or the relevant doc or ask the author etc).
wrt/ scraping, it's probably going to be a lot of a pain for not much result... | 1 | 0 | 0 | I want to migrate data from an old Tomcat/Jetty website to a new one which runs on Python & Django. Ideally I would like to populate the new website by directly reading the data from the old database and storing them in the new one.
Problem is that the database I was given comes in the form of a bunch of WEB-INF/data/*... | migrating data from tomcat .dbx files | 0 | 0 | 0 | 126 |
10,831,865 | 2012-05-31T10:32:00.000 | 0 | 0 | 1 | 0 | python,dictionary | 10,831,946 | 3 | false | 0 | 0 | You can easily implement this with this logic.
Iterate over all the dictionaries in the list.
For each dictionary, see if it has the required key by using key in value statement.
If value is found, return the value from the function.
If you have iterated over all dictionaries, and value is not found, Raise KeyError e... | 1 | 0 | 0 | I know it is easy to implement.
I want a dictionary like class, which takes a list of dictionaries in the constructor.
If you read from this dict by key, the dict-class should check the list of dictionaries and return the first value. If none contains this key KeyError should be thrown like a normal dict.
This dictio... | List of dictionaries: get() schould loop over list | 0 | 0 | 0 | 89 |
10,832,531 | 2012-05-31T11:16:00.000 | 4 | 0 | 0 | 1 | python,twisted,irc,bots | 10,837,775 | 1 | true | 0 | 0 | No. You cannot send messages instantly. Control must return to the event loop. Fortunately, the problem you're really trying to solve (inferred from comments on the question), rate limiting the messages you send, doesn't require being able to do this. Instead, stop using time.sleep in a loop and start using reactor... | 1 | 3 | 0 | "Why does it take a long time for data I send with transport.write to arrive at the other side of the connection?"
Twisted can only send data after you give up control of execution to the reactor. For example, if you have an infinite loop writing data to a transport, the data will never actually be sent since control w... | Twisted irc python bot - buffering messages | 1.2 | 0 | 0 | 495 |
10,836,062 | 2012-05-31T14:56:00.000 | 3 | 0 | 0 | 0 | python,user-interface,wxpython | 10,837,325 | 3 | false | 0 | 1 | I'm not aware of a way to dynamically change the style flags on the text control widget after creation. Some widgets allow this sort of thing on some OSes and some do not. You could just create two text controls with the second one in normal mode and hide it. Then when you want to toggle, you grab the password-protecte... | 2 | 4 | 0 | With wxPython a password field could be created as:
wx.TextCtrl(frm, -1, '', style=wx.TE_PASSWORD )
I'm wondering if there is a way to dynamically change this password field into a normal textctrl, such that user could see what the password is. | how to make wxpython password textctrl show chars? | 0.197375 | 0 | 0 | 5,172 |
10,836,062 | 2012-05-31T14:56:00.000 | -1 | 0 | 0 | 0 | python,user-interface,wxpython | 10,836,512 | 3 | false | 0 | 1 | then it would not be a password entry, but you can use style=wx.TE_MULTILINE or TE_RICH. if that is what you are asking.
Hope this helps | 2 | 4 | 0 | With wxPython a password field could be created as:
wx.TextCtrl(frm, -1, '', style=wx.TE_PASSWORD )
I'm wondering if there is a way to dynamically change this password field into a normal textctrl, such that user could see what the password is. | how to make wxpython password textctrl show chars? | -0.066568 | 0 | 0 | 5,172 |
10,836,259 | 2012-05-31T15:07:00.000 | 3 | 1 | 1 | 0 | c++,python,deployment,scripting,packaging | 10,839,045 | 3 | true | 0 | 0 | From what I recall what you need to bundle depends on what your python scripts call or make use of. If you really only make use of the core intepreter I think you only need to bundle the dll.
Having said that, it shouldn't be too hard to test this on your development box by disabling any paths to your installed python ... | 1 | 5 | 0 | I currently develop an application which is written in C++. For scripting purposes I use Python 3.2, which is fine -- on my developer machine with Python installed and all the DLLs in the right place.
I deployed "pure" Python applications (i.e. without native code) before using the excellent py2exe, but I don't have a ... | Deployment of application with embedded Python 3 | 1.2 | 0 | 0 | 2,147 |
10,836,517 | 2012-05-31T15:24:00.000 | 0 | 1 | 0 | 0 | python,textmate,pylint | 10,838,327 | 2 | false | 0 | 0 | A somewhat educated guess: try replacing $HOME by the absolute path to your home directory. Shell variables like $HOME are probably not available to use in TextMate's control panel.
UPDATE: Looking at the pycheckmate.py script included with the Python.tmbundle included with the version of TextMate I have, it appears t... | 1 | 2 | 0 | I'm trying to get pylint to give html output when I run Validate syntax on a python file in TextMate. I installed pycheckmate, pylint, and created a .pylintrc file in $HOME that sets the output format to html.
In TextMate's Advanced control panel, in the Shell Variables tab, I have TM_PYCHECKER set to /usr/local/share/... | pylint ignores .pylintrc when run from TextMate | 0 | 0 | 0 | 1,057 |
10,838,959 | 2012-05-31T18:12:00.000 | 0 | 0 | 0 | 0 | python,pygame,mouseevent,mouse | 10,839,038 | 3 | false | 0 | 1 | You will need to poll for events in your main loop, and when you detect a MOUSEBUTTONDOWN event you will need to check if it's on the sprite you want, and if it is then start the music. | 1 | 2 | 0 | My simple question is how can I use pygame.MOUSEBUTTONDOWN on a sprite or item to trigger an event?
e.g. I have item_A and want music to start when I press the object with my mouse. | How to use pygame.MOUSEBUTTONDOWN? | 0 | 0 | 0 | 18,074 |
10,840,030 | 2012-05-31T19:27:00.000 | 39 | 0 | 0 | 0 | python,django,django-signals | 19,936,271 | 10 | false | 1 | 0 | Don't disconnect signals. If any new model of the same type is generated while the signal is disconnected the handler function won't be fired. Signals are global across Django and several requests can be running concurrently, making some fail while others run their post_save handler. | 3 | 38 | 0 | There are many Stack Overflow posts about recursion using the post_save signal, to which the comments and answers are overwhelmingly: "why not override save()" or a save that is only fired upon created == True.
Well I believe there's a good case for not using save() - for example, I am adding a temporary application th... | Django post_save preventing recursion without overriding model save() | 1 | 0 | 0 | 22,986 |
10,840,030 | 2012-05-31T19:27:00.000 | 4 | 0 | 0 | 0 | python,django,django-signals | 22,560,210 | 10 | false | 1 | 0 | You could also check the raw argument in post_save and then call save_baseinstead of save. | 3 | 38 | 0 | There are many Stack Overflow posts about recursion using the post_save signal, to which the comments and answers are overwhelmingly: "why not override save()" or a save that is only fired upon created == True.
Well I believe there's a good case for not using save() - for example, I am adding a temporary application th... | Django post_save preventing recursion without overriding model save() | 0.07983 | 0 | 0 | 22,986 |
10,840,030 | 2012-05-31T19:27:00.000 | 91 | 0 | 0 | 0 | python,django,django-signals | 10,840,333 | 10 | false | 1 | 0 | you can use update instead of save in the signal handler
queryset.filter(pk=instance.pk).update(....) | 3 | 38 | 0 | There are many Stack Overflow posts about recursion using the post_save signal, to which the comments and answers are overwhelmingly: "why not override save()" or a save that is only fired upon created == True.
Well I believe there's a good case for not using save() - for example, I am adding a temporary application th... | Django post_save preventing recursion without overriding model save() | 1 | 0 | 0 | 22,986 |
10,840,917 | 2012-05-31T20:37:00.000 | 12 | 0 | 1 | 0 | python,gtk,pygtk | 10,843,649 | 1 | true | 0 | 1 | TextView is the widget used to edit multi-line text. | 1 | 7 | 0 | I know there is a PyGTK class for a single-line entry, but what about
multi-line entries (like entering a description of an item)?
I've searched through the web, but didn't find anything. | multiline gtk entry in pygtk | 1.2 | 0 | 0 | 3,074 |
10,841,854 | 2012-05-31T21:57:00.000 | 1 | 0 | 0 | 0 | python,web.py,uwsgi | 10,842,122 | 1 | false | 1 | 0 | To answer my own question, you need to call web.input() otherwise the returned data will be ignore (who knows why? is it a bug?) | 1 | 1 | 0 | This is using web.py with uwsgi.
When I return page data from a POST handler, the browser receives a blank page instead. GET handlers are working fine for me. The handler is being called correctly, and redirects (web.seeother) will work. | Page returned by POST handler ignored - get blank response (web.py) | 0.197375 | 0 | 1 | 257 |
10,842,167 | 2012-05-31T22:31:00.000 | 0 | 0 | 0 | 1 | python,py2app | 23,563,762 | 1 | false | 0 | 1 | I had this problem for a long time. Try running it as admin. | 1 | 0 | 0 | I am trying really REALLY hard to install py2app, but whenever I run the install command on the source code, I get half way through and then I get a permission denied error. Does anyone have an idea about how I could fix this? I do have admin rights on the machine I am using. I am using the admin's profile to do the in... | py2app installation error--Permission Denied | 0 | 0 | 0 | 586 |
10,843,191 | 2012-06-01T01:04:00.000 | 1 | 0 | 0 | 0 | python,sqlite,fastcgi,lighttpd | 10,843,435 | 1 | true | 0 | 0 | You can use a cache such as memcached to store it once retrieved. | 1 | 0 | 0 | Using python(fastcgi),lighttpd,sqlite3 for server
Update data of sqlite3 every weekend.
Thats means, every user get the same data from server before weekend,and server query database for every user's request.
My question is:
Is there any way to cache data for users,server using cache data to response all users before u... | cache data in python and sqlite3 | 1.2 | 1 | 0 | 167 |
10,843,240 | 2012-06-01T01:12:00.000 | 1 | 0 | 1 | 0 | python,iteration,multiprocessing,gdal | 11,115,655 | 4 | false | 0 | 0 | As python is not really meant to do intensive number-cunching, I typically start converting time-critical parts of a python program to C/C++ and speed things up a lot.
Also, the python multithreading is not very good. Python keeps using a global semaphore for all kinds of things. So even when you use the Threads that p... | 1 | 18 | 1 | I have written an algorithm that takes geospatial data and performs a number of steps. The input data are a shapefile of polygons and covariate rasters for a large raster study area (~150 million pixels). The steps are as follows:
Sample points from within polygons of the shapefile
For each sampling point, extract val... | Python multiprocessing design | 0.049958 | 0 | 0 | 2,043 |
10,844,088 | 2012-06-01T03:38:00.000 | 9 | 0 | 1 | 0 | python,arguments,parameter-passing,pass-by-value | 10,847,754 | 2 | true | 0 | 0 | Saying that it is not pass-by-value is not correct. Semantically, it is pass-by-value, and one can demonstrate the semantic equivalence between it and other pass-by-value languages. However, it belongs to a particular subcategory of pass-by-value languages where all the values are references (pointers) to objects (you ... | 1 | 8 | 0 | Many people say that in Python arguments to functions are passed using a call-by-value model. As I understand it, it is not actually a call-by-value language, but a call-by-object or call-by-sharing model.
What are the differences between a call-by-value model and a call-by-object model? What is an example in Python ... | Python: What is the difference between Call-by-Value and Call-by-Object? | 1.2 | 0 | 0 | 5,255 |
10,847,087 | 2012-06-01T08:43:00.000 | 1 | 0 | 1 | 0 | python | 10,849,352 | 2 | true | 0 | 0 | I think you should refrain from doing so as much as reasonably possible because it breaks encapsulation which one of the benefits of the object-oriented paradigm. While some feel it's fine as certain higher levels of scoping, say module or package, I've found avoiding doing so a useful rule-of-thumb even within the var... | 2 | 1 | 0 | If I use a single leading underscore for an attribute in a class, would it be wrong of me to access it from a different object? Is a single underscore saying "I will use this as I please but you the user shouldn't touch it" or should even the developer treat it as though it were private? | Should I treat my own single underscored attributes as private? | 1.2 | 0 | 0 | 75 |
10,847,087 | 2012-06-01T08:43:00.000 | 6 | 0 | 1 | 0 | python | 10,847,113 | 2 | false | 0 | 0 | The single underscore indicates that it's not for public consumption; code within the same package is welcome to poke and prod it. | 2 | 1 | 0 | If I use a single leading underscore for an attribute in a class, would it be wrong of me to access it from a different object? Is a single underscore saying "I will use this as I please but you the user shouldn't touch it" or should even the developer treat it as though it were private? | Should I treat my own single underscored attributes as private? | 1 | 0 | 0 | 75 |
10,847,097 | 2012-06-01T08:44:00.000 | 2 | 0 | 0 | 0 | python,plone | 12,753,017 | 1 | true | 1 | 0 | You should try this:
Go to portal_workflow -> contents
Copy & Paste simple_publication_workflow
Rename copy_of_simple_publication_workflow to something else (eg. my_files_workflow)
Go to my_files_workflow -> States -> published -> Permissions
Uncheck the unwanted Permissions
Now you can assign this new workflow to yo... | 1 | 0 | 0 | By default Files haven't workflow
So i put them the simple publication workflow (private -> submit -> publish)
I want the authenticated users could not modify the file when it is published
(on Plone 4.0.7) | Change Plone workflow | 1.2 | 0 | 0 | 164 |
10,849,141 | 2012-06-01T11:09:00.000 | 0 | 0 | 1 | 0 | python,string,comparison,ocr | 10,849,401 | 5 | false | 0 | 0 | I don't know of any available python lib that would do that out of the box, but you might find one (or find a C or C++ lib and write a Python wrapper for it).
You can also try to roll your own solution, based either on a "brute force" char by char comparison, with rules defining "proximity" between two given chars and... | 1 | 18 | 0 | I need to do some OCR on a large chunk of text and check if it contains a certain string but due to the inaccuracy of the OCR I need it to check if it contains something like a ~85% match for the string.
For example I may OCR a chunk of text to make sure it doesn't contain no information available but the OCR might see... | Can I do a "string contains X" with a percentage accuracy in python? | 0 | 0 | 0 | 12,237 |
10,849,550 | 2012-06-01T11:38:00.000 | 1 | 0 | 0 | 0 | python,django,django-forms | 10,850,488 | 2 | true | 1 | 0 | You can have a datetimefield as an additional column and expire it as and when required. | 2 | 0 | 0 | I am trying to build an application (using Django) which uploads files and generates corresponding URL. Is there some way we can set time constraint for the url, i.e. the uploaded file in url should exist only for little time after the specified time that url should give an error.
I would be using the default django se... | Set Time Constraint for generated URL of uploaded files | 1.2 | 0 | 0 | 73 |
10,849,550 | 2012-06-01T11:38:00.000 | 1 | 0 | 0 | 0 | python,django,django-forms | 10,849,796 | 2 | false | 1 | 0 | If your uploaded files are being served by the Django app itself, then it's quite easy (and can be solved in different ways depending on weither the "time constraint" is global to all files/urls or not).
Else - that is if the files are served by Apache or anything similar - you'll have to resort to some async mechanism... | 2 | 0 | 0 | I am trying to build an application (using Django) which uploads files and generates corresponding URL. Is there some way we can set time constraint for the url, i.e. the uploaded file in url should exist only for little time after the specified time that url should give an error.
I would be using the default django se... | Set Time Constraint for generated URL of uploaded files | 0.099668 | 0 | 0 | 73 |
10,851,726 | 2012-06-01T14:01:00.000 | 1 | 0 | 0 | 0 | python,xlrd,xlwt | 10,857,757 | 1 | false | 0 | 0 | Not directly. xlutils can use xlrd and xlwt to copy a spreadsheet, and appending to a "to be written" worksheet is straightforward. I don't think reading the open spreadsheet is a problem -- but xlwt will not write to the open book/sheet.
You might write an Excel VBA macro to draw the graphs. In principle, I think a... | 1 | 1 | 1 | I am trying to write a python program for appending live stock quotes from a csv file to an excel file (which is already open) using xlrd and xlwt.
The task is summarised below.
From my stock-broker's application, a csv file is continually being updated on my hard disk.
I wish to write a program which, when run, would ... | xlrd - append data to already opened workbook | 0.197375 | 1 | 0 | 1,299 |
10,851,959 | 2012-06-01T14:17:00.000 | 0 | 0 | 1 | 0 | python,nlp,nltk,string-matching | 10,894,346 | 3 | false | 0 | 0 | This problem you describe appears to be a Stemming problem, they are some useful stemmers out there like the porter stemmer. More specifically try implement it using the nltk tool kit for Python which if im not mistaken comes with a porter stemmer. | 1 | 4 | 0 | I am currently working on a script that runs through a document, pulls out all keywords, and then attempts to match these keywords with those found in other documents. There are some specifics that complicate this, but they are not very pertinent to me question. Basically I would like to be able to match words regardle... | How can I match words regardless of tense or form? | 0 | 0 | 0 | 1,164 |
10,852,130 | 2012-06-01T14:27:00.000 | 2 | 0 | 0 | 0 | python,webserver | 10,852,170 | 2 | false | 1 | 0 | Yes, this just accesses a resource called answer.py on the server. This naming convention is entirely up to the server - it could run a python script (most likely what is going on), or it could even be in a completely different language. In any case, all that that browser cares about is the information that is returned... | 2 | 1 | 0 | Take, for instance, support.google.com/mail/bin/answer.py?hl=en&answer=13287. What is that answer.py? How does this work? I'm 99.99% sure that browsers don't have the ability to interpret python code (yet) like javascript / PHP. So what is this? Is it some Python webframework? | google.com web pages with ".py" extension? | 0.197375 | 0 | 0 | 1,523 |
10,852,130 | 2012-06-01T14:27:00.000 | 2 | 0 | 0 | 0 | python,webserver | 10,852,194 | 2 | true | 1 | 0 | Most likely you request a file that's ending in .py that spits out the usual HTML et. al. The file is executed on the server side, not in your browser.
But again, that's a URL and it could point to any resource. Could be anything. Like a lot of websites use pretty URLs to point you to something , except in this case it... | 2 | 1 | 0 | Take, for instance, support.google.com/mail/bin/answer.py?hl=en&answer=13287. What is that answer.py? How does this work? I'm 99.99% sure that browsers don't have the ability to interpret python code (yet) like javascript / PHP. So what is this? Is it some Python webframework? | google.com web pages with ".py" extension? | 1.2 | 0 | 0 | 1,523 |
10,853,412 | 2012-06-01T15:44:00.000 | 0 | 0 | 0 | 0 | python,regex,pexpect | 10,853,812 | 3 | false | 0 | 0 | Once expect has found a match it sets the 'before', 'after', and 'match' attributes on the process instance. You could use these to write some logic.
Alternatively you could just craft a better regex that only matches the prompt that you want. Even r'>$|#$' would probably do what you want since it is only going to matc... | 1 | 1 | 0 | I'm trying to write a python script to access several Cisco network devices. Sadly the devices are not set up the same, some have banners up that appear at weird places. These banners might have the patterns that have some of the same stuff a prompt might have.
For example, once I log in I expect a prompt of 'hostnam... | Can pexpect be told to ignore a pattern or signal? | 0 | 0 | 0 | 6,383 |
10,854,532 | 2012-06-01T17:03:00.000 | 1 | 0 | 1 | 0 | python,django,psycopg2 | 10,914,900 | 1 | true | 0 | 0 | This is a PostgreSQL error: you need an explicit cast. Add ::date[] after the value or the placeholder. | 1 | 1 | 0 | I am trying to save an array of dates. I am providing a list of date objects, yet psycopg2 is throwing the above error.
Any thoughts on how I can work around this? | psycopg2 column is of type date[] but expression is of type text[] | 1.2 | 1 | 0 | 1,679 |
10,858,172 | 2012-06-01T22:38:00.000 | 4 | 0 | 1 | 0 | javascript,python,udp,multiplayer | 10,858,211 | 2 | false | 1 | 0 | I recommend doing the dumbest simplest thing to get your project to work, meaning probably http and Json. Then deal with any performance problems. Otherwise you'll spend much of your project on a hard optimization problem that might not really matter. | 2 | 0 | 0 | I am planning to make a multiplayer game with a JavaScript based Client UI and Python on the server side. The game will be dynamic, so communication speed is very important - consequently I have decided to use UDP. Does anyone have any tips on implementations I could utilize. What tools would you recommend for this pro... | UDP communication between JavaScript and Python | 0.379949 | 0 | 1 | 302 |
10,858,172 | 2012-06-01T22:38:00.000 | 1 | 0 | 1 | 0 | javascript,python,udp,multiplayer | 10,858,488 | 2 | false | 1 | 0 | I've been using SockJS + Tornado for this sort of thing. Easy to get started with, and well supported in modern browsers. | 2 | 0 | 0 | I am planning to make a multiplayer game with a JavaScript based Client UI and Python on the server side. The game will be dynamic, so communication speed is very important - consequently I have decided to use UDP. Does anyone have any tips on implementations I could utilize. What tools would you recommend for this pro... | UDP communication between JavaScript and Python | 0.099668 | 0 | 1 | 302 |
10,858,337 | 2012-06-01T22:58:00.000 | 2 | 1 | 0 | 0 | python,web,fastcgi,timing,psychtoolbox | 10,999,764 | 1 | true | 0 | 0 | Do your timing in JS, save current time in ms on document.ready and then when user hits a key.
Benchmark your test with either
high-speed camera, or
test rig that "hits" a key, e.g. screen flash -> pohototransistor -> usb device -> virtual keyboard | 1 | 2 | 0 | I want to display visual/auditory stimuli inside a web browser for psychophysic experiments. I plan on using python, but I am concerned with timing. I obviously can not rely on screen refresh for timing which is common in these types of tasks. How much can I hope for in terms of accuracy for timing on the web and what ... | Achieving best timing online for psychophysics experiments using Python on the web | 1.2 | 0 | 1 | 296 |
10,859,023 | 2012-06-02T01:02:00.000 | 4 | 0 | 0 | 0 | python-3.x,tkinter,ncurses | 10,861,849 | 2 | false | 0 | 1 | I would like to suggest tkinter as it comes with python and compare to other GUI packages it has good tutorials. And also it will help you to improve your OOP concept for python | 1 | 4 | 0 | I want to impliment some kind of UI for my Python programs (some simple operations, nothing advanced).
So I looked around and considered ncurses and tkinter for python. Yet I am not sure which of these two would suit best my needs for a simple interface (in the sense of easy to learn to program) with the best output po... | python3 tkinter or ncurses | 0.379949 | 0 | 0 | 1,422 |
10,859,369 | 2012-06-02T02:33:00.000 | -1 | 0 | 1 | 0 | python,dll,module,compilation | 61,172,806 | 11 | false | 0 | 0 | This is my idea, it might work. I don't know, if that work or not.
1.Create your *.py files.
2.Rename them into *.pyx
3.Convert them into *.c files using Cython
4.Compile *.c into *.dll files.
But I don't recommend you because it won't work on any other platforms, except Windows. | 3 | 34 | 0 | Well, I have a Python package. I need to compile it as dll before distribute it in a way easily importable. How? You may suggest that *.pyc. But I read somewhere any *.pyc can be easily decompiled!
Update:
Follow these:
1) I wrote a python package
2) want to distribute it
3) do NOT want distribute the source
4) *.pyc i... | How to compile a Python package to a dll | -0.01818 | 0 | 0 | 121,625 |
10,859,369 | 2012-06-02T02:33:00.000 | -2 | 0 | 1 | 0 | python,dll,module,compilation | 41,749,359 | 11 | false | 0 | 0 | Grab Visual Studio Express and IronPython and do it that way? You'll be in Python 2.7.6 world though. | 3 | 34 | 0 | Well, I have a Python package. I need to compile it as dll before distribute it in a way easily importable. How? You may suggest that *.pyc. But I read somewhere any *.pyc can be easily decompiled!
Update:
Follow these:
1) I wrote a python package
2) want to distribute it
3) do NOT want distribute the source
4) *.pyc i... | How to compile a Python package to a dll | -0.036348 | 0 | 0 | 121,625 |
10,859,369 | 2012-06-02T02:33:00.000 | 11 | 0 | 1 | 0 | python,dll,module,compilation | 10,861,332 | 11 | false | 0 | 0 | Write everything you want to hide in Cython, and compile it to pyd. That's as close as you can get to making compiled python code.
Also, dll is not a standard, not in Python world. They're not portable, either. | 3 | 34 | 0 | Well, I have a Python package. I need to compile it as dll before distribute it in a way easily importable. How? You may suggest that *.pyc. But I read somewhere any *.pyc can be easily decompiled!
Update:
Follow these:
1) I wrote a python package
2) want to distribute it
3) do NOT want distribute the source
4) *.pyc i... | How to compile a Python package to a dll | 1 | 0 | 0 | 121,625 |
10,859,714 | 2012-06-02T04:10:00.000 | 0 | 0 | 0 | 0 | python,django,blob,sorl-thumbnail | 10,971,247 | 1 | true | 1 | 0 | It seems like the issue was the Jquery plugin that i was using to upload multiple files. The plugin was the one who split the file into chunks which were then sent individually as POST requests, and django didn't know that blob1, blob2, blob3, blob4 where the same file in chunks. | 1 | 0 | 0 | I am writing a small gallery app and after extensive testing i submitted a 3mb image.
Basically the gallery app relies on another app that creates an UploadedFile instance for every image, however i see that for this specific image it has created 4 instances ( rows in db ) that belong to the same 3mb image, each image ... | Django Handle big files ( imageblob ) | 1.2 | 0 | 0 | 140 |
10,860,048 | 2012-06-02T05:30:00.000 | 5 | 0 | 1 | 0 | python | 10,860,062 | 3 | false | 0 | 0 | You want str.lstrip() for that. But maybe you should just pass the radix to int(). | 2 | 8 | 0 | I have a string that will later be converted with int(). It is three digits, anywhere from 0 to 3 of them might be 0's. How would I strip the 0s from the left side of the string?
Now I'm using string.lstrip('0') but that strips all the 0s and makes the string empty, causing an error. | Pythonic way to strip all 0's from the front of a string | 0.321513 | 0 | 0 | 13,608 |
10,860,048 | 2012-06-02T05:30:00.000 | 0 | 0 | 1 | 0 | python | 10,862,595 | 3 | false | 0 | 0 | what about string[:-1].lstrip('0')? :D | 2 | 8 | 0 | I have a string that will later be converted with int(). It is three digits, anywhere from 0 to 3 of them might be 0's. How would I strip the 0s from the left side of the string?
Now I'm using string.lstrip('0') but that strips all the 0s and makes the string empty, causing an error. | Pythonic way to strip all 0's from the front of a string | 0 | 0 | 0 | 13,608 |
10,861,128 | 2012-06-02T09:15:00.000 | 1 | 0 | 1 | 1 | python,command-line,cross-platform | 10,861,269 | 3 | false | 0 | 0 | You'll have to use a module if you want something cross-platform / slightly complicated.
I'd recommend using pypi.python.org/pypi/colorama, which is cross-platform. | 1 | 1 | 0 | Bascially, I want an easy(ish), cross-platform way of colouring text in the command line/shell.
I would really like this to not involve importing a module, but because cross-platform support is pretty complicated, I know it will probably have to.
I don't need it to be too elaborate though, just a few basic colours will... | Easy cross-platform python way of colouring text in the command line/shell | 0.066568 | 0 | 0 | 844 |
10,862,259 | 2012-06-02T12:16:00.000 | 7 | 0 | 0 | 0 | python,django,nginx,amazon-ec2,gunicorn | 10,862,770 | 5 | false | 1 | 0 | If you are already using amazon web services, you can use s3 buckets to host your static content and deploy your app to ec2 using gunicorn (or whatever you want). That way, you don't have to worry about setting up your own static file server at all. | 1 | 15 | 0 | I have tried just about every django + nginx tutorial on the web and I cannot get an image file to display on the screen. It's always the old story - 404 PAGE NOT FOUND. The web page loads fine but django.png in my /static/ folder does not. Not sure if it's a problem in settings.py or with nginx.
I am so frustrated wit... | Can Django run on Gunicorn alone (no Apache or nginx)? | 1 | 0 | 0 | 17,822 |
10,862,982 | 2012-06-02T14:15:00.000 | 2 | 0 | 0 | 0 | python,macos,firefox,selenium | 10,869,190 | 2 | false | 0 | 0 | The problem is due to the fact that Firefox does not always fire events correctly when it does not have focus. This will be fixed soon as it is now a normative part of the HTML5 spec.
I would recommend just having an extremely lightweight VM, in something like virtualbox or VMWare Fusion and just using Remote WebDriver... | 1 | 0 | 0 | Currently on OSX Selenium driver start opens up a new Firefox icon on OSX. Also, the current application loses focus and thus interrupts e.g. your typing.
Is it possible to make Selenium launch Firefox on OSX such way that it would not take focus or cause extra action in Dock? | Supressing Firefox icon in OSX Dock when running tests | 0.197375 | 0 | 1 | 427 |
10,868,362 | 2012-06-03T06:26:00.000 | 0 | 0 | 1 | 0 | python,local-storage | 10,868,382 | 4 | false | 0 | 0 | SQLite. Very easy to setup, and you gain a number of builtin db functions. You also won't have to handle file read/writes and parsing. | 2 | 0 | 0 | What is the preferred way to store application-specific parameters (persistent data) for my Python program?
I'm creating a Python program, which needs to store some parameters: "project_name", "start_year", "max_value", ...
I don't know which is the best way to store these data (I must reuse them when making calculati... | What is the preferred method for storing application persistent data, a flat file or a database? | 0 | 0 | 0 | 753 |
10,868,362 | 2012-06-03T06:26:00.000 | 0 | 0 | 1 | 0 | python,local-storage | 10,868,523 | 4 | false | 0 | 0 | if scheme is fixed, sqldb is best choise, like sqlite3, plus memcached as cache.
if relationship change often, i think flexible data may be stored in files(hash indexed). | 2 | 0 | 0 | What is the preferred way to store application-specific parameters (persistent data) for my Python program?
I'm creating a Python program, which needs to store some parameters: "project_name", "start_year", "max_value", ...
I don't know which is the best way to store these data (I must reuse them when making calculati... | What is the preferred method for storing application persistent data, a flat file or a database? | 0 | 0 | 0 | 753 |
10,868,473 | 2012-06-03T06:52:00.000 | 2 | 1 | 1 | 0 | php,python,mysql,apache,utf-8 | 10,868,488 | 3 | false | 0 | 0 | If it's in the file, then yes, you will need to save the file as UTF-8.
If it's is in the database, you do not need to save the PHP file as UTF-8.
In PHP, strings are basically just binary blobs. You will need to save the file as UTF-8 so the correct bytes are read in. In theory, if you saved the raw bytes in an ANSI... | 2 | 2 | 0 | I have an open source PHP website and I intend to modify/translate (mostly constant strings) it so it can be used by Japanese users.
The original code is PHP+MySQL+Apache and written in English with charset=utf-8
I want to change, for example, the word "login" into Japanese counterpart "ログイン" etc
I am not sure whether ... | PHP for Python Programmers: UTF-8 Issues | 0.132549 | 1 | 0 | 148 |
10,868,473 | 2012-06-03T06:52:00.000 | 0 | 1 | 1 | 0 | php,python,mysql,apache,utf-8 | 10,868,497 | 3 | false | 0 | 0 | If the file contains UTF-8 characters then save it with UTF-8. Otherwise you can save it in any format. One thing you should be aware of is that the PHP interpreter does not support the UTF-8 byte order mark so make sure you save it without that. | 2 | 2 | 0 | I have an open source PHP website and I intend to modify/translate (mostly constant strings) it so it can be used by Japanese users.
The original code is PHP+MySQL+Apache and written in English with charset=utf-8
I want to change, for example, the word "login" into Japanese counterpart "ログイン" etc
I am not sure whether ... | PHP for Python Programmers: UTF-8 Issues | 0 | 1 | 0 | 148 |
10,868,677 | 2012-06-03T07:40:00.000 | 1 | 0 | 0 | 1 | python,subprocess,multiprocessing | 11,081,096 | 1 | true | 0 | 0 | We found out that the commands sent over ssh inside the scripts were the ones which were getting truncated in their outputs.
For this we used the -n flag of ssh , which solved the problem. There is no more truncation.
But this is a strange issue which happens only in python multiprocessing environment and must be consi... | 1 | 2 | 0 | I have a python framework which has to execute bash scripts as plugins.
We are using multiprocessing module to create worker processes which pick the plugin details from a multiprocessing.JoinableQueue and execute the plugins using subprocess.Popen().
It has been observed that the final output generated by the shell sc... | Shell script output to file is buffered/truncated using python multiprocessing module | 1.2 | 0 | 0 | 1,403 |
10,869,211 | 2012-06-03T09:29:00.000 | 0 | 0 | 0 | 0 | python,mechanize | 10,869,296 | 1 | false | 1 | 0 | You can rewrite the urls, either by parsing the HTML with lxml, beautiful soup, etc - and then rewriting them and re-dumping the DOM to string before sending it to the user. Or by searching for URLs with regular expressions, and return a rewritten HTML.
keep in mind that doing it properly, with links generated by javas... | 1 | 0 | 0 | I am working on a project to make web-based proxy using python and
mechanize . I have a problem :
The page that mechanize returns, has URLS that are are not
Mechanized and if user clicks on it, they will go thourgh the link by
their own computer's ip (not the server that my code is installed on it) . is there any way ... | how to mechnize the urls inside a returned page by mechanize in python? | 0 | 0 | 1 | 104 |
10,869,472 | 2012-06-03T10:14:00.000 | 1 | 1 | 1 | 0 | python,amazon-ec2,amazon-web-services,amazon-cloudwatch | 11,124,827 | 2 | false | 0 | 0 | CPU can be monitored by CloudWatch using the built-in metrics. For memory you can use custom metrics with the AWS command line tools or write powershell/ruby scripts with the official AWS SDK.
You can monitor anything that's easily quantifiable using the AWS SDK. To monitor bandwidth usage per domain I'd recommend some... | 1 | 4 | 0 | What is the best solution in python, to monitor CPU, memory, and bandwidth usage per domain?
This solution has to also work on multiple instances. | Monitor bandwidth, memory, cpu per domain on EC2 | 0.099668 | 0 | 1 | 3,733 |
10,870,401 | 2012-06-03T12:42:00.000 | 1 | 0 | 1 | 1 | python,linux,installation,build-automation,silent-installer | 10,870,525 | 4 | false | 0 | 0 | You can compile Python for yourself easily enough. Download and extract the Python source tarballs, then use this sequence of commands instead of the usual:
$ ./configure --prefix=$HOME/local
$ make
$ make install
You will probably want to add $HOME/local/bin to your PATH. The different minor/major versions of Pyth... | 1 | 4 | 0 | I'd like to have a reliable way to install Python interpreters 2.4 through to Python 3.3 on a linux user account. I am fine to presume that there is a C-compiler but i'd like to avoid relying on particular distributions or distribution versions. Is there already something maybe like a simple python script?
update: i ... | How to install Python interpreters on Linux in a fully automated way | 0.049958 | 0 | 0 | 4,193 |
10,871,163 | 2012-06-03T14:32:00.000 | 1 | 1 | 1 | 0 | python,c,cryptography,rsa,primality-test | 10,871,183 | 3 | false | 0 | 0 | I don't know if Python will result in a "better" implementation, since better is rather subjective here. You can find numerical libraries for both that will allow you to deal with large numbers easily. Python has the advantage (imo) of having the numpy library which is very easy to read and use and is generally more hu... | 2 | 0 | 0 | I want to implement an RSA cryptosystem algorithm for a university project and I' m trying to decide which programming language to use. I am very familiar with C so it would be a convenient choice. However, the algorithm will have to deal with very large numbers (it will include a Primality subroutine), and I have hear... | Suitable Language for RSA implementation | 0.066568 | 0 | 0 | 1,059 |
10,871,163 | 2012-06-03T14:32:00.000 | 0 | 1 | 1 | 0 | python,c,cryptography,rsa,primality-test | 10,871,180 | 3 | false | 0 | 0 | Using a scripting language or any more high level language than C (e.g. C# or Java) will most likely be easier since you don't have to deal with memory management and other tasks not really related to your project. | 2 | 0 | 0 | I want to implement an RSA cryptosystem algorithm for a university project and I' m trying to decide which programming language to use. I am very familiar with C so it would be a convenient choice. However, the algorithm will have to deal with very large numbers (it will include a Primality subroutine), and I have hear... | Suitable Language for RSA implementation | 0 | 0 | 0 | 1,059 |
10,871,752 | 2012-06-03T15:53:00.000 | 0 | 0 | 0 | 0 | python,sockets,network-traffic,traffic-measurement | 10,872,601 | 2 | false | 0 | 0 | IPTraf is an ncurses based IP LAN monitoring tool. Has a capability to generate network statistics including TCP,UDP,ICMP and some more.
Since you're thinking to execute it from python, you may consider to use screen (screen manager with VT100/ANSI terminal emulation) to overcome ncurses issues and you may want to pass... | 1 | 1 | 0 | I guess it's socket programming. But I have never done socket programming expect for running the tutorial examples while learning Python. I need some more ideas to implement this.
What I specifically need is to run a monitoring program of a server which will poll or listen to traffic being exchange from different IPs a... | Python: how to calculate data received and send between two ipaddresses and ports | 0 | 0 | 1 | 2,642 |
10,872,287 | 2012-06-03T17:09:00.000 | 0 | 0 | 0 | 0 | python,multithreading,multiprocessing,flask,celery | 10,872,890 | 2 | false | 1 | 0 | You could hypervize the process using multiprocess or subprocess, then just hand the handle round the session. | 1 | 1 | 0 | I have some spider that download pages and store data in database. I have created flask application with admin panel (by Flask-Admin extension) that show database.
Now I want append function to my flask app for control spider state: switch on/off.
I thing it posible by threads or multiprocessing. Celery is not good dec... | Best way for single worker implementation in Flask | 0 | 0 | 0 | 2,057 |
10,873,049 | 2012-06-03T19:00:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,scheduled-tasks,backend,task-queue | 10,873,056 | 2 | true | 1 | 0 | Take a look at the Cron task or set a task queue with a specific ETA | 1 | 0 | 0 | I want my GAE app to do some back-end processing and uploading/updating results to data-store after specific intervals of time (say every 6 hours). So whenever a user uses my app (and basically requests those values from the data-store) they would get the recent/updated values from the data-store.
How would this be imp... | performing backend operations / tasks after specific intervals of time on Google App Engine (python) | 1.2 | 0 | 0 | 203 |
10,873,157 | 2012-06-03T19:14:00.000 | 1 | 0 | 0 | 1 | python,command-line-interface | 10,873,170 | 3 | false | 0 | 0 | Yes, have a look at the different curses implementations. | 1 | 15 | 0 | I'm not even sure what these would be called? I used to write them in ADA running on VAX-VMS!
I want to make a simple menu-driven application that would let me display menus and use the cursor keys to navigate around them, choose items and navigate around the app. All fully old school text based.
I want to be able to t... | Python interactive CLI application? | 0.066568 | 0 | 0 | 13,140 |
10,873,364 | 2012-06-03T19:40:00.000 | 83 | 1 | 1 | 0 | python,python-2.7,shutil | 10,873,516 | 4 | true | 0 | 0 | If noob is a directory, the shutil.rmtree() function will delete noob and all files and subdirectories below it. That is, noob is the root of the tree to be removed. | 1 | 56 | 0 | I have read the documentation for this function, however, I dont think I understand it properly. If anyone can tell me what I'm missing, or if I am correct, it would be a great help. Here is my understanding:
using the shutil.rmtree(path) function, it will delete only the directory specified, not the entire path. IE:
s... | shutil.rmtree() clarification | 1.2 | 0 | 0 | 91,285 |
10,874,011 | 2012-06-03T21:15:00.000 | 0 | 0 | 1 | 0 | python,python-sphinx | 10,875,040 | 1 | true | 0 | 0 | As it turns out, some of the files in the Python/Scripts folders are applications, not simply scripts. And most of these applications are not meant for DOS modes.
So I had to reinstall some packages, including setuptools and sphinx, via distributions specifically for Windows, which wasn't the case when I installed ever... | 1 | 1 | 0 | I have a Python(x,y) distribution installed on winxp, which includes the sphinx module for making documentation.
The first step in setting up sphinx is running the 'sphinx-quickstart' command at the prompt. It's just not responding. Nothing happens when I type that in.
I checked the module. It seems to be installed pro... | sphinx-quickstart not working on WinXP | 1.2 | 0 | 0 | 305 |
10,874,312 | 2012-06-03T22:09:00.000 | 2 | 0 | 0 | 1 | python,google-app-engine,google-cloud-datastore | 10,874,870 | 2 | true | 1 | 0 | You can run (with run) multiple datastore queries in parallel to improve latency. This has nothing to do with your resulting HTML. The resulting HTML should be the same. | 2 | 1 | 0 | I saw there are two methods for getting data from the datastore:
fetch() and run()
Regarding fetch the documentation says:
Note: You should rarely need to use this method; it is almost always better to use run() instead.
I don't understand the difference between the two.
I am new to GAE and Python, please help me under... | GAE DataStore python - fetch() vs run() | 1.2 | 0 | 0 | 576 |
10,874,312 | 2012-06-03T22:09:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,google-cloud-datastore | 10,883,221 | 2 | false | 1 | 0 | Beginner's advice: until you appreciate the difference, stick with fetch(). There are many other things you probably ought to get comfortable with first before this subtle distinction will bother you. | 2 | 1 | 0 | I saw there are two methods for getting data from the datastore:
fetch() and run()
Regarding fetch the documentation says:
Note: You should rarely need to use this method; it is almost always better to use run() instead.
I don't understand the difference between the two.
I am new to GAE and Python, please help me under... | GAE DataStore python - fetch() vs run() | 0.291313 | 0 | 0 | 576 |
10,874,949 | 2012-06-03T23:59:00.000 | 0 | 0 | 0 | 1 | python,eclipse,import,root | 10,995,927 | 1 | false | 0 | 0 | It seems like your PYTHONPATH is different outside/inside Eclipse. Try just removing the Python interpreter and adding it again to gather new paths -- if that's not enough, do: import sys;print('\n'.join(sorted(sys.path))) outside/inside Eclipse to know what's different and fix your paths inside Eclipse. | 1 | 1 | 0 | Im developing an installer for a GNU/Linux distribution in Python using Eclipse+PyDev. For some tasks on it there is needed that the program runs with root priviledges, but I run Eclipse as a common user.
I had searched a lot of stuff on the Internet about how to run an app as root without having to run Eclipse with pr... | import error in eclipse, running an app as root | 0 | 0 | 0 | 98 |
10,874,994 | 2012-06-04T00:09:00.000 | 0 | 0 | 0 | 0 | python,nlp,nltk,corpus | 10,875,787 | 2 | false | 0 | 0 | Why don't you a define a new corpus by copying the definition of movie_reviews in nltk.corpus? You can do this all you want with new directories, and then copy the directory structure and replace the files. | 1 | 0 | 1 | I'm attempting to create my own corpus in NLTK. I've been reading some of the documentation on this and it seems rather complicated... all I wanted to do is "clone" the movie reviews corpus but with my own text. Now, I know I can just change files in the move reviews corpus to my own... but that limits me to working wi... | "Cloning" a corpus in NLTK? | 0 | 0 | 0 | 301 |
10,875,141 | 2012-06-04T00:36:00.000 | 0 | 0 | 1 | 0 | python,debugging,syntax-error | 10,875,157 | 1 | true | 0 | 0 | You're missing a closing ). There is implicit line continuation within parentheses, brackets and braces. | 1 | 0 | 0 | I am new to Python and I need to use it as a calculator for a lab report. I am using it simply as a calculator, for the convenience and easy debugging that comes with scripting languages. I typed this into the python shell, but, for some reason when I press enter, it just starts a new line. This only happens in the las... | Need Asistance with Debugging | 1.2 | 0 | 0 | 40 |
10,877,048 | 2012-06-04T06:16:00.000 | 2 | 1 | 0 | 0 | python,django,performance,profiling,stress-testing | 10,906,462 | 2 | true | 1 | 0 | You could try configuring your test to ramp up slowly, slow enough so that you can see the CPU gradually increase and then run the profiler before you hit high CPU. There's no point trying to profile code when the CPU is maxed out because at this point everything will be slow. In fact, you really only need a relatively... | 1 | 6 | 0 | Background
I have a Django application, it works and responds pretty well on low load, but on high load like 100 users/sec, it consumes 100% CPU and then due to lack of CPU slows down.
Problem:
Profiling the application gives me time taken by functions.
This time increases on high load.
Time consumed may be due to com... | How do you find the CPU consumption for a piece of Python? | 1.2 | 0 | 0 | 1,360 |
10,879,363 | 2012-06-04T09:50:00.000 | 5 | 0 | 1 | 0 | python,settings,ini | 10,879,498 | 4 | true | 0 | 0 | There is no optimal solution; it is a matter of preference.*
Normally, settings do not need to be expressed in a Turing-complete language: they're often just a bunch of flags and options, sometimes strings and numbers, etc. An argument for having a settings.py file (though very unorthodox) would be if the end-user was ... | 3 | 3 | 0 | A "settings file" would be a file where things like "background color", "speed of execution", "number of x's" are defined. Currently, I implemented it as a single setting.py file, which I import in the beginning. Someone told me I should make it a settings.ini file instead, but I don't see why! Care to clarify, what is... | How to implement a settings file in a Python program | 1.2 | 0 | 0 | 1,484 |
10,879,363 | 2012-06-04T09:50:00.000 | 2 | 0 | 1 | 0 | python,settings,ini | 10,879,505 | 4 | false | 0 | 0 | One problem with having a settings file being a Python module is that it can contain code that will be executed when you import it. This may allow malicious code to be inserted into your program. | 3 | 3 | 0 | A "settings file" would be a file where things like "background color", "speed of execution", "number of x's" are defined. Currently, I implemented it as a single setting.py file, which I import in the beginning. Someone told me I should make it a settings.ini file instead, but I don't see why! Care to clarify, what is... | How to implement a settings file in a Python program | 0.099668 | 0 | 0 | 1,484 |
10,879,363 | 2012-06-04T09:50:00.000 | 3 | 0 | 1 | 0 | python,settings,ini | 10,879,560 | 4 | false | 0 | 0 | There are a few reasons why separating out config files from main codebase is a good idea. Of course it depends on your use case and you should evaluate against your usecase.
Configuration can be managed by end user, who do not understand programming languages. It makes more sense to factor out configuration and use a... | 3 | 3 | 0 | A "settings file" would be a file where things like "background color", "speed of execution", "number of x's" are defined. Currently, I implemented it as a single setting.py file, which I import in the beginning. Someone told me I should make it a settings.ini file instead, but I don't see why! Care to clarify, what is... | How to implement a settings file in a Python program | 0.148885 | 0 | 0 | 1,484 |
10,880,696 | 2012-06-04T11:44:00.000 | 0 | 0 | 0 | 0 | python,sockets,proxy,ip,external | 10,881,188 | 4 | false | 0 | 0 | It depends on the type of program you are writing, if you just want your program to connect to another instance of this same program at some destination ip. Or are you writing a server application? If so, what client connects to this server? I'm not certain you need to involve a proxy at all, TCP traffic will simply ... | 1 | 1 | 0 | So I'm writing this program that uses python and sockets to talk over the internet, but that's not the issue.
The issue is I wish to test how the program works in a realistic internet environment.
ie: My client connects to a proxy somewhere over seas, then the data comes back to my router to my other computer.
so I wan... | Connect to your external IP to simulate the internet | 0 | 0 | 1 | 1,546 |
10,883,353 | 2012-06-04T14:52:00.000 | 0 | 0 | 0 | 0 | python,windows-xp,mouse-cursor | 11,217,477 | 1 | false | 0 | 0 | You could take a screenshot then use the PIL imaging library combined with the current cursor position to find out how wide the mouse is. It might not work very well if there was a white or black background though. | 1 | 2 | 0 | When automating clicks and keystrokes, I often have to wait until a button finishes loading and becomes clickable. The only indicator of this is, to my knowledge, the shape of my cursor. In any programming language (preferably Python), is there any way to tell if it has changed from a pointer to a hand? | How to tell the current shape of my cursor? | 0 | 0 | 0 | 221 |
10,884,253 | 2012-06-04T15:55:00.000 | 7 | 0 | 1 | 0 | python,for-loop | 10,884,280 | 4 | true | 0 | 0 | Yes, for i in range(upper + 1) or if you like, for i in range(lower, upper + 1) will work,
A lot of programming languages use zero-based indexing, so the non-inclusive upper bound is a common practice (this is due to memory addressing and adding an offset)
Just an example: If you had an array of size 5, ar, starting wi... | 2 | 3 | 0 | Sometimes it is a little confusing for me to keep in mind that the upperbound for a for loop is excluded by default. Is there any way to make it inclusive? | Python for loop with a more intuitive upper bound? | 1.2 | 0 | 0 | 6,052 |
10,884,253 | 2012-06-04T15:55:00.000 | 2 | 0 | 1 | 0 | python,for-loop | 10,884,275 | 4 | false | 0 | 0 | You'll get used to it. Just add one to the upper bound. | 2 | 3 | 0 | Sometimes it is a little confusing for me to keep in mind that the upperbound for a for loop is excluded by default. Is there any way to make it inclusive? | Python for loop with a more intuitive upper bound? | 0.099668 | 0 | 0 | 6,052 |
10,884,664 | 2012-06-04T16:25:00.000 | 0 | 0 | 1 | 0 | ipython | 24,792,196 | 2 | false | 0 | 0 | You can comment out the part you don't want to run, and in ipython you can run with : run -i ,which run with all the current variables. | 1 | 1 | 0 | I use the magic function %run often. Is there a way to run a script from a given line number or from some other label?
Example use:
I edit my script in an editor and use %run in IPython. I usually need to modify how I'm visualizing some data that I compute in the beginning of the script, but I don't need to recompute ... | IPython run script from breakpoint or line number | 0 | 0 | 0 | 507 |
10,885,238 | 2012-06-04T17:09:00.000 | 1 | 0 | 1 | 0 | python,json,decode | 10,888,356 | 2 | false | 0 | 0 | According to source code it is not possible: C-level function explicitly instantiates the built-in list type without using any callbacks/hooks. The same in trunk. | 1 | 9 | 0 | in Python 2.7+ I can use the object_pairs_hook in the builtin json module to change the type of the decoded objects. Is there anyway to do the same for lists?
One option is to go through the objects that I get as arguments to the hook and replace them with my own list type, but is there any other, smarter way? | Python: Change list type for json decoding | 0.099668 | 0 | 0 | 1,530 |
10,885,312 | 2012-06-04T17:15:00.000 | 0 | 0 | 0 | 1 | python,amazon,apache-pig,emr | 10,922,348 | 1 | false | 1 | 0 | could you manually hack sys.path inside of your jython script? | 1 | 3 | 0 | I've created a python UDF to convert datetimes into different timezones. The script uses pytz which doesn't ship with python (or jython). I've tried a couple things:
Bootstrapping PIG to install it's own jython and including pytz in
that jython installation. I can't get PIG to use the newly installed
jython, it keeps ... | Loading external python modules for Pig UDFs on Amazon EMR | 0 | 0 | 0 | 1,681 |
10,885,537 | 2012-06-04T17:34:00.000 | 0 | 0 | 1 | 0 | python,python-3.x,python-2.7 | 51,462,858 | 3 | false | 0 | 0 | The reason for this is that the old input() function tries to convert things you type as if it's python code. It generates lot of security issues, that's mainly why it was discarded for the raw_input instead but renamed input() because, well, you know, we programmers are a little bit lazy and typing input() instead of ... | 2 | 24 | 0 | I have tried a lot to run raw_input("") on the python console but that gives an error. Moreover I watch some videos that might have been made on old python. so input("") is the only method and why raw_input("") is discarded in the new version is there any reason ? | raw_input("") has been eliminated from python 3.2 | 0 | 0 | 0 | 68,511 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.