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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,746,231 | 2011-04-21T15:24:00.000 | 1 | 0 | 1 | 1 | python-3.x,dependencies,software-distribution | 5,747,306 | 3 | true | 0 | 0 | There are no best practices, but there are a few different tracks people follow. With regard to commercial product distribution there are the following:
Manage Your Own Package Server
With regard to your development process, it is typical to either have your dev boxes update from a local package server. That allows y... | 1 | 8 | 0 | I'm developing an application using Python 3. What is the best practice to use third party libraries for development process and end-user distribution? Note that I'm working within these constraints:
Developers in the team should have the exact same version of the libraries.
An ideal solution would work on both Wind... | Best practice for bundling third party libraries for distribution in Python 3 | 1.2 | 0 | 0 | 2,662 |
5,746,621 | 2011-04-21T15:56:00.000 | 1 | 0 | 1 | 0 | python,resources | 5,746,719 | 1 | false | 0 | 0 | For the first one, yes. Just put it in a known subdirectory and manipulate __file__ with os.path to get the path to pass to subprocess.
For the second... no. Just no. | 1 | 0 | 0 | Is there anyway to incorporate a "resources" folder with .exe's inside of it, with my python program?? I basically want to bundle .exe's with my .py file... My python program depends on these executables... If this isn't possible, would it be possible to convert .exe to .py??? | Python Resources | 0.197375 | 0 | 0 | 251 |
5,747,643 | 2011-04-21T17:29:00.000 | 1 | 0 | 1 | 0 | python | 5,747,866 | 1 | true | 0 | 0 | In my view a slightly cleaner design would be to not inherit your class from threading.Thread, but keep its run method as-is.
Now:
if you don't need threading, you can continue to use your class as you do currently;
if you do need threading, create a new Thread object, setting the target= constructor argument to your ... | 1 | 0 | 0 | I've created a Python class which inherits from threading.Thread, instances of which may not actually be run as a new thread (because the start() method is never invoked). The code has been written such that it works whether start() has been invoked or not (just in a slightly different way). This is entirely intentiona... | Is there a problem with inheriting from threading.Thread without actually starting the thread? | 1.2 | 0 | 0 | 971 |
5,749,321 | 2011-04-21T20:14:00.000 | 6 | 0 | 0 | 0 | python,firefox,selenium,selenium-ide | 15,879,812 | 3 | true | 1 | 0 | What version of SIDE are you running? If you are running the latest version (1.9), go into options, check the box off for "Enable Experimental Features" and the formats menu should now list Python. | 1 | 10 | 0 | I made several tests in Selenium IDE and saved it as a test suite in the HTML format which works fine for importing back into selenium IDE. Now however I would like to expand these tests using python and when I click export test suite and choose python I get this error
Suite export not implemented for the chrome://sel... | Export test as python from Selenium IDE | 1.2 | 0 | 1 | 16,458 |
5,749,326 | 2011-04-21T20:14:00.000 | 2 | 1 | 0 | 0 | python,module,package,archive,xlwt | 5,750,297 | 2 | true | 0 | 0 | All setup.py typically does with any pure-Python package is copy files into a standard place and compile the .py files to .pyc. I can't imagine why your employer would regard that as (nasty) third-party software, but the source of the package is OK, your IDE is OK, Python itself is OK, etc ...
Options:
(1) Copy the xlw... | 2 | 0 | 0 | Let's say Tight Ars & Co. is a company with incredibly tight security policies, and lets assume I work for this company. Assume they've one task that requires a python script to write to excel files, and I find this incredibly wonderful library called xlwt. Now my script is able to write to excel files, everything is ... | Python import module (xlwt) from archive | 1.2 | 0 | 0 | 458 |
5,749,326 | 2011-04-21T20:14:00.000 | 2 | 1 | 0 | 0 | python,module,package,archive,xlwt | 5,749,670 | 2 | false | 0 | 0 | Unless I am misunderstanding the question you should be able to obtain the source archive and simply copy the "xlwt" directory to the same directory as your script and it should be importable from the local directory. | 2 | 0 | 0 | Let's say Tight Ars & Co. is a company with incredibly tight security policies, and lets assume I work for this company. Assume they've one task that requires a python script to write to excel files, and I find this incredibly wonderful library called xlwt. Now my script is able to write to excel files, everything is ... | Python import module (xlwt) from archive | 0.197375 | 0 | 0 | 458 |
5,749,479 | 2011-04-21T20:32:00.000 | 1 | 0 | 0 | 0 | python,r,sparse-matrix | 5,887,256 | 2 | false | 0 | 0 | There are several ways to represent sparse matrices (documentation for the R SparseM package reports 20 different ways to store sparse matrix data), so complete compatibility with all solutions is probably out of question. The number options also suggests that there is no best-in-all-situations solution.
Pick either th... | 1 | 8 | 1 | I'm working with large, sparse matrices (document-feature matrices generated from text) in python. It's taking quite a bit of processing time and memory to chew through these, and I imagine that sparse matrices could offer some improvements. But I'm worried that using a sparse matrix library is going to make it harder... | Pros and cons to using sparse matrices in python/R? | 0.099668 | 0 | 0 | 872 |
5,749,694 | 2011-04-21T20:52:00.000 | 2 | 0 | 1 | 0 | python,datetime,optimization,dst | 5,749,738 | 2 | true | 0 | 0 | You could build a table, stretching as far into the past or future as you wish, with the overlapping hour for each year. It's easy to convert the timestamp to an approximate year with a simple division. Look up the tuple (start_leap_hour,end_leap_hour) from the year; if the timestamp is between them, subtract an hour. | 1 | 2 | 0 | The UNIX timestamps 1289106000 and 1289109600 both represent 2010-11-07T01:00:00 in the US-East EST/EDT timezone, as a result of daylight savings time. I'm creating a dictionary-like object, keyed on timestamp, that needs to map any such pairs to the same value.
Additionally, as much as we want to avoid premature opti... | What is the fastest way to detect when two timestamps produce the same local time in Python? | 1.2 | 0 | 0 | 150 |
5,749,871 | 2011-04-21T21:16:00.000 | 2 | 0 | 1 | 0 | python,django,pydev | 17,463,869 | 4 | false | 1 | 0 | I had the exact same problem - only with later versions of the different softwares: Python 3.3.2 and Django 1.5.1 under Eclipse with PyDev 2.7.5. I solved the problem differently:
I simply copied the complete Django 1.5.1 folder into the Python "Resources" folder
/System/Library/Frameworks/Python.framework/Versions/3... | 1 | 5 | 0 | I have python 2.6.1 installed with django 1.3 and PyDev 2.0. I am able to import django and print the version from commandline. However, when I try to create a Django project with pydev or even import django I get an error. When creating the django project, I get "Django not found." error.
I have tried removing and add... | pydev does not recognize django installation | 0.099668 | 0 | 0 | 4,493 |
5,751,292 | 2011-04-22T00:49:00.000 | 0 | 0 | 1 | 0 | python,import,importerror | 47,746,147 | 4 | false | 0 | 0 | Sys.path is a list of all the paths Python looks through when finding imports. If you want to add another path to a directory containing one or more python files, you can use: sys.path.append('path/to/directory'). | 1 | 65 | 0 | I get an ImportError exception somewhere in the code, but the same module can be imported safely at startup of the application. I'm curious to see which paths Python looks for modules to import, so that I can trace why this problem occurs. I found this:
print sys.path
Is this the list of ALL paths that system looks whe... | How to get current import paths in Python? | 0 | 0 | 0 | 73,229 |
5,752,753 | 2011-04-22T06:12:00.000 | 1 | 0 | 1 | 1 | python,macos | 5,752,844 | 5 | false | 0 | 0 | Try the following: defaults write com.apple.versioner.python Version 3.2 in a terminal. Assuming you have 3.2 installed of course.
EDIT: As Neil Deily points out in his comment this only works with Python distributions shipped by Apple. | 2 | 3 | 0 | How do I change the default Python version used in my Mac Snow Leopard? I'm trying to switch from v2.5 to v3.0 | How do I change the default Python version in my Mac Snow Leopard? | 0.039979 | 0 | 0 | 15,524 |
5,752,753 | 2011-04-22T06:12:00.000 | 0 | 0 | 1 | 1 | python,macos | 5,752,849 | 5 | false | 0 | 0 | I would first install Xcode on my machine (it comes on the installation disc that came with your computer). Then run Software Update to bring it up to date (at least to the most-current free version).
Then, download the Python 3.x source code and extract it. Do "./configure", "make" and "sudo make install" in that dir... | 2 | 3 | 0 | How do I change the default Python version used in my Mac Snow Leopard? I'm trying to switch from v2.5 to v3.0 | How do I change the default Python version in my Mac Snow Leopard? | 0 | 0 | 0 | 15,524 |
5,755,058 | 2011-04-22T11:42:00.000 | 4 | 0 | 0 | 0 | python,encoding,urldecode | 5,755,083 | 3 | false | 0 | 0 | You're halfway there. Take that result and decode it as UTF-8. | 1 | 3 | 0 | does anybody know in which way the string 'Krummh%C3%B6rn' is encoded?
Plain text is "Krummhörn".
I need to decode strings like this one in Python and tried urllib.unquote('Krummh%C3%B6rn')
The result: 'Krummh\xc3\xb6rn' | Which encoding? | 0.26052 | 0 | 1 | 310 |
5,756,422 | 2011-04-22T14:24:00.000 | 0 | 0 | 0 | 0 | python-3.x | 5,756,452 | 3 | false | 0 | 0 | I am not a Google employee, on Google App Engine they still provide Python 2.5 | 1 | 2 | 0 | I've been curious about this for a while now, hopefully this isn't to secretive and some Googlers could give some information about this? | Is Google using Python 3? | 0 | 0 | 0 | 3,240 |
5,756,813 | 2011-04-22T15:11:00.000 | 1 | 1 | 0 | 0 | c++,python,linux,ipc | 5,756,950 | 5 | false | 0 | 0 | DBus looks promising. It supports signals, so you should be able to stop an application on demand. However, I'm not sure if it's performance will be enough for you. | 3 | 12 | 0 | I have a GNU Radio application which utilizes both Python and C++ code. I want to be able to signal the C++ code of an event. If they were in the same scope I would normally use a simple boolean, but the code is separate to the point where some form of shared memory is required. The code in question is performance-crit... | Simple but fast IPC method for a Python and C++ application? | 0.039979 | 0 | 0 | 16,031 |
5,756,813 | 2011-04-22T15:11:00.000 | 5 | 1 | 0 | 0 | c++,python,linux,ipc | 5,756,983 | 5 | false | 0 | 0 | Why not open a unix socket? Or use DBus | 3 | 12 | 0 | I have a GNU Radio application which utilizes both Python and C++ code. I want to be able to signal the C++ code of an event. If they were in the same scope I would normally use a simple boolean, but the code is separate to the point where some form of shared memory is required. The code in question is performance-crit... | Simple but fast IPC method for a Python and C++ application? | 0.197375 | 0 | 0 | 16,031 |
5,756,813 | 2011-04-22T15:11:00.000 | 1 | 1 | 0 | 0 | c++,python,linux,ipc | 5,757,091 | 5 | false | 0 | 0 | You can try using custom signals. I don't know about Python code being able to send custom signals, but your C/C++ can certainly define custom signals with SIGIO.
If you have stringent response-time requirements, you might need to look beyond your application code and into some time of OS with support for real-time sig... | 3 | 12 | 0 | I have a GNU Radio application which utilizes both Python and C++ code. I want to be able to signal the C++ code of an event. If they were in the same scope I would normally use a simple boolean, but the code is separate to the point where some form of shared memory is required. The code in question is performance-crit... | Simple but fast IPC method for a Python and C++ application? | 0.039979 | 0 | 0 | 16,031 |
5,757,945 | 2011-04-22T17:07:00.000 | 5 | 0 | 0 | 1 | python,google-app-engine,logging | 5,758,949 | 2 | true | 1 | 0 | The default logger sends logging output to stderr. Use your shell's method of redirecting stderr to a file (in tcsh, (dev_appserver.py > /dev/tty) >& your_logfile.txt, your shell may vary.)
You can also use the logging module in python to change the logger to send directly to a file if you detect it's running locally (... | 1 | 3 | 0 | How can one view the Google App Engine logs outside the Admin console?
I'm developing, so using dev_appserver.py/the Admin Console and would like to see the logs as the records are emitted.
I'd like to monitor the logging output in a console with standard Unix tools e.g. less/grep/etc, but there doesn't seem to be an o... | Capture google app engine logging output | 1.2 | 0 | 0 | 1,164 |
5,758,354 | 2011-04-22T17:53:00.000 | 0 | 0 | 1 | 1 | python,linux | 5,758,465 | 5 | false | 0 | 0 | You're going to have a lot more problems than your choice of framework if this is your first project on a UNIX. I'd recommend you find a clued in person at your workplace who knows the platform fairly well and use her as a teacher rather than rely completely on the web. | 1 | 0 | 0 | I'm planning to work on a project using Tornado / nginx / mySQL / jQuery and would be using linux (im new to linux too, i barely know what vim / emacs are). Which tools for web development with this stack would you recommend? | Recommended tools for web development with python under linux? | 0 | 0 | 0 | 1,598 |
5,760,936 | 2011-04-22T23:18:00.000 | 0 | 0 | 1 | 0 | python,string,unicode,character-encoding | 27,403,026 | 5 | false | 0 | 0 | Do not str() cast to string what you've got from model fields, as long as it is an unicode string already.
(oops I have totally missed that it is not django-related) | 1 | 19 | 0 | I am dealing with unicode strings returned by the python-lastfm library.
I assume somewhere on the way, the library gets the encoding wrong and returns a unicode string that may contain invalid characters.
For example, the original string i am expecting in the variable a is "Glück"
>>> a
u'Gl\xfcck'
>>> print a
Traceb... | Handle wrongly encoded character in Python unicode string | 0 | 0 | 0 | 41,975 |
5,766,539 | 2011-04-23T19:56:00.000 | 3 | 0 | 1 | 0 | python | 5,766,552 | 2 | false | 0 | 1 | import PyQt4 works for me fine. | 1 | 10 | 0 | I want to use qt with python.
"import qt" return me :"ImportError: No module named qt". I already instaled pyqt.
what I hve to install in order to activate "import qt"
Thank You | problem with import qt in python | 0.291313 | 0 | 0 | 22,987 |
5,766,832 | 2011-04-23T20:46:00.000 | 8 | 1 | 0 | 1 | python,emacs,code-completion,cedet | 5,770,424 | 1 | false | 0 | 0 | CEDET support for each language is slightly different. In the case of python, the 1.0 release for CEDET hadn't been configured to convert a python import into a file-name. In addition, 'self' is similar to 'this' in c++, which needs to be added by completion logic since it isn't declared. These two features were ad... | 1 | 10 | 0 | In default installation of cedet-1.0 completion can only track global scope symbols in current file. This is not much differs from built-in completion functions (dabbrev-expand or hippie-expand).
It can complete symbols from neither imported modules, nor class properties.
Not saying it cannot handle 'self'.
Is it possi... | using emacs CEDET completion for python | 1 | 0 | 0 | 2,830 |
5,767,905 | 2011-04-24T00:40:00.000 | 2 | 0 | 1 | 0 | python,low-level-io | 5,767,938 | 1 | true | 0 | 0 | The latter, although both may be returned if they're both ready for reading. | 1 | 2 | 0 | r=select([f,s],[],[])[0][0]. Does this mean wait until the file pointed to by f AND s is ready for readiing or f OR s is ready for reading? | python.select, sending lists as arguments | 1.2 | 0 | 0 | 86 |
5,768,406 | 2011-04-24T03:09:00.000 | 3 | 0 | 1 | 0 | python,cil,abstract-syntax-tree,ocamlyacc,ocamllex | 5,768,504 | 1 | false | 0 | 0 | I don't think this is going to work very well. CIL is essentially just the C langauge. For your trick to work, you have translate Python completely to C... but the langauges have very dissimilar concepts. How will you model Python objects? Continuations? Dynamic load? Runtime typing? Infinite precision arithmetic? I... | 1 | 3 | 0 | I have worked on the static analysis on Python source code recently.
There is already a static analyzer written in Ocaml for CIL(C Intermediate Language) in our group. We want to reuse this analyzer, so our ideal approach is to translate Python to CIL.
Currently, I use Python built-in ast module to parse Python to Pyth... | Translation from Python to CIL(C Intermediate Language) | 0.53705 | 0 | 0 | 1,194 |
5,768,566 | 2011-04-24T04:05:00.000 | 0 | 0 | 0 | 0 | python,graph,pyqt,graphviz | 5,926,728 | 4 | false | 0 | 1 | Try the nodebox-gl fork version of nodebox that support unix, but I can't find the fork version graph in nodebox :(
Thanks | 1 | 2 | 0 | I want to expose some kind of graph explorer widget in Python using PyQt and some library. Does such a library exist? | Python graph visualization and editing with PyQt | 0 | 0 | 0 | 5,195 |
5,768,797 | 2011-04-24T05:20:00.000 | 3 | 0 | 0 | 0 | python,django | 34,825,606 | 9 | false | 1 | 0 | in flask using flask.ext.script, you can do it like this:
python manage.py runserver -h 127.0.0.1 -p 8000 | 3 | 88 | 0 | I am running python manage.py runserver from a machine A
when I am trying to check in machine B. The url I typed is http://A:8000/ .
I am getting an error like The system returned: (111) Connection refused | manage.py runserver | 0.066568 | 0 | 1 | 220,548 |
5,768,797 | 2011-04-24T05:20:00.000 | 4 | 0 | 0 | 0 | python,django | 34,215,336 | 9 | false | 1 | 0 | Just in case any Windows users are having trouble, I thought I'd add my own experience. When running python manage.py runserver 0.0.0.0:8000, I could view urls using localhost:8000, but not my ip address 192.168.1.3:8000.
I ended up disabling ipv6 on my wireless adapter, and running ipconfig /renew. After this everyth... | 3 | 88 | 0 | I am running python manage.py runserver from a machine A
when I am trying to check in machine B. The url I typed is http://A:8000/ .
I am getting an error like The system returned: (111) Connection refused | manage.py runserver | 0.088656 | 0 | 1 | 220,548 |
5,768,797 | 2011-04-24T05:20:00.000 | 0 | 0 | 0 | 0 | python,django | 32,757,797 | 9 | false | 1 | 0 | I had the same problem and here was my way to solve it:
First, You must know your IP address.
On my Windows PC, in the cmd windows i run ipconfig and select my IP V4 address. In my case 192.168.0.13
Second as mention above: runserver 192.168.0.13:8000
It worked for me.
The error i did to get the message was the use o... | 3 | 88 | 0 | I am running python manage.py runserver from a machine A
when I am trying to check in machine B. The url I typed is http://A:8000/ .
I am getting an error like The system returned: (111) Connection refused | manage.py runserver | 0 | 0 | 1 | 220,548 |
5,769,096 | 2011-04-24T06:37:00.000 | 1 | 0 | 0 | 0 | python,sockets,tcp,udp,twisted | 5,769,103 | 4 | false | 0 | 0 | Can you afford to lose messages? If yes, use UDP. Otherwise use TCP. It's what they're designed for. | 4 | 3 | 0 | I'm planning to design a server that receives data from multiple clients, the server don't need to send anything back to the client, though STATUS_OK is still cool but not necessary.
I know the basics of Python socket module, twisted framework but my question is, should i use UDP or TCP? The client that need to stay c... | Python Socket programming (TCP vs. UDP) | 0.049958 | 0 | 1 | 3,415 |
5,769,096 | 2011-04-24T06:37:00.000 | -2 | 0 | 0 | 0 | python,sockets,tcp,udp,twisted | 5,769,114 | 4 | false | 0 | 0 | For how long will one client be connected to the server? How many concurrent connections are you planning to handle? If there will be very short bursts of data for a lot of clients, then you should go with UDP. But chances are, TCP will do just fine initially. | 4 | 3 | 0 | I'm planning to design a server that receives data from multiple clients, the server don't need to send anything back to the client, though STATUS_OK is still cool but not necessary.
I know the basics of Python socket module, twisted framework but my question is, should i use UDP or TCP? The client that need to stay c... | Python Socket programming (TCP vs. UDP) | -0.099668 | 0 | 1 | 3,415 |
5,769,096 | 2011-04-24T06:37:00.000 | 4 | 0 | 0 | 0 | python,sockets,tcp,udp,twisted | 5,771,992 | 4 | false | 0 | 0 | You should always use TCP until you have a performance problem that you know can be mitigated with UDP. TCP is easier to understand when it fails. | 4 | 3 | 0 | I'm planning to design a server that receives data from multiple clients, the server don't need to send anything back to the client, though STATUS_OK is still cool but not necessary.
I know the basics of Python socket module, twisted framework but my question is, should i use UDP or TCP? The client that need to stay c... | Python Socket programming (TCP vs. UDP) | 0.197375 | 0 | 1 | 3,415 |
5,769,096 | 2011-04-24T06:37:00.000 | 0 | 0 | 0 | 0 | python,sockets,tcp,udp,twisted | 5,774,174 | 4 | false | 0 | 0 | I would use TCP in your situation, but it's hard to tell what the specifics of your needs are. TCP is in most cases a better protocol because it's much more reliable. Data is very rarely lost in TCP, however this does slow it down a bit. Since you're not sending anything back to the client, the fact that TCP is a strea... | 4 | 3 | 0 | I'm planning to design a server that receives data from multiple clients, the server don't need to send anything back to the client, though STATUS_OK is still cool but not necessary.
I know the basics of Python socket module, twisted framework but my question is, should i use UDP or TCP? The client that need to stay c... | Python Socket programming (TCP vs. UDP) | 0 | 0 | 1 | 3,415 |
5,770,944 | 2011-04-24T14:04:00.000 | 4 | 0 | 0 | 0 | python,graphics,2d | 5,770,967 | 1 | true | 0 | 1 | I recommend PyQt for this - it's a GUI library/framework but it has very good drawing capabilities. If you look at the examples coming with PyQt, focusing on the graphics & drawing samples, it's quite amazing what you can do with very few lines of code.
Oh, and it does the double-buffering you mention automatically so ... | 1 | 2 | 0 | I'm looking for a Python 2D graphics library that can basically do the following and not necessarily anything more:
Create a window of specified width and height
Set the RGB of pixel X, Y on the back buffer.
Swap buffers
...and that's it basically. I can't find anything that doesn't come with a massive amount of comp... | Basic Python 2D graphics? | 1.2 | 0 | 0 | 4,847 |
5,771,925 | 2011-04-24T17:03:00.000 | 1 | 0 | 0 | 0 | python,mysql | 5,771,943 | 5 | false | 0 | 0 | Not possible with standard SQL functionality. | 2 | 10 | 0 | In Python, is there a way to get notified that a specific table in a MySQL database has changed? | python: how to get notifications for mysql database changes? | 0.039979 | 1 | 0 | 30,571 |
5,771,925 | 2011-04-24T17:03:00.000 | 10 | 0 | 0 | 0 | python,mysql | 5,771,988 | 5 | false | 0 | 0 | It's theoretically possible but I wouldn't recommend it:
Essentially you have a trigger on the the table the calls a UDF which communicates with your Python app in some way.
Pitfalls include what happens if there's an error?
What if it blocks? Anything that happens inside a trigger should ideally be near-instant.
Wh... | 2 | 10 | 0 | In Python, is there a way to get notified that a specific table in a MySQL database has changed? | python: how to get notifications for mysql database changes? | 1 | 1 | 0 | 30,571 |
5,773,057 | 2011-04-24T20:31:00.000 | 0 | 0 | 1 | 0 | python | 5,773,114 | 7 | false | 0 | 0 | A game is clearly a nice thing. Maybe Tetris or Snake-like?
While commandline stuff are great to learn as you don't have to worry about graphical stuff they might be boring for a kid. | 2 | 9 | 0 | So I'm teaching a friends son some python programming, just going through control of flow, basic data types/structures.
I want to go through a tutorial with him, and hopefully build something simple yet cool to get him excited about the power of python.
Any ideas? | A cool python script to get teen learning python excited about programming? | 0 | 0 | 0 | 43,675 |
5,773,057 | 2011-04-24T20:31:00.000 | 10 | 0 | 1 | 0 | python | 5,773,130 | 7 | false | 0 | 0 | Teach him map, reduce , lambda and other simple stuff :)
And then show him this code to find factorial of a series of number in one line.
(lambda k: reduce(int.__mul__, range(1,k+1),1))(8)
He will surely get excited | 2 | 9 | 0 | So I'm teaching a friends son some python programming, just going through control of flow, basic data types/structures.
I want to go through a tutorial with him, and hopefully build something simple yet cool to get him excited about the power of python.
Any ideas? | A cool python script to get teen learning python excited about programming? | 1 | 0 | 0 | 43,675 |
5,774,685 | 2011-04-25T02:27:00.000 | 4 | 1 | 1 | 0 | python,benchmarking | 5,775,608 | 1 | false | 0 | 0 | The big problem with Pystone as a benchmark of anything (whether it be Python interpreter versions or the underlying hardware) is that it simply doesn't exercise enough different aspects of the computing environment.
Integer arithmetic, floating point arithmetic, vector operations, dedicated media hardware, memory thro... | 1 | 1 | 0 | I'm starting up a distributed computing project, somewhat like the various @home projects out there (though not doing simple scientific computing, but instead occasionally engaging the remote user in tasks involving presentation of audio and visual stimuli) and I need to get a sense of the relative system performance a... | What are the arguments against using pystone to estimate overall relative system performance across multiple systems? | 0.664037 | 0 | 0 | 447 |
5,775,246 | 2011-04-25T04:46:00.000 | 1 | 0 | 1 | 0 | python,debugging,cuda,gpgpu,pycuda | 5,775,399 | 1 | true | 0 | 0 | Almost nothing. It mostly sets compiler flags in the pycuda.driver module so that CUDA code gets compiled with the necessary debugging symbols and assembled in the way CUDA-gdb requires. The rest is a tiny wrapper that nicely encapsulates the pycuda libraries so thar everything works. The whole thing is about 20 lines ... | 1 | 1 | 0 | As part of a larger project, I've come across a strangely consistent bug that I can't get my head around, but is an archetypical 'black box' bug; when running with cuda-gdb python -m pycuda.debug prog.py -args, it runs fine, but slow. If i drop pycuda.debug, it breaks. Consistently, at exactly the same point in multipl... | What does pycuda.debug actually do? | 1.2 | 0 | 0 | 958 |
5,778,973 | 2011-04-25T13:46:00.000 | 0 | 0 | 1 | 0 | python | 5,778,999 | 2 | false | 0 | 0 | You have to use Python 2.6 to use MutableMapping | 1 | 1 | 0 | I am getting the following errror when a python program is run
File
"/home/user/Desktop/important/paper/ordereddict.py",
line 1, in
from collections import MutableMapping ImportError: cannot
import name MutableMapping
When I tried import collections it works fine. Please help.
I am using version Python 2... | Error from collections module in Python | 0 | 0 | 0 | 3,206 |
5,779,989 | 2011-04-25T15:30:00.000 | 0 | 0 | 0 | 1 | python,file,file-io,permissions | 5,780,048 | 2 | false | 0 | 0 | Make sure you have permissions to change the file. Who is the owner of the file? Is it the one who runs the Python script? All these have to be taken into account. | 1 | 11 | 0 | I need to make a file readable and writable in python. Currently the file is read-only. I am running on a Windows machine. I run the following code:
os.chmod(projectPath, stat.S_IWRITE | stat.S_IREAD)
on a file that needs to be read/write. But when I try to execute the file that needs to be read write, I get the fo... | Read/Write files in Python | 0 | 0 | 0 | 4,572 |
5,780,397 | 2011-04-25T16:17:00.000 | 0 | 0 | 0 | 0 | python,django,django-filer | 13,129,716 | 2 | false | 1 | 0 | Had a similar problem. I had missed that when easy_thumbnails is automatically pulled in by pip, you still have to explicitly add it to your INSTALLED_APPS in settings.py.
I spotted this because when I was uploading images, they weren't appearing in the clipboard, and when inspecting the response from the upload, there... | 1 | 3 | 0 | Can someone point me in the right direction on how to use Django-filer? I have installed the necessary tools for the filer to work and I get the Filer tab in the admin interface, but when I upload an image to the app I am not able to get the preview thumbimage. The image is also uploaded to the Media_root path(Public f... | How to use Django-filer(asset file manager)? | 0 | 0 | 0 | 1,363 |
5,782,875 | 2011-04-25T20:26:00.000 | 2 | 0 | 0 | 0 | python,mysql,macports | 5,782,960 | 1 | true | 1 | 0 | To use py26-mysql you don't need the entire server distribution for MySQL. You do need the client libs, at the very least. If you remove the server, you need to make sure you re-install the base libraries needed by the Python module to function. | 1 | 0 | 0 | I am developing a database based django application and I have installed apache, python and django using macport on a snow leopard machine. I ran into issues installing MySQL with macport. But I was able to successfully install a standalone MySQL server (from MySQL.com). Is it possible to remove the MysQL package insta... | Is it possible to install py26-mysql without installing mysql5 package? | 1.2 | 1 | 0 | 182 |
5,785,348 | 2011-04-26T02:41:00.000 | 0 | 0 | 0 | 0 | python,html,django,xhtml | 5,785,403 | 3 | false | 1 | 0 | you can use {% if friends|length == 9 %} to check if you have 9 records. | 1 | 7 | 0 | I am trying to create a dynamic HTML table with 3 columns and 3 rows. Each column will have 3 records from the database so there will be 9 total records displayed (if they have 9 friends. otherwise just however many they have). I am doing this to mainly display small user profile pictures with their friends' usernames ... | Creating a 3 column HTML table with dynamic data in Django | 0 | 0 | 0 | 11,330 |
5,785,669 | 2011-04-26T03:45:00.000 | 1 | 0 | 0 | 1 | python,curses | 30,829,405 | 5 | false | 0 | 0 | I think you should use curses.endwin(). It restores the terminal window...
In fact if you don't call it after program is closed terminal will show everything like it is in the curses window... | 2 | 3 | 0 | I wrote a small program in python and outputted some screen display using the curses library. For my simple output this seems to work. I run my python program from the command line.
My problem is that if I kill the python program the terminal doesn't properly display. For example:
'ls -al' displays properly bef... | Terminal display broken after killing python curses program | 0.039979 | 0 | 0 | 4,010 |
5,785,669 | 2011-04-26T03:45:00.000 | 7 | 0 | 0 | 1 | python,curses | 5,785,673 | 5 | true | 0 | 0 | Usually the reset command will reset your terminal settings to default values. | 2 | 3 | 0 | I wrote a small program in python and outputted some screen display using the curses library. For my simple output this seems to work. I run my python program from the command line.
My problem is that if I kill the python program the terminal doesn't properly display. For example:
'ls -al' displays properly bef... | Terminal display broken after killing python curses program | 1.2 | 0 | 0 | 4,010 |
5,787,277 | 2011-04-26T07:29:00.000 | 3 | 0 | 1 | 0 | python,parameters,identifier,metasyntactic-variable | 5,787,323 | 4 | false | 0 | 0 | It doesn't have a special value in the code you write. It stores the result of the last expression you evaluated in your interactive interpreter and is used for convenience | 1 | 29 | 0 | I have a python specific question. What does a single underscore _ as a parameter means?
I have a function calling hexdump(_). The _ was never defined, so I guess it has some special value, I could not find a reference telling me what it means on the net. I would be happy if you could tell me. | Python underscore as a function parameter | 0.148885 | 0 | 0 | 16,851 |
5,788,526 | 2011-04-26T09:40:00.000 | 0 | 0 | 0 | 0 | python,qt,pyqt,qwizard | 5,788,678 | 2 | false | 0 | 1 | I'm not sure I see the logical connection between the different questions you're asking here. If you want to go back to already visited pages, why do you want to delete the history?
With the help of overloading the nextID method of either the QWizard or separate QWizardPages you can easily implement any custom visiting... | 1 | 2 | 0 | I'm working on a project that basically follows a pre-defined structure, like a state machine or a wizard. I stumbled upon QWizard, its nextId() function seemed to be a good way to make my wizard dyamically load further pages. Now, it would be very nice to go back to earlier, already visited pages of the wizard. But ev... | QWizard: delete history of visited pages | 0 | 0 | 0 | 607 |
5,788,891 | 2011-04-26T10:18:00.000 | 1 | 0 | 1 | 1 | python,shell | 33,261,131 | 13 | false | 0 | 0 | Besides subprocess.call, you can also use subprocess.Popen. Like the following
subprocess.Popen(['./script', arg1, arg2]) | 1 | 74 | 0 | I would like to run a command in Python Shell to execute a file with an argument.
For example: execfile("abc.py") but how to add 2 arguments? | Execute a file with arguments in Python shell | 0.015383 | 0 | 0 | 186,617 |
5,789,455 | 2011-04-26T11:12:00.000 | 0 | 0 | 0 | 1 | python,windows,delphi,lua,desktop-application | 5,789,728 | 2 | false | 0 | 0 | Does anyone use anything else for shrink wrap apps on windows? e.g. Java, python etc.
Yes. I assume you're not really asking about Java, since that is so wide-spread. I can count quite a few Java applications that I use, and I don't operate in the "Enterprise" environment.
There are tools that allow you to ship Python... | 1 | 2 | 0 | Does anyone use a scripting language only solution to produce a binary (.exe) to produce a commercial desktop application for windows or mac? e.g. Java, python etc. If so how do you distribute your app and does using a scripting language cause any problems with the installation?
I'm asking about users that can download... | desktop development language compiled binary or scripting language (windows)? | 0 | 0 | 0 | 525 |
5,790,860 | 2011-04-26T13:11:00.000 | 6 | 0 | 1 | 0 | python,performance,list,dictionary | 5,790,963 | 11 | false | 0 | 0 | IMHO, using list() and dict() makes your Python look like C. Ugh. | 2 | 150 | 0 | I understand that they are both essentially the same thing, but in terms of style, which is the better (more Pythonic) one to use to create an empty list or dict? | [] and {} vs list() and dict(), which is better? | 1 | 0 | 0 | 137,917 |
5,790,860 | 2011-04-26T13:11:00.000 | 3 | 0 | 1 | 0 | python,performance,list,dictionary | 67,441,905 | 11 | false | 0 | 0 | There is no such difference between list() and [] but if you use it with iterators, it gives us:
nums = [1,2,3,4,5,6,7,8]
In: print([iter(nums)])
Out: [<list_iterator object at 0x03E4CDD8>]
In: print(list(iter(nums)))
Out: [1, 2, 3, 4, 5, 6, 7, 8] | 2 | 150 | 0 | I understand that they are both essentially the same thing, but in terms of style, which is the better (more Pythonic) one to use to create an empty list or dict? | [] and {} vs list() and dict(), which is better? | 0.054491 | 0 | 0 | 137,917 |
5,792,497 | 2011-04-26T15:17:00.000 | 4 | 1 | 0 | 0 | python,net-snmp | 5,794,510 | 1 | true | 0 | 0 | When you pass Timeout=? you are setting the maximum time that snmp's internal select loop should wait before registering a timeout. Setting this to 1000000 means "wait 1 million microseconds", which is 1 second.
However there is also a Retries=? argument that specifies the number of times the snmp client will re-attem... | 1 | 1 | 0 | I have simple example:
import netsnmp
var = netsnmp.Varbind('ifHCInOctets','0')
res = netsnmp.snmpgetnext(var,Version = 2,DestHost='localhost',Community='public',Timeout=1000000)
print res[0]
time python2 test.py show me:
real 0m4.086s
user 0m0.073s
sys 0m0.007s
Why 4 seconds = 1000000 ? snmpd server n... | problem with timeout in netsnmp lib | 1.2 | 0 | 0 | 3,013 |
5,793,414 | 2011-04-26T16:32:00.000 | 6 | 0 | 0 | 0 | javascript,python,browser,mechanize | 5,992,203 | 5 | false | 1 | 0 | Basically if you want something that deals with javascript then you need a real javascript engine, these invariably involve automating a real browser (I'm including headless ones in this).
Java’s HtmlUnit doesn't do a very good job as it doesn't use a javascript engine from an actual browser. Phantom JS sounds ideal (a... | 1 | 28 | 0 | I want to use Mechanize to simulate browsing to a web page with active JavaScript, including DOM Events and AJAX, and so far I've found no way to do that.
I looked at some Python client browsers that support JavaScript like Spynner and Zope, and none of them really work for me. Spynner crashes PyQt all the time, and Zo... | Mechanize and Javascript | 1 | 0 | 0 | 29,397 |
5,794,093 | 2011-04-26T17:26:00.000 | 0 | 0 | 0 | 0 | python,numpy,centos | 5,796,773 | 2 | true | 0 | 0 | the command $rbuild build packages numpy --no-recurse , should be executed at the level where the package is, not in Development/QA or Release Directories. | 1 | 0 | 1 | i am getting error:
rbuild build packages numpy --no-recurse
[Tue Apr 26 13:16:53 2011] Creating rMake build job for 1 items
Added Job 902
numpy:source=rmake-repository.bericots.com@local:taf32-sandbox-1-devel/1-0.2
[13:17:23] Watching job 902
[13:17:24] [902] Loading 1 out of 1: numpy:source
[13:17:26... | How to build numpy with conary recipe for x-86 CentOs | 1.2 | 0 | 0 | 170 |
5,794,238 | 2011-04-26T17:38:00.000 | 1 | 0 | 0 | 0 | javascript,python,authentication,node.js | 5,794,426 | 4 | false | 1 | 0 | I reviewed the documentation and found no user management system.
node.js is a JavaScript server where-as django is an MVC with built-in socket utilities. | 1 | 3 | 0 | I come from Django's framework, and it has built in "user" system. It takes care of all the registrations, passwords, logins, etc.
Does Node.js have this? | How does node.js handle authentication/user systems? | 0.049958 | 0 | 0 | 1,869 |
5,794,502 | 2011-04-26T18:02:00.000 | 13 | 0 | 1 | 0 | python,import,pythonpath,pycharm | 5,794,701 | 1 | true | 0 | 0 | The correct solution is not to try to work around PyCharm's logic, but rather to use the IDE features as they're designed. That means:
Not use any .cmd scripts for starting up PyCharm
Remove all the paths specific to "alpha" and "beta" from the list of paths in Settings | Python Interpreters if any are listed there
Ma... | 1 | 12 | 0 | I have a PyCharm 1.2.1 on Windows. I have to edit different branches of the same project - somewhat heavy branches, because they live in different folders on disk - say it to be c:\apps\alpha and c:\apps\beta. For each such folder PYTHONPATH variable should be adjusted to point to appropriate vendor libraries which liv... | How and why does PyCharm alter Python's import logic? | 1.2 | 0 | 0 | 9,706 |
5,795,147 | 2011-04-26T19:00:00.000 | 10 | 0 | 1 | 0 | python,compilation,pyc | 5,795,261 | 4 | true | 0 | 0 | In your Python lib directory, there will be a script called compileall.py (e.g., /usr/lib/python2.6/compileall.py).
In your code, spawn (e.g., by using os.spawnl) an invocation of compileall.py pointed at the directory containing your generated code. If you invoke it using python -O it will generate .pyo files; if you... | 3 | 7 | 0 | This is for my test suite.
I have an automatically-generated Python package in a temporary folder. It's all .py files. I want to programmatically compile these into (a) .pyc and (b) .pyo files. (One test will do .pyc, another will do .pyo.) This should be done with the active interpreter, of course. I do not want to im... | Python: Programmatically compiling a Python package into pyc or pyo files | 1.2 | 0 | 0 | 5,611 |
5,795,147 | 2011-04-26T19:00:00.000 | 0 | 0 | 1 | 0 | python,compilation,pyc | 46,331,029 | 4 | false | 0 | 0 | chosing between .pyo and pyc is possible with py_compile
import py_compile
compile as simple bytecode:
py_compile.compile('sourcefilename.py', 'destinationfilename.pyc',
doraise=True )
compile as optimised bytecode: both '-o' and '-oo' can be passed as parameters
py_compile.compile('sourcefilename.py', 'destinatio... | 3 | 7 | 0 | This is for my test suite.
I have an automatically-generated Python package in a temporary folder. It's all .py files. I want to programmatically compile these into (a) .pyc and (b) .pyo files. (One test will do .pyc, another will do .pyo.) This should be done with the active interpreter, of course. I do not want to im... | Python: Programmatically compiling a Python package into pyc or pyo files | 0 | 0 | 0 | 5,611 |
5,795,147 | 2011-04-26T19:00:00.000 | 1 | 0 | 1 | 0 | python,compilation,pyc | 5,795,517 | 4 | false | 0 | 0 | Note, that as long as there is a write permission in a directory from which a python module (*.py) is imported, the *.pyc file with the same name will be crated.
Moreover, *.pyc and *.pyo do not add any performance to the program, except decreaed modules loading time. | 3 | 7 | 0 | This is for my test suite.
I have an automatically-generated Python package in a temporary folder. It's all .py files. I want to programmatically compile these into (a) .pyc and (b) .pyo files. (One test will do .pyc, another will do .pyo.) This should be done with the active interpreter, of course. I do not want to im... | Python: Programmatically compiling a Python package into pyc or pyo files | 0.049958 | 0 | 0 | 5,611 |
5,795,214 | 2011-04-26T19:06:00.000 | 2 | 0 | 0 | 0 | python,qt,qstatusbar | 11,617,883 | 6 | false | 0 | 1 | If your showMessages text will be all of the same color, you can define it in the palette of QStatusBar via QtDesigner(window text color) for temporary messages, and then use the QLabel color for normal and permanent messages of different colors. | 1 | 5 | 0 | I'm using Qt with Python, and I've got a mainwindow with a status bar at the bottom. I can display a message in the bar using a QLabel, and set the color of that message using something like "<font color=\"green\">In progress</font>" for the QLabel text.
I would like to also put a temporary message in the status bar, ... | Qt statusbar color | 0.066568 | 0 | 0 | 10,542 |
5,795,492 | 2011-04-26T19:35:00.000 | 7 | 0 | 0 | 0 | python,sqlalchemy,eager-loading | 5,819,858 | 2 | true | 0 | 0 | To force loading lazy attributes just access them. This the simplest way and it works fine for relations, but is not as efficient for Columns (you will get separate SQL query for each column in the same table). You can get a list of all unloaded properties (both relations and columns) from sqlalchemy.orm.attributes.ins... | 1 | 7 | 0 | I have some database structure; as most of it is irrelevant for us, i'll describe just some relevant pieces. Let's lake Item object as example:
items_table = Table("invtypes", gdata_meta,
Column("typeID", Integer, primary_key = True),
Column("typeName", String, index=True),
... | Completing object with its relations and avoiding unnecessary queries in sqlalchemy | 1.2 | 1 | 0 | 3,854 |
5,795,708 | 2011-04-26T19:54:00.000 | 1 | 0 | 0 | 0 | python,web2py | 5,795,972 | 5 | true | 1 | 0 | This shouldn't be handled by web2py. Your database is supposed to handle user permissions for this, so you will need to look in the documentation for the db backend you are using.
Also, if everyone has a separate user account on your front end that all connect to a single database user, then you won't be able to contro... | 2 | 3 | 0 | I would like to restrict users to database entries only they have created. Is their any standard web2py way of doing this? auth.requires_permission looked good, but it appears to require a hard-coded row id, which doesn't solve my problem. | web2py: Restrict user to only rows created by the user | 1.2 | 0 | 0 | 1,415 |
5,795,708 | 2011-04-26T19:54:00.000 | 0 | 0 | 0 | 0 | python,web2py | 7,569,764 | 5 | false | 1 | 0 | Add a 'created_by' field in the db. Insert the user id when inserting the record. Use this to filter while selecting. | 2 | 3 | 0 | I would like to restrict users to database entries only they have created. Is their any standard web2py way of doing this? auth.requires_permission looked good, but it appears to require a hard-coded row id, which doesn't solve my problem. | web2py: Restrict user to only rows created by the user | 0 | 0 | 0 | 1,415 |
5,797,038 | 2011-04-26T22:06:00.000 | 0 | 0 | 0 | 0 | python,django,settings | 5,797,047 | 2 | false | 1 | 0 | Either put them in the user profile model, or create another model with a one-to-one to User. | 1 | 9 | 0 | I would like have additional settings tied to each user in my application (beyond, is_staff, is_admin etc etc). Basically I'd like to have different settings to customize their user experience (ie: don't show tooltips, how many rows to display in results tables, other flags for turning things on or off).
Are there best... | modeling user settings in django | 0 | 0 | 0 | 6,716 |
5,797,046 | 2011-04-26T22:07:00.000 | 3 | 0 | 0 | 1 | python,keyboard,python-idle | 5,797,614 | 2 | true | 0 | 0 | IDLE uses Tkinter from the Python standard library to supply GUI functionality. Tkinter is an interface to the multi-platform Tk graphical interface, part of Tcl/Tk. Unfortunately, Aqua Tk on OS X does not currently support all of the standard text processing features on OS X.
This particular problem appears to be a... | 1 | 1 | 0 | Disclaimer: I'm a noob.
I've installed Python 3.2 (r32:88452) and ActiveTcl 8.5.9.2 (build 294317) on my OSX 10.6. Both installed without any errors, and I've already managed to run a .PY through Terminal. It runs okay.
I run IDLE and it doesn't show any errors. But whenever I press the quote key ('), nothing happens. ... | Python IDLE not accepting quotes | 1.2 | 0 | 0 | 4,436 |
5,797,519 | 2011-04-26T23:08:00.000 | 0 | 0 | 1 | 0 | python,string | 5,797,597 | 5 | false | 0 | 0 | You can use a set:
set('these are all the words the words all are these'.split())
output:
'these', 'the', 'all', 'are', 'words' | 1 | 0 | 0 | How can I delete words that appear multiple times in a file and just keep the first one and delete the clones. | Deleting words that appear multiple times in a file | 0 | 0 | 0 | 264 |
5,798,173 | 2011-04-27T00:56:00.000 | 0 | 1 | 1 | 0 | python,scripting,scripting-language | 5,798,276 | 4 | false | 0 | 0 | draw out a finite state automata of how your language is going to work, write a syntax analyzer, draw some diagrams. Hack on! | 1 | 2 | 0 | I'm relatively new to programming, and I would like to write a simple scripting language as an exercise, and to learn a bit. I have experience with Python, C, and Ruby, and would like to learn to write a scripting language in Python. What should be my first step? How should I start? | write a scripting language in python | 0 | 0 | 0 | 2,946 |
5,799,228 | 2011-04-27T04:08:00.000 | 1 | 0 | 0 | 0 | python,selenium | 53,767,968 | 12 | false | 0 | 0 | You can also inspect the last message in the log for an error status code:
print browser.get_log('browser')[-1]['message'] | 1 | 43 | 0 | I am writing a selenium script by python, but I think I don't see any information about:
How to get http status code from selenium Python code.
Or I missing something. If anyone found that, please feel free to post. | How to get status code by using selenium.py (python code) | 0.016665 | 0 | 1 | 76,570 |
5,799,512 | 2011-04-27T04:51:00.000 | 1 | 0 | 0 | 0 | python,selenium | 6,363,257 | 1 | false | 0 | 0 | I had a similar problem. Sometimes a server we were using (i.e., not the main server we were testing, only a "sub-server") throughout our tests would crash. I added a minor sanity test to see if the server is up or not before the main tests ran. That is, I performed a simple GET request to the server, surrounded it wit... | 1 | 2 | 0 | I'm writing a selenium script by python. Something that I found out, is that when selenium gets 404 status code. it crashes. What is the best way to deal with it? | In selenium.py, How to deal with 404 status code | 0.197375 | 0 | 1 | 618 |
5,799,526 | 2011-04-27T04:53:00.000 | 4 | 0 | 1 | 0 | python,file,save | 5,799,551 | 3 | false | 0 | 0 | Two different issues here:
What to store in the file and how to store it
The logic of when to store and when to load
The first issue is simpler to address as it's more generic. You have several good options here: one is using Python's ConfigParser class for Windows .ini - like configuration files. Alternatively you c... | 1 | 1 | 0 | I'm writing a game in Python and have come to the point where I need a way of saving the players progress. I was thinking of having the script create a text file and write a couple of lines (for storing stat variables, and the room number) when the player exits the game. But I also need it to check if that file exits o... | Python game save file | 0.26052 | 0 | 0 | 2,763 |
5,800,608 | 2011-04-27T07:07:00.000 | 2 | 0 | 1 | 0 | python,django,apache,mod-wsgi,wsgi | 5,800,722 | 4 | false | 1 | 0 | I had the same situation in a Pylons app and ended up using /usr/bin binary plus virtualenv site-packages dir instead.
Of course it was the same python version... | 1 | 6 | 0 | I have a virtualenv at /opt/webapps/ff/ with its own Python installation. I have WSGIPythonHome set to /opt/webapps/ff in my Apache config file (and this is definitely getting used in some capacity, because if I set it to a slightly different existing directory and restart Apache I get a 504). But if I e.g. assert Fa... | Django/Apache/mod_wsgi not using virtualenv's Python binary | 0.099668 | 0 | 0 | 6,113 |
5,801,616 | 2011-04-27T09:01:00.000 | 1 | 0 | 1 | 0 | python | 5,802,868 | 5 | false | 0 | 0 | The only time I've found id() useful outside of debugging or answering questions on comp.lang.python is with a WeakValueDictionary, that is a dictionary which holds a weak reference to the values and drops any key when the last reference to that value disappears.
Sometimes you want to be able to access a group (or all... | 2 | 7 | 0 | Of what use is id() in real-world programming? I have always thought this function is there just for academic purposes. Where would I actually use it in programming?
I have been programming applications in Python for some time now, but I have never encountered any "need" for using id(). Could someone throw some light o... | The use of id() in Python | 0.039979 | 0 | 0 | 1,986 |
5,801,616 | 2011-04-27T09:01:00.000 | 1 | 0 | 1 | 0 | python | 5,801,646 | 5 | false | 0 | 0 | Anywhere where one might conceivably need id() one can use either is or a weakref instead. So, no need for it in real-world code. | 2 | 7 | 0 | Of what use is id() in real-world programming? I have always thought this function is there just for academic purposes. Where would I actually use it in programming?
I have been programming applications in Python for some time now, but I have never encountered any "need" for using id(). Could someone throw some light o... | The use of id() in Python | 0.039979 | 0 | 0 | 1,986 |
5,803,020 | 2011-04-27T11:04:00.000 | 4 | 0 | 1 | 0 | python,mongodb | 5,803,284 | 3 | true | 0 | 0 | Pymongo is the best tool for Mongodb in python. And it's the widely used tool. It's getting popular drastically and it has seen so many versions current being PyMongo 1.10.1. I think you are in the right direction using pymongo | 1 | 0 | 0 | I am a mongodb beginner and I use pymongo. I want to know it is the best to control mongodb using python. | which is the best python mongodb lib | 1.2 | 0 | 0 | 362 |
5,807,346 | 2011-04-27T16:23:00.000 | 1 | 0 | 1 | 0 | python | 5,807,644 | 5 | false | 0 | 0 | use the cPickle module instead of Pickle will accelerate the pickle mechanism, but keep the unpickled dict in memory is a good idea. | 1 | 1 | 0 | I have a fairly large pickled (dict) file in binary format that takes few seconds to load every time I look up a score from it. I was wondering if it's possible to load the file just once in the memory and look up from it until I'm logged out of the program. Also, if there's any other way around to speed up my search.
... | saving the file content in the memory | 0.039979 | 0 | 0 | 190 |
5,807,715 | 2011-04-27T16:55:00.000 | 1 | 0 | 0 | 0 | python,html,web-hosting | 5,808,829 | 2 | true | 1 | 0 | Here's my suggestion: modify your program to include a button for doing the transformation. When you click it, it should take the contents of the clipboard, do whatever transformation you want, and put the result back on the clipboard.
Once you do that, to use it you select the text from the widget, use the keyboard to... | 2 | 0 | 0 | I have a application running in python, i want to send the input taken from the text box of the webpage and send it as input to the application and once again the output of the application which is in text format back to the result page on web.
thanks a lot for your time :) :) | How to send the text pasted in a textbox of a html webpage to the application written in python in the harddisk? | 1.2 | 0 | 0 | 77 |
5,807,715 | 2011-04-27T16:55:00.000 | 0 | 0 | 0 | 0 | python,html,web-hosting | 5,808,739 | 2 | false | 1 | 0 | Have you tried PyQt4 which has this ability built-in? You can do what you're asking in about ten LOC. | 2 | 0 | 0 | I have a application running in python, i want to send the input taken from the text box of the webpage and send it as input to the application and once again the output of the application which is in text format back to the result page on web.
thanks a lot for your time :) :) | How to send the text pasted in a textbox of a html webpage to the application written in python in the harddisk? | 0 | 0 | 0 | 77 |
5,808,236 | 2011-04-27T17:41:00.000 | 0 | 1 | 0 | 0 | python,printing,cad | 5,861,459 | 1 | true | 0 | 0 | In case anyone else runs into this problem (pretty unlikely) I though I'd post briefly what I did in the end:
1.) Wrote a short script to capture the dxf as a BMP (basicaly just a screen grab that appends the scale to the drawing)
2.) Wrote a print dialog with PyQt4 that's a clone of Autocads plot window except that ... | 1 | 0 | 0 | I'm wandering what the best way is to send a fully scaled (1:1) dxf drawing to a cad plotter using python. Has anyone here ever done this?
For those who want to know why:
I've written a program for my employer that automates the drawing of detailed
schematics, apparently so our engineering dept can spend more time do... | Cad plotters and Python | 1.2 | 0 | 0 | 686 |
5,808,819 | 2011-04-27T18:33:00.000 | 0 | 0 | 0 | 0 | python,ajax,svg,cgi,charts | 5,809,518 | 4 | false | 1 | 0 | I would use JavaScript to create or manipulate an SVG document, with AJAX requests polling the server and getting data back. | 1 | 1 | 0 | I am not sure how to accurately describe my problem , and right now i have a total mess in my head , so please deal with it and correct me if i am wrong , and i will be for sure.
MAIN GOAL:
Is to built a real time line chart , which updates itself without web page reloading based on data , which comes from stdout . S... | Real time chart (SVG) + AJAX/Javascript/Jquery + StdOut + Python + I dont really know myself | 0 | 0 | 1 | 5,305 |
5,808,881 | 2011-04-27T18:38:00.000 | 0 | 0 | 0 | 0 | python,pygtk | 5,810,073 | 1 | true | 0 | 1 | myButton.set_sensitive(True) # make button available
myButton.set_sensitive(False) # make button unavailable | 1 | 1 | 0 | I have a toolbar that has the typical buttons: new, save, save as, etc. Is there a way to gray out/disable/make unavailable icons that are not useful?
For instance, if nothing has been changed, disable and gray out the save button, then re-enabled it when something has changed that requires a save.
Thanks for the help! | Make a pygtk stock icon "unavailable" | 1.2 | 0 | 0 | 128 |
5,809,333 | 2011-04-27T19:16:00.000 | 1 | 1 | 0 | 0 | python,unit-testing | 5,810,407 | 1 | true | 1 | 0 | I have the problem and I got it to work by deleting the /usr/local/lib/python2.7 and then reinstalling everything from scratch.
The reason for this I believe is that python may not have cleared it's python object and cache files(*.pyc, *.pyo) from it's working directory. That is, not YOUR project's directory but where ... | 1 | 4 | 0 | I have two systems running the same set of Django unittests. Some of the tests use the @unittest.expectedFailure decorator.
On one system, these are running fine and reporting at the end of the test run OK (expected failures=10, unexpected successes=2).
On the other system, the same tests error, but raise _ExpectedFa... | Python raising _ExpectedFailure for unittests with @unittest.expectedFailure | 1.2 | 0 | 0 | 665 |
5,810,401 | 2011-04-27T20:50:00.000 | 2 | 0 | 1 | 0 | python,cuda,gpgpu,pycuda,multi-gpu | 5,810,676 | 1 | true | 0 | 0 | Pycuda hasn't had any intrinsic multiple-GPU support because CUDA also hasn't had any intrinsic multiple-GPU support. This will change in CUDA 4.0 because the API has been changed to be thread safe and multi-GPU aware. But Pycuda doesn't yet have that support AFAIK. Even when it comes, each device has to be explicitly ... | 1 | 1 | 0 | PyCUDA, for all its faults, usually has very good examples provided with it / downloadable from the wiki. But I couldn't find anything in the examples or in the documentation (or a cursory google search) demonstrating the PyCUDA way of dyanmically allocating workloads to multiple devices.
Can anyone either hint me tow... | PyCUDA; how to distribute workload to multiple devices dynamically | 1.2 | 0 | 0 | 1,019 |
5,810,540 | 2011-04-27T21:02:00.000 | 0 | 0 | 0 | 0 | python,django | 39,394,293 | 7 | false | 1 | 0 | This is not an issue only on Django or python, it's a thing of cloud and software engineering. One server alone may be ok for 10,000 users, given they are not concurrent, also location, are these users in the same city? country?
I believe Django is very good and I will use it my self in a similar project, my issue is ... | 1 | 30 | 0 | I know this is a relatively broad question, but is Django robust enough to build a social network on? I am concerned mainly with performance/speed. For example, for a site with a small user base (<10,000 users), is it possible to create a Django-backed site that would perform at a speed similar to Facebook?
What are it... | Django for social networking | 0 | 0 | 0 | 24,265 |
5,811,043 | 2011-04-27T21:50:00.000 | 4 | 0 | 1 | 0 | python,scipy,least-squares,confidence-interval | 5,816,755 | 3 | false | 0 | 0 | I am not sure what you mean by confidence interval.
In general, leastsq doesn't know much about the function that you are trying to minimize, so it can't really give a confidence interval. However, it does return an estimate of the Hessian, in other word the generalization of 2nd derivatives to multidimensional problem... | 1 | 6 | 1 | How to calculate confidence interval for the least square fit (scipy.optimize.leastsq) in python? | confidence interval with leastsq fit in scipy python | 0.26052 | 0 | 0 | 6,800 |
5,812,362 | 2011-04-28T00:44:00.000 | 2 | 0 | 1 | 0 | python,migration,jython | 5,812,401 | 2 | false | 0 | 0 | The main problem with that is Jython doesn't have any of the standard, or third-party, library modules that use C as it's implementation. Or have C compiled helper modules. There are quite a lot of those, and they may crop up in unexpected ways.
Also, Jython is much slower.
It really depends on what you are migrating,... | 1 | 2 | 0 | I am starting migration process from python to jython. Has anyone done this with ease before?
What are the gotchas? Should I build first inside Jython IDE then deploy or what? | Python to Jython Gotchas? | 0.197375 | 0 | 0 | 411 |
5,814,042 | 2011-04-28T05:31:00.000 | 1 | 0 | 0 | 0 | python,django,oauth | 5,815,430 | 1 | true | 1 | 0 | If I remember correctly they just use the default user model. So just like with the default user object you can create a profile model to store additional information. | 1 | 0 | 0 | My guess is that I am still able to use the user object to get the default information like email or user name. Is this correct?
What if I would like to access some more information not specified on django default user object? | How do I access user information with django with django-social-auth? | 1.2 | 0 | 0 | 348 |
5,814,324 | 2011-04-28T06:06:00.000 | 0 | 0 | 0 | 0 | python,unicode,web-crawler | 5,821,867 | 5 | false | 1 | 0 | As others suggested it is not a bad idea to view the file in a browser.
Store it in utf-8 (like open('x.html','w').write(x.encode('utf-8'))), as most browsers are well equipped to handle utf-8.
In the browser, you may need to change View->Character Encoding to Utf-8.
You will need Arabic fonts on your machine, so the ... | 1 | 1 | 0 | I have crawled some webpages using Python. I ripped off the html tags and only stored some content of those pages as repr(s). Most of those pages are not in English. Now how can I view the crawled content in its original language?
For example, the crawler wrote only one line of some Arabic text to a txt file:
u'\u0639\... | How to view crawled unicoded arabic string? | 0 | 0 | 0 | 1,490 |
5,814,493 | 2011-04-28T06:25:00.000 | 0 | 0 | 0 | 0 | python,html,regex,tags,substring | 5,814,571 | 2 | false | 1 | 0 | Using non greedy matching (*?) can do this easily, at least for your example.
re.findall(r'<raw[^>]*?>(.*?)</raw>', DATA) | 1 | 0 | 0 | I have a requirement wherein I have to extract content inside <raw> tag. For example I need to extract abcd and efgh from this html snippet:
<html><body><raw somestuff>abcd</raw><raw somesuff>efgh</raw></body></html>
I used this code in my python
re.match(r'.*raw.*(.*)/raw.*', DATA)
But this is not returning any subst... | Python: Need to extract tag content from html page using regex, but not BeautifulSoup | 0 | 0 | 1 | 2,535 |
5,814,837 | 2011-04-28T06:59:00.000 | 2 | 0 | 0 | 0 | python,api,hosting,dns,registration | 5,814,951 | 3 | false | 1 | 0 | There is no general API for this. You have to check back with your own domain registration organization. This is specific to the related domain provider. | 1 | 6 | 0 | I'm trying to make a website that allows you to setup a photo gallery with a custom domain name.
Users of the site don't know how to register or configure domain names, so this has to be done for them.
User enters desired domain name in a box (we check if it's available) and click 'register' button and our website regi... | What is the best API for registering and configuring domain names? | 0.132549 | 0 | 1 | 4,713 |
5,816,070 | 2011-04-28T08:53:00.000 | 4 | 0 | 0 | 0 | python,ssh,twisted,socks,paramiko | 5,823,383 | 2 | false | 0 | 0 | This socket-wrapper allows you to use static ssh-tunnels. I found a common solution for my problem:
Use paramiko SSHClient class
Extend SSHClient with your own class
Re-implement the connect() method:
Instead of using a standard socket object we pass to it a fixed proxied socket from the python package sockipy | 1 | 3 | 0 | So, I need to connect to SSH server through proxy socks.
I read paramiko and twisted.conch docs, but didn`t found proxy socks support there. | Python ssh client over socks (proxy) | 0.379949 | 0 | 1 | 3,885 |
5,817,182 | 2011-04-28T10:28:00.000 | 1 | 0 | 0 | 0 | python,django,mongodb,redis,neo4j | 5,821,550 | 4 | false | 0 | 0 | stay with mongodb. Two reasons - 1. its better to stay in the same domain if you can to reduce complexity and 2. mongodb is excellent for querying and requires less work than redis, for example. | 2 | 16 | 0 | We're currently in the process of implementing a CRM-like solution internally for a professional firm. Due to the nature of the information stored, and the varying values and keys for the information we decided to use a document storage database, as it suited the purposes perfectly (In this case we chose MongoDB).
As p... | Using MongoDB as our master database, should I use a separate graph database to implement relationships between entities? | 0.049958 | 1 | 0 | 2,546 |
5,817,182 | 2011-04-28T10:28:00.000 | 6 | 0 | 0 | 0 | python,django,mongodb,redis,neo4j | 5,836,158 | 4 | false | 0 | 0 | The documents in MongoDB very much resemble nodes in Neo4j, minus the relationships. They both hold key-value properties. If you've already made the choice to go with MongoDB, then you can use Neo4j to store the relationships and then bridge the stores in your application. If you're choosing new technology, you can go ... | 2 | 16 | 0 | We're currently in the process of implementing a CRM-like solution internally for a professional firm. Due to the nature of the information stored, and the varying values and keys for the information we decided to use a document storage database, as it suited the purposes perfectly (In this case we chose MongoDB).
As p... | Using MongoDB as our master database, should I use a separate graph database to implement relationships between entities? | 1 | 1 | 0 | 2,546 |
5,817,519 | 2011-04-28T11:00:00.000 | 1 | 0 | 0 | 1 | python,eclipse,wing-ide | 5,817,554 | 1 | false | 0 | 0 | Found the solution: ctrl+shift+o. | 1 | 1 | 0 | Does wingide have an eclipse-like open resource feature (ctrl+shift+r)? | wingide feature | 0.197375 | 0 | 0 | 62 |
5,818,242 | 2011-04-28T12:00:00.000 | 1 | 0 | 1 | 0 | python,github,restructuredtext,docutils | 5,863,357 | 2 | true | 1 | 0 | Perhaps you can just use a symlink? | 1 | 0 | 0 | Github will parse a reStructuredText file if its extension is .rst. The docutils buildhtml.py will only parse files with the extension .txt, and I can't see an option to change that. This is massively annoying. Is there any way to get Github to recognise .txt files as RST or buildhtml to recognise .rst files? | Is it possible to reconcile github and docutils buildhtml? | 1.2 | 0 | 0 | 204 |
5,818,732 | 2011-04-28T12:39:00.000 | 1 | 0 | 1 | 0 | python,multithreading,image-processing | 5,818,792 | 3 | false | 0 | 0 | Don't go with threads, they are too complicated for what you want. Instead, use the subprocess library to spawn separate processes working through each directory.
So you will have a primary program that generates a list of files, then starts popping each file off the list and feeding it into a subprocess. The subproces... | 1 | 4 | 0 | I'd like to recurse a directory of images and generate thumbnails for each image. I have 12 usable cores on my machine. What's a good way to utilize them? I don't have much experience writing multithreaded applications so any simple sample code is appreciated. Thanks in advance. | Multithreaded thumbnail generation in Python | 0.066568 | 0 | 0 | 1,335 |
5,819,205 | 2011-04-28T13:14:00.000 | 0 | 0 | 0 | 0 | python,django | 5,821,241 | 2 | false | 1 | 0 | If you just want to append some links like in the Restaurant change view, you don't really need to use an inline as this provides a form for changing data. I would probably override change_view in RestaurantAdmin to get a list of the related menus and pass it as an extra_context. And then override the model specific ch... | 1 | 0 | 0 | Hi I have a list of restaurants (e.g. McDonalds, etc), with menus (e.g Lunch Menu, Dinner Menu), submenus (e.g. Appetizers, Sandwidches, etc.) and dishes (Angus Burger, Chicken Burger, etc.)
They are all linked by foreign keys.
Is there a way, so that in the Restaurant admin, I have Menu as a tabular inline, with a lin... | In Django Admin, how do you have cascaded InlineModelAdmin | 0 | 0 | 0 | 412 |
5,820,970 | 2011-04-28T15:19:00.000 | 0 | 0 | 0 | 0 | python,html,apache-flex | 5,825,199 | 2 | false | 1 | 0 | The random querystring idea is a good way to make sure the swf is downloaded everytime, but that might not be what you really want to do. Especially if your swf is large in size and it only occasionally needs to update. What I would do is have a service that outputs the most recent version number of my swf. You'll h... | 1 | 0 | 0 | I have a application developed in flex deployed on server. In the application data is filled by user and saved in cookies so as to be available even when the user closes the application. However if new version of application is released the user can still access the older version saved in the cahe. How can it be assure... | How can a flex mxml file being run on server as swf/html file be made non cachable? | 0 | 0 | 0 | 325 |
5,821,895 | 2011-04-28T16:27:00.000 | 0 | 0 | 0 | 0 | python,graph,matplotlib,histogram | 5,821,933 | 2 | false | 0 | 0 | Just convert the values yourself before they are entered. In numpy, you can do just array/1000 instead of array. | 1 | 3 | 1 | I have a histogram I'm drawing in matplotlib with some 260,000 values or so.
The problem is that the frequency axis (y axis) on the histogram reaches high numbers such as 100,000... What I'd really like is to have the y labels as thousands, so instead of, for instance:
100000
75000
50000
25000
0
To have this:
100
75... | Matplotlib histogram, frequency as thousands | 0 | 0 | 0 | 3,743 |
5,823,236 | 2011-04-28T18:21:00.000 | 0 | 0 | 0 | 0 | python,database | 15,442,076 | 5 | false | 0 | 0 | The main reason for DB to have a SQL is to make it separate and generic from the application that you are developing.
To have your own DB built you need to have a storage mechanism could be files on the hard disk, with search options so that you can access data immediately with keywords that you are interested in. on t... | 1 | 2 | 0 | I built a previous program that took client info and stored it in a folder of txt files (impractical much) but now I want to upgrade the program to be more efficient and put the info into a database of some sort...
How can I take the info from the text files and add them to the new database without having to manually d... | If I want to build a custom database, how could I? | 0 | 1 | 0 | 5,085 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.