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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12,760,993 | 2012-10-06T15:13:00.000 | -3 | 0 | 1 | 0 | python,class,dictionary | 12,761,061 | 4 | false | 0 | 0 | I would stick to KISS (Keep it simple stupid). If you only want to store values you are better off with a dictionary, because you can dynamically add values at runtime. WRONG:(But you can not add new filds to a class at runtime.)
So classes are useful if they provide state and behaviour.
EDIT: You can add fields to cla... | 1 | 6 | 0 | I enjoy all the python libraries for scraping websites and I am experimenting with BeautifulSoup and IMDB just for fun.
As I come from Java, I have some Java-practices incorporated into my programming styles. I am trying to get the info of a certain movie, I can either create a Movie class or just use a dictionary wit... | Python: Data Object or class | -0.148885 | 0 | 0 | 9,206 |
12,761,517 | 2012-10-06T16:24:00.000 | 0 | 0 | 0 | 0 | python,rsa,hex | 12,761,645 | 1 | true | 0 | 0 | Python's representation of your result as 0x1L indicates the number's type and value - however, it doesn't truncate the number at all. While it is stored as a long internally, its value is still just 1 in this case. | 1 | 0 | 0 | I've writing a RSA implementation in Python and have now successfully encrypted it however when it prints out the cipher, every time it comes out '0x1L.' I believe this is a long number, however I do not know how to show the full number. If my code is required, I will post in the comments section( It is quite long).
T... | Full Hexadecimal Representation in Python? | 1.2 | 0 | 0 | 399 |
12,763,015 | 2012-10-06T19:16:00.000 | 1 | 1 | 0 | 1 | linux,jar,python-2.7 | 12,763,086 | 2 | false | 0 | 0 | If you only want it to run on a Linux machine, using Python eggs is the simplest way.
python snake.egg will try to execute the main.py inside the egg.
Python eggs are meant to be packages, and basically is a zip file with metadata files included. | 1 | 1 | 0 | Sorry if my title is not correct. Below is the explanation of what i'm looking for.
I've coded a small GUI game (let say a snake game) in python, and I want it to be run on Linux machine. I can run this program by just run command "python snake.py" in the terminal.
However, I want to combine all my .py files into one f... | How to make an executable for a python project | 0.099668 | 0 | 0 | 172 |
12,763,440 | 2012-10-06T20:13:00.000 | 4 | 0 | 1 | 0 | python,heroku | 38,451,714 | 3 | false | 1 | 0 | You can run heroku run bash and backup the file then deploy your app run heroku run bash again and remove the new file and replace it with the old one you backed up. Hope it helps | 1 | 9 | 0 | I have a project on Heroku. This project allows me to update a JSON file. If update something on Heroku via the project's web interface I see the update. I can close the browser, open it again and the update persists.
Now, I want to push something to this project. If I do, the JSON file will be overwritten. So, I pull... | How to Access files on Heroku? | 0.26052 | 0 | 0 | 9,743 |
12,763,608 | 2012-10-06T20:31:00.000 | 0 | 0 | 0 | 0 | python,machine-learning,recommendation-engine,latent-semantic-indexing,topic-modeling | 14,583,682 | 2 | false | 0 | 0 | "represent a user as the aggregation of all the documents viewed" : that might work indeed, given that you are in linear spaces. You can easily add all the documents vectors in one big vector.
If you want to add the ratings, you could simply put a coefficient in the sum.
Say you group all documents rated 2 in a vector ... | 2 | 2 | 1 | I'm trying to come up with a topic-based recommender system to suggest relevant text documents to users.
I trained a latent semantic indexing model, using gensim, on the wikipedia corpus. This lets me easily transform documents into the LSI topic distributions. My idea now is to represent users the same way. However, o... | User profiling for topic-based recommender system | 0 | 0 | 0 | 602 |
12,763,608 | 2012-10-06T20:31:00.000 | 1 | 0 | 0 | 0 | python,machine-learning,recommendation-engine,latent-semantic-indexing,topic-modeling | 12,764,041 | 2 | false | 0 | 0 | I don't think that's working with lsa.
But you maybe could do some sort of k-NN classification, where each user's coordinates are the documents viewed. Each object (=user) sends out radiation (intensity is inversely proportional to the square of the distance). The intensity is calculated from the ratings on the single... | 2 | 2 | 1 | I'm trying to come up with a topic-based recommender system to suggest relevant text documents to users.
I trained a latent semantic indexing model, using gensim, on the wikipedia corpus. This lets me easily transform documents into the LSI topic distributions. My idea now is to represent users the same way. However, o... | User profiling for topic-based recommender system | 0.099668 | 0 | 0 | 602 |
12,763,814 | 2012-10-06T20:56:00.000 | 0 | 0 | 0 | 0 | python,web2py | 21,023,517 | 1 | false | 1 | 0 | I think you should attack one thing at the time and, for each one, try paste some code that helps a lot. I try to answer the last question: I think you won't be able to do that with crud interface without change the inner code (DO NOT DO THAT!). With SQLFORM, you can, altering CSS on Fields. But, the best and more cont... | 1 | 1 | 0 | I'm creating a custom file upload form in Web2Py, and was hoping some more experienced users could help me solve a few issues. Basically, the database ("t_file") is defined in "db_wizard.py", and in the controller, I'm calling crud.create(db.t_file, next=URL('upload')); a form is added in the html file with {{form}}.
... | Web2Py - Custom File Upload Form with Crud | 0 | 0 | 0 | 764 |
12,764,463 | 2012-10-06T22:30:00.000 | 0 | 0 | 0 | 0 | python,open-source,polygon,polyline | 12,885,734 | 1 | false | 0 | 0 | I think you can iterate through the points,
And at each point compare to all points examined so far.
If there's a match, close-off a polygon.
Not sure if you're going to get much better than O(n^2). | 1 | 0 | 0 | I have a road network shapefile as a polyline and I want to convert this to a polygon layer wherever the network forms a 'hole' or closes in on itself. The problem is a hole could be made from more than one road feature. (i.e. three connecting roads form a hole). This means that I cant just say "if the first feature ve... | Creating polygon from polyline | 0 | 0 | 0 | 1,029 |
12,765,039 | 2012-10-07T00:20:00.000 | 2 | 0 | 0 | 0 | python,search,graph,nodes,breadth-first-search | 12,765,116 | 1 | true | 0 | 0 | Not a lot of information to go on, but I suspect the following is your problem. You have to add the nodes to the visited dictionary as soon as they are added to the fringe queue. If you wait until you visit them (i.e. when they reach the head of the fringe queue) then you might have the same node in the fringe queue ... | 1 | 0 | 0 | I am solving a problem for an AI course and I have to implement a graph search with the BFS algorithm in Python. My implementation actually finds the solution, but it expands too many nodes. The answer says that 269 nodes should be expanded, but I got 275.
To keep track of the visited nodes I use a dictionary. The keys... | Too many nodes expanded in BFS graph search | 1.2 | 0 | 0 | 2,278 |
12,765,264 | 2012-10-07T01:05:00.000 | 0 | 0 | 1 | 0 | python,algorithm,search | 12,765,338 | 2 | false | 0 | 0 | Check out Xapian for storing searchable information and retrieving it (results = results!) as well as Levenshtein distance algorithms for which there are several modules for out there. | 1 | 0 | 0 | I have a list of phrases. I need to check if part of these phrases appear in a big block of text.
e.g.
Marshmallows are delicious and warm
Giant unicorns sign wonderful melodies of the imminent apocalypse
The wizards assaulted the fort, but forgot their spell books at home!
Block of text is:
Marshmallows are deliciou... | Python - Search for occurances within text | 0 | 0 | 0 | 92 |
12,766,124 | 2012-10-07T04:28:00.000 | 2 | 0 | 1 | 1 | python,python-idle,python-2.3 | 12,766,135 | 2 | false | 0 | 0 | I'm guessing that you're running python hello.py within the Python REPL. This won't work; python hello.py is something that starts Python that you'll need to run in your system shell. | 2 | 0 | 0 | I am very very new to Python. I am trying to get a python program to run by writing 'python hello.py' but every time I do that I get a Syntax Error. Why is that?
However when I open the file and click on run module, it works. Why won't it work if I type 'python hello.py'
Is there anyway I can navigate to the directory ... | Python Shell - Syntax Error | 0.197375 | 0 | 0 | 923 |
12,766,124 | 2012-10-07T04:28:00.000 | 0 | 0 | 1 | 1 | python,python-idle,python-2.3 | 12,766,384 | 2 | true | 0 | 0 | What is the error?
Place python's filepath to the python.exe in your system's PATH, then you can run a python file from anywhere. | 2 | 0 | 0 | I am very very new to Python. I am trying to get a python program to run by writing 'python hello.py' but every time I do that I get a Syntax Error. Why is that?
However when I open the file and click on run module, it works. Why won't it work if I type 'python hello.py'
Is there anyway I can navigate to the directory ... | Python Shell - Syntax Error | 1.2 | 0 | 0 | 923 |
12,767,315 | 2012-10-07T08:39:00.000 | 0 | 0 | 0 | 0 | python,optimization,graphics,pygame | 12,767,902 | 1 | true | 0 | 1 | Well for starters, one huge bitmap is not really good, since it eats away resources.
What I do, is divide the map into size of camera, and end up with having 9 tiles displayed at a time, moving the camera shifts the map, and draws only the ones that are seen.
There isn't a huge improvement though.
You can always try ... | 1 | 2 | 0 | I'm writing a 2D Elite-style game in Python+Pygame, and I need to move the starmap about so the player can look at the whole thing.
The way I've done this sort of thing before is to just add the coordinates of the 'camera' to the coordinates of everything else when drawing. However, I notice Pygame has a function to mo... | Is Surface.scroll() the right way to implement a movable 2D viewpoint in Pygame? | 1.2 | 0 | 0 | 676 |
12,768,765 | 2012-10-07T12:20:00.000 | 1 | 0 | 1 | 0 | python | 12,768,846 | 1 | true | 0 | 0 | One safe thing, OS independent, and reliable is certainly to close the file, and open it again on writting.
If the performance hindrance due to that is unacceptable, you could try to use "seek" to move to the end of file before writing. I just did some naive testing in the interactive console, and indeed, using file.s... | 1 | 0 | 0 | I have noticed that python always remembers where it finished writing in a file and continues from that point.
Is there a way to reset that so that if the files is edited by another program that removes certain text and ads another python will not fill the gaps with NULL when it does next write?
I have the file open in... | python and another program writing to the same file | 1.2 | 0 | 0 | 51 |
12,769,933 | 2012-10-07T15:04:00.000 | 12 | 1 | 0 | 0 | python,compression,twisted | 12,770,967 | 3 | true | 0 | 0 | Just 10K from the middle of the file will do the trick. You don't want the beginning or the end, since they may contain header or trailer information that is not representative of the rest of the file. 10K is enough to get some amount of compression with any typical algorithm. That will predict a relative amount of c... | 2 | 9 | 0 | I'm using an event loop based server in twisted python that stores files, and I'd like to be able to classify the files according to their compressibility.
If the probability that they'd benefit from compression is high, they would go to a directory with btrfs compression switched on, otherwise they'd go elsewhere.
I d... | How can I estimate the compressibility of a file without compressing it? | 1.2 | 0 | 0 | 3,128 |
12,769,933 | 2012-10-07T15:04:00.000 | 5 | 1 | 0 | 0 | python,compression,twisted | 12,770,116 | 3 | false | 0 | 0 | Compressed files usually don't compress well. This means that just about any media file is not going to compress very well, since most media formats already include compression. Clearly there are exceptions to this, such as BMP and TIFF images, but you can probably build a whitelist of well-compressed filetypes (PNGs... | 2 | 9 | 0 | I'm using an event loop based server in twisted python that stores files, and I'd like to be able to classify the files according to their compressibility.
If the probability that they'd benefit from compression is high, they would go to a directory with btrfs compression switched on, otherwise they'd go elsewhere.
I d... | How can I estimate the compressibility of a file without compressing it? | 0.321513 | 0 | 0 | 3,128 |
12,770,077 | 2012-10-07T15:21:00.000 | 0 | 0 | 1 | 0 | python,dll,wrapper,ctypes | 12,996,919 | 2 | false | 0 | 1 | Maintaining a Python library with a ctypes backend isn't an unmanageable approach. Obviously the initial investment is larger than using automated tools, but the API you are left with should be much better.
If you do take that route, aim to separate the Python API entirely from the C library though. Supporting multiple... | 1 | 7 | 0 | I have a poorly designed and big (> 300 public functions, >200 numeric constants defined with #define in the header file) that I have to wrap in Python. I have the dll and the h file. The library is updated yearly, till now in a backwards compatible way (i.e. just functions were added, a constant keep their numerical v... | Maintainability of a python wrapping of a C library | 0 | 0 | 0 | 249 |
12,770,950 | 2012-10-07T17:09:00.000 | 4 | 0 | 0 | 0 | python,flask,webfaction | 12,770,986 | 5 | false | 1 | 0 | The problem is there's probably some kind of proxy in front of Flask. In this case the "real" IP address can often be found in request.headers['X-Forwarded-For']. | 1 | 33 | 0 | I just deployed a Flask app on Webfaction and I've noticed that request.remote_addr is always 127.0.0.1. which is of course isn't of much use.
How can I get the real IP address of the user in Flask on Webfaction?
Thanks! | Flask request.remote_addr is wrong on webfaction and not showing real user IP | 0.158649 | 0 | 1 | 42,164 |
12,773,856 | 2012-10-07T23:53:00.000 | 0 | 0 | 1 | 0 | python,abstract-data-type | 12,773,918 | 2 | false | 0 | 0 | The second design you describe would basically mean an item can only ever be in one collection at the same time. This would be rather awkward to use. Generally, collections (which stacks and queues are) should be able to store any kind of object without affecting the object's state.
So, yes, with any sane implementatio... | 1 | 0 | 0 | If I want to move a value from a queue to a stack (value should no longer be in the queue, just in the stack), do I need to dequeue it before pushing it to the stack, or will pushing it to the stack automatically dequeue it? | Moving a value from a queue to a stack | 0 | 0 | 0 | 329 |
12,774,029 | 2012-10-08T00:27:00.000 | 1 | 0 | 0 | 0 | python,api,sockets,twisted,beanstalkd | 12,780,748 | 1 | true | 0 | 0 | The currently available beanstalkc v0.3.0 uses blocking socket I/O operations. | 1 | 1 | 0 | I'm writing a socket API using twisted framework which needs to write to beanstalkd in a deferred, is the current Python Beanstalkc client implementation non-blocking?
I've searched extensively on Stackoverflow for answers about this matter without luck, any help would be greatly appreciated. Thanks in advance | Is the current Python Beanstalkc client implementation non-blocking? | 1.2 | 0 | 0 | 152 |
12,775,710 | 2012-10-08T05:19:00.000 | 1 | 0 | 1 | 0 | python,file,download | 12,775,799 | 2 | false | 0 | 0 | Actually you get text file in response to a POST request with several base64-encoded request parameters. Feel free to play with it
use Firebug or any other debug tool to see the POST content and parameters | 1 | 0 | 0 | I need to write a function that downloads and stores the today's list of pre-release domains .txt file from
http://www.namejet.com/pages/downloads.aspx.
So as today is 8th of October you want to get the file "Monday, October 08, 2012".
Tried with requests but didn't work.
I'm having trouble because the file is not st... | How to download text file from website using Python? | 0.099668 | 0 | 0 | 1,469 |
12,775,844 | 2012-10-08T05:34:00.000 | 14 | 0 | 0 | 0 | python,django,postgresql,sql-order-by | 12,775,949 | 3 | true | 1 | 0 | order_by can have multiple params, I think order_by('score', '-create_time') will always return the same queryset. | 1 | 8 | 0 | I'd like to know how Django's order_by works if the given order_by field's values are same for a set of records. Consider I have a score field in DB and I'm filtering the queryset using order_by('score'). How will records having the same values for score arrange themselves?
Every time, they're ordered randomly within ... | Django - How does order_by work? | 1.2 | 0 | 0 | 16,934 |
12,778,033 | 2012-10-08T08:38:00.000 | 0 | 0 | 0 | 0 | python,django,dhtmlx | 12,778,355 | 1 | true | 1 | 0 | Turns out you can't do this with templates, and so you have to move over to HttpResponces and building up your return manually, which may not be worth it for a lot of people. | 1 | 1 | 0 | I have a page, which returns 10,000+ records as XML, which takes 7 seconds to return which i'm happy with, as most of it isn't displayed until the user scrolls down.
But my front end has to wait 7 seconds for django to return anything so it can start showing the output, DHTMLX is able to render as data is being receiv... | Is it possible to return (stream) a response (xml) from django as the output is rendering? | 1.2 | 0 | 0 | 445 |
12,778,380 | 2012-10-08T08:59:00.000 | 0 | 0 | 1 | 0 | python,memory,memcached,shared | 12,781,903 | 1 | true | 0 | 0 | Yes, it does. Note that the memcached folks do not recommend storing anything larger than 1 megabyte, so you're well above that recommendation. | 1 | 0 | 0 | The situation - I have 2 computers, the first one has python and second one has memcache. There is some key in memcache, which references to the object in memory which size is 1 GB approximately. If I access that object from python and want to run through, does it mean that python process will copy the whole object to ... | Python process memory and Memcache memory. Is python using the memory address or it copies data? | 1.2 | 0 | 0 | 108 |
12,780,635 | 2012-10-08T11:17:00.000 | 2 | 0 | 0 | 0 | python,webpage,pywinauto | 13,868,001 | 2 | false | 0 | 0 | I think for interacting with webserver better is to use cUrl. All webservers function are responses for GET or POST request (or both). in order to call them, just call the urls that buttons are linked to and/or send POST data attaching that data to appropiate request obj before calling send method. cUrl is able to retr... | 1 | 0 | 0 | I want to be able to access the elements of a webpage with python. I use Python 2.5 with Windows XP. Currently, I am using pywinauto to try to control IE, but I could switch to a different browser or module if it is needed. I need to be able to click the buttons the page has and type in text boxes. So far the best I've... | How to control and interact with elements on a webpage displayed with IE or a different browser with pywinauto | 0.197375 | 0 | 1 | 694 |
12,781,929 | 2012-10-08T12:38:00.000 | 4 | 0 | 1 | 0 | python,windows,upgrade | 12,782,236 | 1 | true | 0 | 0 | The problem is chiefly with packages written in C: they will be linked with the 3.2 Python code. It might just be a question of re-linking them, but I have had issues with popular packages like numpy (I currenty can't get that to compile on 3.3).
The pure Python packages would probably be OK in theory, but honestly, ... | 1 | 2 | 0 | What are the possibilities to upgrade my existing Python installation (in my case from version 3.2.2 to 3.3.0) on my Windows 7 x64 system and not having to re-install all my packages? Is there a convenient/automated solution to do this?
I'd like to end up with only one Python version on my system. | How to upgrade my Python version on Windows 7 without having to re-install all packages? | 1.2 | 0 | 0 | 8,862 |
12,782,181 | 2012-10-08T12:53:00.000 | 0 | 0 | 1 | 0 | python,windows,dll,import | 12,805,887 | 2 | false | 0 | 0 | Finally found it.
The .pyd file for arcgisscripting (basically a .dll specific to python) is at C:\Program Files (x86)\ArcGIS\Desktop10.1\bin\arcgisscripting.pyd
If I point DependencyWalker at that file it indicates that several dependencies for that are not found.
So it seems the solution is to:
1) find the last file ... | 1 | 0 | 0 | I'm trying to get a python program to run on a windows box.
I have it running on my development windows box but when I transfer it to another windows box I keep getting:
ImportError: DLL load failed: %1 is not a vaild Win32 aplication
The trace suggests it is having trouble with imports, it basically goes through sever... | ImportError DLL load failed, but import at command line works | 0 | 0 | 0 | 3,182 |
12,785,963 | 2012-10-08T16:48:00.000 | 4 | 1 | 1 | 0 | python,m2crypto | 12,786,065 | 1 | false | 0 | 0 | usually just doing import m2crypto is sufficient
you may need to easy_install m2crypto first or maybe even pip install m2crypto
If you are on windows you may need the Visual Studio DLL to compile it | 1 | 2 | 0 | I need to work with m2crypto library. How can I import it to my .py file? I use Eclipse. | How to import m2crypto library into python | 0.664037 | 0 | 0 | 17,398 |
12,786,680 | 2012-10-08T17:35:00.000 | 2 | 0 | 0 | 0 | python,routes,flask,tornado | 12,786,744 | 2 | false | 1 | 0 | Tornado templates uses syntax similar to Jinja, but the rendering engine is not Jinja. You might be able to get away with it, but then you would have to keep track of which templates are Jinja and which are Tornado.
For the sake of sanity, just keep them separate. | 2 | 0 | 0 | Is possible to combine Tornado and Flask web templates together?
For example: Use Index.html as "base" template setting up block for extensions:
Then ,extend index with "block" from Flask for Flask Routes
Then, extend index with "block" from Tornado for Tornado Routes.. | Combining Tornado and Flask templates | 0.197375 | 0 | 0 | 394 |
12,786,680 | 2012-10-08T17:35:00.000 | 1 | 0 | 0 | 0 | python,routes,flask,tornado | 12,859,244 | 2 | false | 1 | 0 | You are not bound to the default template engine in Flask. Maybe you could somehow use Tornado's template engine in Flask, then it'd be possible to use the templates in both. | 2 | 0 | 0 | Is possible to combine Tornado and Flask web templates together?
For example: Use Index.html as "base" template setting up block for extensions:
Then ,extend index with "block" from Flask for Flask Routes
Then, extend index with "block" from Tornado for Tornado Routes.. | Combining Tornado and Flask templates | 0.099668 | 0 | 0 | 394 |
12,787,317 | 2012-10-08T18:23:00.000 | 0 | 0 | 0 | 0 | python,web2py | 12,809,067 | 2 | false | 1 | 0 | In your table that contains the upload information, add a new string field called 'validation_key'. When a file is uploaded, insert a GUID or reasonably long alpha-numeric string in it. Send this key as part of the link in the email. When the user clicks the link, search for the key and if found, set the matched 'valid... | 1 | 0 | 0 | web2py experts. The task I'm trying to accomplish is the following:
-permit a person browsing my site to upload a file to my site through a form (implemented through crud.create())
-the visitor is not required to establish an account or log in to upload a file
-the user is required to provide an email address in or... | Web2Py - Validate uploaded file by email | 0 | 0 | 0 | 262 |
12,788,394 | 2012-10-08T19:44:00.000 | 1 | 0 | 0 | 0 | python,wxpython | 12,788,472 | 2 | true | 0 | 1 | wx has to be compiled for each target plattform. Binaries are always OS dependent, so no, there cannot be a portable wx version. | 1 | 1 | 0 | I recently discovered how easy and convenient using wxPython is for writing GUI applications. Unfortunately installing wxPython is a giant throbbing pain in the neck. I consider myself pretty tech-savvy but it took me almost an hour to get a working setup of wxPython on a Pythonbrew install on an Ubuntu machine. On my ... | Can I embed wxPython in my project, saving users the trouble of installing it? | 1.2 | 0 | 0 | 298 |
12,789,138 | 2012-10-08T20:40:00.000 | 2 | 0 | 0 | 0 | python,attributes | 12,789,190 | 2 | false | 0 | 0 | Not all operating systems have the concept of "hidden" for files, and most (even with all the different versions of Windows 7 etc. there are still more forms of *nix out there than Windows) indicate it by having the first character of the filename be a period (.). On the OSes that do support it you must use some extern... | 1 | 2 | 0 | In Python, how do you make a particular file hidden? Or how do you set the file attribute as 'hidden' without using external API's/modules such as WIN32API, etc.
Surely there is something in the standard libraries? As the os module does allow to set the "read" and 'write' attributes, it is very strange that there is no... | Hidden file attributes | 0.197375 | 0 | 0 | 3,767 |
12,791,275 | 2012-10-09T00:27:00.000 | 2 | 1 | 1 | 0 | python,pypi | 12,792,669 | 2 | true | 0 | 0 | You could include the defaults as part of your script and then allow the user to change the defaults with either command line arguments or a config file in the user's home directory.
I don't think the Django approach would work unless you have the concept of a project.
If this is on Unix I would either put the config f... | 2 | 3 | 0 | I have a command-line python script that uses a configuration file. I'm planning to put this on pypi soon.
What is the best general approach for including a default version of the configuration file in the package, so that it is obvious to the end-user where to find it?
One example of a pypi project which includes use... | Best way to include a user-editable config file in a pypi package? | 1.2 | 0 | 0 | 426 |
12,791,275 | 2012-10-09T00:27:00.000 | 0 | 1 | 1 | 0 | python,pypi | 14,864,557 | 2 | false | 0 | 0 | I like Nathan's answer. But in this specific case I wound up adding a command-line option to the script that would dump an example config file to standard out. | 2 | 3 | 0 | I have a command-line python script that uses a configuration file. I'm planning to put this on pypi soon.
What is the best general approach for including a default version of the configuration file in the package, so that it is obvious to the end-user where to find it?
One example of a pypi project which includes use... | Best way to include a user-editable config file in a pypi package? | 0 | 0 | 0 | 426 |
12,791,769 | 2012-10-09T01:42:00.000 | 1 | 0 | 0 | 0 | python,pdf,reportlab | 13,022,662 | 1 | true | 1 | 0 | If you use Platypus with ReportLab you can get a table of contents "for free": just see the ReportLab manual for details but you basically just add a TableOfContents to the list of Flowables for the document and you're done. Otherwise you'll have to figure out all the logic for building a table of contents yourself. | 1 | 0 | 0 | I want to add contents on first page. But the data is uncertain, contents must draw depend on the data.
I try to fix this problem by drawing twice, calculating and recording the contents, and it works well.
But it wastes time and ungainly.
Can I insert first page after completing drawing? Or other ways to fix this prob... | Reportlab: How to add uncertain contents using BaseDocTemplate? | 1.2 | 0 | 0 | 384 |
12,794,631 | 2012-10-09T07:09:00.000 | 1 | 1 | 1 | 0 | python,nose,nosetests | 12,794,692 | 3 | false | 0 | 0 | Using --with-doctests implies that you're running doctests. Anything outside of a doctest can be considered a unit test. AFAIK, they're not mutually exclusive, so you can't strictly tell which you're running if you've enabled --with-doctests.
Having said that, doctests generally are a form of unit test, so I'm not quit... | 1 | 0 | 0 | I am using Python Nose and would like to print the type of the test ran, like whether it is a Doctest or unittest or so? How can this be done?
Thanks. | Print the test type in Python Nose | 0.066568 | 0 | 0 | 502 |
12,796,443 | 2012-10-09T09:05:00.000 | 0 | 0 | 0 | 0 | python,active-directory | 14,350,855 | 1 | true | 0 | 0 | It seems that active_directory is using default Win32 API, which doesn't support user/pass binding to a different DC.
You may have to use ldap module and find a workaround | 1 | 0 | 0 | I'm using Python to write a simple client to Move users, Reset password, Extend user account using Tim Golden's active_directory module.
Currently I'm using the module with the default domain that I logged in with, and it works perfectly. But now I can't find any way to connect to another domain using the same module, ... | Connect to AD domain with authentication using Python | 1.2 | 0 | 1 | 913 |
12,797,999 | 2012-10-09T10:26:00.000 | 48 | 0 | 0 | 0 | python,django | 12,798,019 | 3 | true | 1 | 0 | No. It's not for making websites. Your sample just sounds like you want plain old HTML.
Django is for creating web applications. That is, software, normally backed by a database, that includes some kind of interactivity, that operates through a browser. A Framework provides a structure and common methods for making th... | 1 | 64 | 0 | I heard a lot of people talking about Django on various forums. But I am having a very basic question : What is meant by Framework and why Django is used.
After listening a lot about Django, I ran few chapters for Django (from Djangobook.com). After running these chapters, I am wondering how Django can be used to crea... | For what purpose Django is used for? | 1.2 | 0 | 0 | 66,634 |
12,799,772 | 2012-10-09T12:12:00.000 | 4 | 0 | 0 | 0 | python,django,facebook,facebook-graph-api,django-socialauth | 12,824,092 | 1 | true | 1 | 0 | The API does not let you access the user's contact number. You will have to request the user's contact details manually using a form. | 1 | 4 | 0 | I am using django-social_auth to make users register and login via facebook. I want to access the phone number of the user.
Tried searching on google and stackoverflow , but didn't find any answer. Searched the facebook docs as well. There I found that there used to be permission for 'user_mobile_phone' but it has bee... | How to fetch user's mobile number from facebook? | 1.2 | 0 | 0 | 2,059 |
12,803,495 | 2012-10-09T15:31:00.000 | 1 | 0 | 0 | 0 | python,data-mining,graph-algorithm,recommendation-engine,apriori | 12,807,402 | 2 | false | 0 | 0 | For Apriori, you do not need to have tuples or vectors. It can be implemented with very different data types. The common data type is a sorted item list, which could as well look like 1 13 712 1928 123945 191823476 stored as 6 integers. This is essentially equivalent to a sparse binary vector and often very memory effi... | 1 | 1 | 1 | I read that Apriori algorithm is used to fetch association rules from the dataset like a set of tuples. It helps us to find the most frequent 1-itemsets, 2-itemsets and so-on. My problem is bit different. I have a dataset, which is a set of tuples, each of varying size - as follows :
(1, 234, 56, 32)
(25, 4575, 575, 46... | Algorithms for Mining Tuples of Data on huge sample space | 0.099668 | 0 | 0 | 631 |
12,805,732 | 2012-10-09T17:59:00.000 | 2 | 1 | 0 | 0 | python,security,flask,spam-prevention | 12,806,423 | 3 | false | 1 | 0 | You should sit down and decide what exactly your "core" problems in the scenario of your app are, and who your likely users will be. That will help you guide the right solution.
In my experience, there are a lot of different problems and solutions in this subject - and none are a "one size fits all"
If you have a pro... | 3 | 4 | 0 | I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly.
I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the s... | Leanest way to prevent scripted abuse of a web app? | 0.132549 | 0 | 0 | 1,007 |
12,805,732 | 2012-10-09T17:59:00.000 | 0 | 1 | 0 | 0 | python,security,flask,spam-prevention | 14,003,551 | 3 | false | 1 | 0 | An extremely simple method that I have used before is to have an additional input in the registration form that is hidden using CSS (i.e. has display:none). Most form bots will fill this field in whereas humans will not (because it is not visible). In your server-side code you can then just reject any POST with the inp... | 3 | 4 | 0 | I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly.
I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the s... | Leanest way to prevent scripted abuse of a web app? | 0 | 0 | 0 | 1,007 |
12,805,732 | 2012-10-09T17:59:00.000 | 4 | 1 | 0 | 0 | python,security,flask,spam-prevention | 12,806,126 | 3 | false | 1 | 0 | There is no way to achieve this with cookies, since a malicious script can just silently drop your cookie. Since you have to support the case where a user first visits (meaning without any cookies set), there is no way to distinguish between a genuine new user and a malicious script by only considering state stored on ... | 3 | 4 | 0 | I am running flask/memcached and am looking for a lean/efficient method to prevent automated scripts from slamming me with requests and/or submitting new posts too quickly.
I had the thought of including a 'last_action' time in the session cookie and checking against it each request but no matter what time I set, the s... | Leanest way to prevent scripted abuse of a web app? | 0.26052 | 0 | 0 | 1,007 |
12,806,542 | 2012-10-09T18:53:00.000 | 1 | 0 | 0 | 0 | python,listview,wxpython | 12,807,804 | 3 | false | 0 | 1 | As I recall, you have to bind to EVT_LIST_BEGIN_LABEL_EDIT. Then in your event handler you just check what column you're in and if you're in a column that you want to be editable, then you do "event.Allow()", otherwise you veto. | 2 | 7 | 0 | Is there any way to disable the editing of specific cells by the user when using ListCtrl with TextEditMixin?
I guess there's some way that Vetos the editing event, however I can't find it. | wx.ListCtrl with TextEditMixin - Disable Editing of Selected Cells | 0.066568 | 0 | 0 | 2,303 |
12,806,542 | 2012-10-09T18:53:00.000 | 2 | 0 | 0 | 0 | python,listview,wxpython | 45,455,459 | 3 | false | 0 | 1 | In wxPython version 4.0.0 the line:
if event.m_col == 1
does not work. Use
if event.GetColumn() == 1
instead. | 2 | 7 | 0 | Is there any way to disable the editing of specific cells by the user when using ListCtrl with TextEditMixin?
I guess there's some way that Vetos the editing event, however I can't find it. | wx.ListCtrl with TextEditMixin - Disable Editing of Selected Cells | 0.132549 | 0 | 0 | 2,303 |
12,807,069 | 2012-10-09T19:29:00.000 | 12 | 0 | 1 | 0 | python,scope | 12,807,083 | 4 | true | 0 | 0 | There is nothing special about if __name__ == '__main__' block whatsoever. That is to say, its scope is determined by the place it occurs. Since such blocks typically occur at top-level, their scope is global.
If this block were to occur in a function, which is perfectly legal, its scope would be local—except that __na... | 3 | 8 | 0 | What is the scope of if __name__ == __main__? Is everything covered by this statement in global space ? | The scope of if __name__ == __main__ | 1.2 | 0 | 0 | 5,139 |
12,807,069 | 2012-10-09T19:29:00.000 | 3 | 0 | 1 | 0 | python,scope | 12,807,114 | 4 | false | 0 | 0 | Python doesn't have block-local scope, so any variables you use inside an if block will be added to the closest enclosing "real" scope. (For an if..main block, they'll usually be attributes of the module.) | 3 | 8 | 0 | What is the scope of if __name__ == __main__? Is everything covered by this statement in global space ? | The scope of if __name__ == __main__ | 0.148885 | 0 | 0 | 5,139 |
12,807,069 | 2012-10-09T19:29:00.000 | 2 | 0 | 1 | 0 | python,scope | 12,807,435 | 4 | false | 0 | 0 | It is in the global scope as long as:
it is called in the global scope, i.e. not from within a function
it is in the code file that is being executed.
To illustrate (2):
Suppose you're code is in foo.py, and in bar.py, you have the statement from foo import *. In this case, the if __name__ == "__main__": block in foo... | 3 | 8 | 0 | What is the scope of if __name__ == __main__? Is everything covered by this statement in global space ? | The scope of if __name__ == __main__ | 0.099668 | 0 | 0 | 5,139 |
12,808,050 | 2012-10-09T20:39:00.000 | 0 | 0 | 0 | 0 | python,scipy,cluster-analysis | 12,810,026 | 2 | false | 0 | 0 | The second is what clustering is: group objects that are somewhat similar (and that could be images). Clustering is not a pure imaging technique.
When processing a single image, it can for example be applied to colors. This is a quite good approach for reducing the number of colors in an image. If you cluster by colors... | 1 | 1 | 1 | I am having a hard time understanding what scipy.cluster.vq really does!!
On Wikipedia it says Clustering can be used to divide a digital image into distinct regions for border detection or object recognition.
on other sites and books it says we can use clustering methods for clustering images for finding groups of s... | Can anyone provide me with some clustering examples? | 0 | 0 | 0 | 1,663 |
12,808,978 | 2012-10-09T21:52:00.000 | 7 | 0 | 0 | 0 | python,selenium,multiprocessing,nosetests,parallel-testing | 14,650,568 | 1 | false | 0 | 0 | Try running nosetests with the --process-timeout value set to something higher than your tests would reasonably take:
nosetests --processes=2 --process-timeout=120 | 1 | 4 | 0 | I am trying to run the functional tests in parallel with multiprocess plugin which gives me random TimeoutException sometimes
my tests are really simple, each of them just goes to a webpage and check if certain element exists.
does anybody know what might be the cause?
thanks | parallel testing with selenium + nose | 1 | 0 | 1 | 1,972 |
12,810,499 | 2012-10-10T00:56:00.000 | 1 | 0 | 0 | 0 | python,numpy,statistics | 12,810,655 | 3 | false | 0 | 0 | Here's a simple algorithm in python that does what you are expecting.
Let's take for example a single dimension array P equal to [0.1,0.3,0.4,0.2]. The logic can be extended to any number of dimensions.
Now we set each element to the sum of all the elements that precede it:
P => [0, 0.1, 0.4, 0.8, 1]
Using a random gen... | 1 | 2 | 1 | I have numpy two dimension array P such that P[i, j] >= 0 and all P[i, j] sums to one. How to choose pair of indexes (i, j) with probability P[i, j] ?
EDIT: I am interested in numpy build function. Is there something for this problem? May be for one dimensional array? | randomly choose pair (i, j) with probability P[i, j] given stochastic matrix P | 0.066568 | 0 | 0 | 1,166 |
12,814,973 | 2012-10-10T08:20:00.000 | 7 | 1 | 0 | 1 | python,django,centos,bitnami | 12,898,508 | 1 | false | 1 | 0 | Can you execute the following and see if it solves your issue?
. /opt/bitnami/scripts/setenv.sh
(notice the space between the dot and the path to the script)
Also what are you executing that gives you that error? | 1 | 4 | 0 | I getting the below issue when firing up django or ipython notebook
/opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5
However libreadline.so.5 exists in my system after locating it as shown below
root@linux:/opt/bitnami/scripts# locate libreadline.so.5
/opt/bitnami/common/li... | Bitnami - /opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5 | 1 | 0 | 0 | 1,566 |
12,815,874 | 2012-10-10T09:15:00.000 | 2 | 0 | 1 | 0 | python,design-patterns,operators,duck-typing | 12,815,935 | 4 | false | 0 | 0 | I'm thinking of, e.g., a case where someone uses someone elses implementation of xmlparser.get() which always returns a string, even if the property is basically a number.
You might want to coerce the value to a number by calling int or float on it, as appropriate. | 2 | 2 | 0 | Is there a way to obtain an exception when the == (equal) operator is used to compare different types? Python 3 throws an exception when attempting to order objects of different types. But == still returns False.
Or is there some other way to avoid hard to detect bugs caused by wrong type assumptions? Are there any d... | Python equal operator, avoid bugs of type: ( == ) -> False | 0.099668 | 0 | 0 | 489 |
12,815,874 | 2012-10-10T09:15:00.000 | 2 | 0 | 1 | 0 | python,design-patterns,operators,duck-typing | 12,815,948 | 4 | true | 0 | 0 | No. Because for ==, the reasoning is that equality implies comparibility. If two objects aren't even comparable they are not equal, therefore it will return false and never throw an exception. | 2 | 2 | 0 | Is there a way to obtain an exception when the == (equal) operator is used to compare different types? Python 3 throws an exception when attempting to order objects of different types. But == still returns False.
Or is there some other way to avoid hard to detect bugs caused by wrong type assumptions? Are there any d... | Python equal operator, avoid bugs of type: ( == ) -> False | 1.2 | 0 | 0 | 489 |
12,816,482 | 2012-10-10T09:50:00.000 | 1 | 0 | 1 | 1 | python,macos,python-imaging-library,homebrew | 12,818,253 | 1 | true | 0 | 0 | I think you would see this issue if you were using the python binary that was not installed by homebrew along with a package that you did install via homebrew. Could you verify that the python binary you are using is not the one that was included in OS X by default? | 1 | 1 | 0 | I have installed PIL with homebrew. It then says that there was a symlink error, and that is can be easily fixed by doing it again, but with a sudo. I did so. Now, when I go into python, and import Image, it doesn't work! I've tried import PIL, import image, import pil, and none of them work. When I try to install it a... | I have installed PIL with Homebrew, but when I try to import it, it says no module exists | 1.2 | 0 | 0 | 344 |
12,818,397 | 2012-10-10T11:35:00.000 | 1 | 0 | 0 | 0 | python,gtk | 12,827,853 | 2 | false | 0 | 1 | I have currently ended up doing this:
Instead of GtkMenuToolButton I have GtkToolItem with custom content
In custom content I have GtkMenuButton
Inside that one, I delete the default GtkArrow and replace it with 1x2 GtkGrid which has a Label + GtkArrow
As a whole it does what I want =) | 1 | 1 | 0 | I am using GtkMenuToolButton and it has a button and a menu. When you click on the arrow the menu is opened. I'd like to make the button open that same menu as well. Simply emitting "show-menu" in the "clicked" callback did not work. Please help how to make this work. | How to make GtkMenuToolButton open the same menu when 'clicked' signal is emitted? | 0.099668 | 0 | 0 | 213 |
12,819,489 | 2012-10-10T12:35:00.000 | 2 | 1 | 0 | 0 | python,nose,nosetests | 12,820,015 | 2 | true | 0 | 0 | You can achieve that effect ignoring all regular test files.
This can be done easily using the -I or --ignore-files options and a regex like .*\.py.
An other way could be to save the doctests in a separate directory and launch nose on that.
In newer versions of nose this doesn't seem to work anymore. | 1 | 4 | 0 | Is there a way to run only doctests using Python Nose (nosetests)? . I do not want to run any unittests but only and only the doctests.
Thanks. | run only doctests from python nose | 1.2 | 0 | 0 | 604 |
12,821,201 | 2012-10-10T14:01:00.000 | -1 | 0 | 1 | 0 | python,nlp,nltk | 12,821,336 | 4 | false | 0 | 0 | I don't think there is a specific method in nltk to help with this. This isn't tough though. If you have a sentence of n words (assuming you're using word level), get all ngrams of length 1-n, iterate through each of those ngrams and make them keys in an associative array, with the value being the count. Shouldn't be m... | 1 | 14 | 1 | I've read a paper that uses ngram counts as feature for a classifier, and I was wondering what this exactly means.
Example text: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam"
I can create unigrams, bigrams, trigrams, etc. out of this text, where I have to define on which "level" to create these un... | What are ngram counts and how to implement using nltk? | -0.049958 | 0 | 0 | 21,407 |
12,824,745 | 2012-10-10T17:09:00.000 | 1 | 0 | 1 | 0 | python,timer,schedule | 12,826,242 | 4 | false | 0 | 0 | You could:
Use cron (on *nix) or Windows task scheduler to run your script at a desired time.
It will make your solution both simpler and more robust.
Or
Run your script as a daemon and subscribe to file system events to monitor your files.
You could use pyinotify and the like depending on your OS. It provides the b... | 1 | 0 | 0 | Since I'm new to Python, I need some advice from experienced people. What is the best way to run a Python method from time A to time B every T minutes using only core Python libraries?
To be more specific:
I need single threaded app which will start monitor timestamps of pair of files to make sure that the difference i... | how to run a method from time a to time b every t minutes | 0.049958 | 0 | 0 | 206 |
12,825,900 | 2012-10-10T18:25:00.000 | 0 | 0 | 1 | 0 | python-3.x,pydev,pylint | 12,835,241 | 1 | true | 0 | 0 | There are some changes in the formatting of the messages in pylint 0.26 (http://www.logilab.org/ticket/104572) which likely need a pydev update to be properly handled. You should contact the Pydev author and request support for this.
If you can easily configure the command line for pylint in pydev, try adding --includ... | 1 | 1 | 0 | I have installed the latest pylint and it works fine from Windows command line. I have added Pydev-PYTHONPATH with source directory that I want to lint. Also from PyDev->PyLint I've selected 'Use pylint' and updated 'Location of pylint (lint.py):' with the correct lint.py. I don't see any lint output on either the Cons... | Pylint doesn't show anything on Eclipse | 1.2 | 0 | 0 | 923 |
12,826,756 | 2012-10-10T19:21:00.000 | 7 | 0 | 0 | 0 | python,django,csv,fixture | 12,827,105 | 2 | true | 1 | 0 | Django's built-in fixtures functionality doesn't support CSV. You'd need to process the file automatically using the csv module, probably in the test's setUp method. | 1 | 4 | 0 | For a Django test I'd like to load a fixture, which is in a csv file. What is the best way to do that? | Django fixture in csv | 1.2 | 0 | 0 | 2,175 |
12,827,116 | 2012-10-10T19:41:00.000 | 3 | 0 | 1 | 0 | python,python-2.7 | 12,828,126 | 2 | true | 0 | 0 | What was happening is that I needed to use "import node" but I was using "from node import *" from main.py. This was preventing the main.py from linking to the updated node module!
(Sorry for accepting my own answer, but may be someone would also face the same problem later and hence I am uploading the solution) | 1 | 3 | 0 | I am using IDLE to write a few small sized Python programs. There are two class files - node.py (Node Class) and position.py (Position class). I have my main module code in main.py from which I instantiate Node and Position objects.
What I have noticed is that - when I make a change in node.py or position.py, check the... | IDLE Python not detecting changes | 1.2 | 0 | 0 | 1,518 |
12,829,395 | 2012-10-10T22:26:00.000 | 3 | 0 | 1 | 0 | python,math,derivative | 12,829,418 | 5 | false | 0 | 0 | This is called symbolic differentation.
You need to parse the equation into tree of expressions and operations, then apply the normal rules of differentation (from Calculus I) to the tree. | 3 | 0 | 0 | Beginner programmer here looking to write a function that can simply derive a mathematical function.
The function should run like this:
f(x) = x ** 2 + 2 * x <--- user input
f'(x) = 2 * x + 2
I know there's Wolfram and Maple, but I want to write my own actual derivative program. I would like to know if this is possib... | Deriving a mathematical function in python | 0.119427 | 0 | 0 | 7,240 |
12,829,395 | 2012-10-10T22:26:00.000 | 0 | 0 | 1 | 0 | python,math,derivative | 12,829,425 | 5 | false | 0 | 0 | It's absolutely possible. You'll first need to parse the user's input string to get a representation of the function that you can work with. You'll then need to process the various terms in the function according the the differentiation rules you want to support. | 3 | 0 | 0 | Beginner programmer here looking to write a function that can simply derive a mathematical function.
The function should run like this:
f(x) = x ** 2 + 2 * x <--- user input
f'(x) = 2 * x + 2
I know there's Wolfram and Maple, but I want to write my own actual derivative program. I would like to know if this is possib... | Deriving a mathematical function in python | 0 | 0 | 0 | 7,240 |
12,829,395 | 2012-10-10T22:26:00.000 | 4 | 0 | 1 | 0 | python,math,derivative | 12,829,442 | 5 | false | 0 | 0 | It's obviously possible, as there are plenty of programs out there that do symbolic differentiation. That being said, it's non trivial. For your simple example above, you'd need to write a parser that would:
split up each of the terms of polynomial
parse the term and break it down to coefficient, variable, and expo... | 3 | 0 | 0 | Beginner programmer here looking to write a function that can simply derive a mathematical function.
The function should run like this:
f(x) = x ** 2 + 2 * x <--- user input
f'(x) = 2 * x + 2
I know there's Wolfram and Maple, but I want to write my own actual derivative program. I would like to know if this is possib... | Deriving a mathematical function in python | 0.158649 | 0 | 0 | 7,240 |
12,829,528 | 2012-10-10T22:38:00.000 | 1 | 0 | 0 | 0 | python,mysql | 12,829,637 | 2 | false | 0 | 0 | what about print "%s %s" % (row[1], row[2]) (not sure if explicit casting is needed for the rows)
EDIT: or print "{0} {1}".format(s, s2) (the notation with % is a bit old-fashioned) | 1 | 0 | 0 | I have nearly successfully made a query for MySQL via Python that shows the most frequent datasets given the brand. The problem I am having is when I try to run the print row[1], row[2] command, it returns productnum instead of the space I want like product num. I tried doing print row[1], " ", row[2] but it doesn't sa... | A weird space issue Python | 0.099668 | 0 | 0 | 236 |
12,830,437 | 2012-10-11T00:25:00.000 | 0 | 0 | 0 | 0 | c#,python,sql,database,sml | 19,391,151 | 1 | false | 0 | 0 | Have you looked in using something like FileViewerPro? Its free download tool in order to open files. Also, what windows programs have you tried so far, like notepad, excel? | 1 | 3 | 1 | I have Toronto Stock Exchange stock data in a maxtor hard drive. The data is a TBF file with .dat and .pos components. The .dat file contains all the Stamp format transmission information in binary format.
I can read .pos file using R. It has 3 column with numbers, which make no sense to me. The data is information on ... | How to read tbf file with STAMP encryption | 0 | 0 | 0 | 188 |
12,830,829 | 2012-10-11T01:17:00.000 | 3 | 0 | 1 | 0 | python,regex | 12,830,891 | 1 | false | 0 | 0 | You can't expect to get more than a single pair from the regular expression, because there's now way for a set of parentheses to return multiple matches. Even if you do something like (([^:]+):([^ ]+) ?)* (which will match your string), the inner set of parentheses will return only one match (the last one).
If you want... | 1 | 3 | 0 | Been working at this a bit, trying to figure it out for myself. Basically I'm taking user input, that can have a keyword/value structure like so:
Blah abc:def lah:123!dfj blah:22:34
which should end up being
('abc', 'def', 'lah':'123!dfj', 'blah':'22:34')
Currently I have (.[^: ]+):(.[^ ]+), but that's only getting the... | Regex for "a:b" | 0.53705 | 0 | 0 | 246 |
12,835,176 | 2012-10-11T08:20:00.000 | 2 | 0 | 1 | 0 | python | 12,835,628 | 2 | false | 0 | 0 | A potential use case could be a "factory class" which returns instances of various classes depending on the implementation. | 1 | 12 | 0 | I understand what __new__ does (and how it's different from __init__) so I'm not interested in definitions, I'm interested in when and how to use __new__.
The documentation says:
In general, you shouldn't need to override __new__ unless you're subclassing an immutable type like str, int, unicode or tuple
But I can't ... | What are the use cases for Python's __new__? | 0.197375 | 0 | 0 | 1,383 |
12,835,329 | 2012-10-11T08:30:00.000 | 1 | 0 | 0 | 1 | python,hadoop,hadoop-streaming | 12,843,376 | 1 | false | 0 | 0 | You can use S3InputFormat (https://github.com/ATLANTBH/emr-s3-io) to read data directly to you mappers. But beware, in case of job failure you will redownload all data.
So, I suggest to download all data before process it. If you don't need to process whole data at once, you can start you mapreduce after distcp start. ... | 1 | 1 | 0 | I'll broadly divide the work to be done in two parts:
I have huge data (amounting to approx 1 TB, divided into hundreds of files), which I'm copying from S3 to HDFS via distcp
This data will be acted upon by a hadoop streaming job (a simple mapper and reducer, written in python)
Now, I'll have to wait till all the d... | Distcp with Hadoop streaming job | 0.197375 | 0 | 0 | 906 |
12,837,793 | 2012-10-11T10:44:00.000 | 2 | 1 | 1 | 0 | python,postscript | 12,837,843 | 2 | false | 0 | 0 | Actually, in most cases just parsing the Postscript will suffice, since a Postscript document is a normal text file.
As a clarification: yes, I am aware that what a Postscript document displays is a result of a program written in the beautifully reversed or reversely beautiful language called Postscript. In most of the... | 1 | 0 | 0 | I am trying to extract an address automatically from a postscript document that has been intercepted by redmon and piped to a python program. I have gotten to the point where I can capture the postscript output (and write it to a file), but I am stuck at the extraction part.
Is there a good/reliable way of doing thi... | Extracting text from postscript and/or creating overlays using python | 0.197375 | 0 | 0 | 2,171 |
12,839,509 | 2012-10-11T12:26:00.000 | 0 | 0 | 0 | 0 | python,django,webpage | 12,840,259 | 2 | false | 1 | 0 | In your view, you can get the form data using request object. You can pass the form values to your script and send output to your response object.
It seems you didn't completely understand how django works. Please go through the tutorial again. | 1 | 0 | 0 | Am new to Django but want to learn it and have covered pretty much the basics on the Django website.
Here is my problem:
I have written a python script which presently works in the python shell, but I want to make use of the script on my web. So that when a user goes to my website and provides the neccesary input, cli... | How to use a python script on a django website | 0 | 0 | 0 | 1,101 |
12,840,696 | 2012-10-11T13:29:00.000 | 2 | 0 | 0 | 0 | python,youtube-api | 12,842,420 | 1 | false | 0 | 0 | That's not something that's supported as part of the public YouTube Data API. | 1 | 7 | 0 | I am uploading videos to YouTube by using YouTube Data API (Python client library). Is it possible to set monetizing for that video from API rather than going to my account on the YouTube website and manually setting monetization for that uploaded video? If yes, then how can I do it from API? I am unable to find it in ... | Enable Monetization on YouTube video using YouTube API | 0.379949 | 0 | 1 | 1,037 |
12,842,693 | 2012-10-11T15:03:00.000 | 5 | 0 | 1 | 0 | python,xml | 12,842,752 | 2 | false | 0 | 0 | Set up a simple web service that returns the current version number of the xml file and the executable. Have your program dial home to this web service on startup, and if the web service returns a newer version number then what the program has in its local copy then display a message to the user saying they could upda... | 1 | 5 | 0 | I have developed my own program, but I would like to be able to dynamically tell the user that there is an update available for the program. This program is designed to be cross-platform, and is written in python. There will be two types of updates:
1) data updates (an xml file that includes the information required to... | python - Check for updates for a program | 0.462117 | 0 | 1 | 7,942 |
12,845,400 | 2012-10-11T17:40:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,go | 12,847,050 | 1 | true | 1 | 0 | If you change the files that comprise your application, the application will need to restart in order to serve the new files.
If this is a real sticking point for you, I would suggest hosting the files elsewhere, like a CDN. Your application and the static resources that it employs do not need to be all in the same pla... | 1 | 0 | 0 | Is there a way to avoid GAE server restart when the file within the root of my application changes. I use Go (GAE server is python based) runtime.
The intention is not to reload the server when some of my files (html, css, js files; which are under /static folder) changes. This is to avoid startup time during developm... | Exclude files from causing GAE server restart | 1.2 | 0 | 0 | 94 |
12,847,485 | 2012-10-11T19:57:00.000 | 0 | 0 | 1 | 0 | python,verbosity | 12,847,552 | 4 | false | 0 | 0 | Parse your options with argparser and either pass them around or put them in a global
Note that you only have to use the global keyword when you want to assign to some name in the global scope, not when you just want yo read the value. | 1 | 0 | 0 | I want to add a verbose option to my python script but I'm not sure the best way to go about this. My main() function calls a parse_cmdline() function then a process() function. I want to create a function for my verbose option. I'm not sure where I should define my verbose function. Will I have to pass the verbose opt... | Using --verbose in multi function python script | 0 | 0 | 0 | 1,450 |
12,848,684 | 2012-10-11T21:19:00.000 | 4 | 0 | 0 | 0 | python,oop,structure | 12,849,650 | 3 | true | 0 | 1 | Engine is an object that contains data like images and rendering code
This sounds like a God class: they're common in GUI code, and the problem you're having is a common effect of that.
What is the conceptual relationship between different stuff in Engine? Does it need to be tightly coupled, or could the Engine just ... | 1 | 3 | 0 | I am having some issues making 'bigger than simple scripts and stuff' applications in Python. I have a class called WinMain, a class called Engine, one called State and another called Element. It's laid out like this:
WinMain is the main class of the program, it has a mainLoop function and various other things.
Engine... | Python structural issue: Giving an 'engine' class to everything | 1.2 | 0 | 0 | 467 |
12,849,846 | 2012-10-11T22:58:00.000 | 0 | 0 | 0 | 0 | javascript,python,database,web-applications,web-frameworks | 12,849,885 | 3 | false | 1 | 0 | There are many, many, many ways to do what you seem to want to do.
I've been working on a home project that uses tornado.web (easy REST api), mongodb (storage, works espectially well with JSON documents), and nginx (load balancing for surges in requests).
For the front-end, I'm using nginx to serve static web content... | 1 | 0 | 0 | I am working on building a webapp. I have been learning Python on my own for a few months but I need help figuring out HOW to proceed with building the app, specifically which web framework/database to use.
As I'm fairly new to this, I may not be using the correct terms, and
I'm sure many of these things may be obvious... | What Python Framework/database should I use for my webapp | 0 | 0 | 0 | 457 |
12,850,504 | 2012-10-12T00:14:00.000 | 0 | 0 | 1 | 1 | python-3.x,cygwin | 12,863,615 | 1 | false | 0 | 0 | Probably in /usr/bin, or in windows as {Cygwin Install directory}\bin. For example: D:\Cygwin\bin\
Ensure that you run python3.2.exe within the Cygwin emulation layer. | 1 | 0 | 0 | I've seen new cygwin for window contains python3.2 files.
Where is the python3.2.exe file under cygwin on window? I need it to configure interpreter for Eclipse in window, but I don't see it. | How to configure python32 interpreter under cygwin for eclipse in window ? | 0 | 0 | 0 | 544 |
12,850,550 | 2012-10-12T00:21:00.000 | 5 | 0 | 0 | 0 | python,django,postgresql,amazon-elastic-beanstalk | 21,391,684 | 2 | false | 1 | 0 | Postgre is now selectable from the AWS RDS configurations. Validated through Elastic Beanstalk application setup 2014-01-27. | 1 | 5 | 0 | I'm reading conflicting reports about using PostgreSQL on Amazon's Elastic Beanstalk for python (Django).
Some sources say it isn't possible: (http://www.forbes.com/sites/netapp/2012/08/20/amazon-cloud-elastic-beanstalk-paas-python/). I've been through a dummy app setup, and it does seem that MySQL is the only optio... | PostgreSQL for Django on Elastic Beanstalk | 0.462117 | 1 | 0 | 2,422 |
12,851,374 | 2012-10-12T02:26:00.000 | 2 | 1 | 1 | 0 | python,multithreading,nxt-python | 12,852,400 | 1 | true | 1 | 0 | You used the daemon thread instead of normal thread. because this is different to normal thread. I hope so daemon thread resolve your problem. | 1 | 0 | 0 | How do I create a thread that continuously checks for obstacles using the ultrasonic class in nxt-python 2.2.2? I want to implement it in a way that while my robot is moving it also detects obstacles in a background process and once it detects an object it will brake and do something else | Ultrasonic thread that runs in the background in python | 1.2 | 0 | 0 | 235 |
12,851,527 | 2012-10-12T02:49:00.000 | 2 | 0 | 1 | 0 | python,math,installation,createfile | 12,851,575 | 1 | true | 0 | 0 | Instead of writing a script that creates another script, a better way to solve the problem would be to write functions.
For example, the first function would read the names of variables, etc. and return these data as a dictionary.
Next, you would pass this dictionary into the second function, which, depending on the ... | 1 | 0 | 0 | I have looked around for a while now and am still unable to find an answer to a method of doing this. I have made a few scripts to solve equations and now am looking for a way to write a script that will allow input of steps into an equation,number and name of variables etc. My idea is to make a script that will take a... | Python Script to Make Another Script | 1.2 | 0 | 0 | 113 |
12,851,791 | 2012-10-12T03:27:00.000 | 1 | 0 | 1 | 0 | python,string | 12,851,838 | 8 | false | 0 | 0 | If i understand your question right, one way to do is break down the string in chars and then check each char in that string using a loop whether it's a string or a number and then if string save it in a variable and then once the loop is finished, display that to the user | 1 | 171 | 0 | How can I remove digits from a string? | Removing numbers from string | 0.024995 | 0 | 0 | 381,228 |
12,851,898 | 2012-10-12T03:43:00.000 | 0 | 1 | 0 | 0 | django,python-sphinx,tastypie,documentation-generation | 12,867,026 | 3 | false | 1 | 0 | Perhaps I'm completely missing the point of your question but if you are just trying to build the docs that come with the source distribution there is a Makefile in the docs directory that performs the necessary actions. You are required to specify a target output type such as html, json, latex, etc. I keep a local co... | 1 | 14 | 0 | I'm trying to use auto-doc tool to generate API doc for Tastypie REST API. I tried Tastytool, but it seems not showing the API's result parameters but the model's columns. Then I tried Sphinx seems more promising since Tastypie supports Sphinx, but I can't find an example to show where & how to put comment for the API ... | Tastypie documentation generation | 0 | 0 | 0 | 2,869 |
12,851,908 | 2012-10-12T03:44:00.000 | 0 | 0 | 0 | 0 | python,sockets,input,udp,port | 12,851,967 | 2 | false | 0 | 0 | Consider using threads. Python threading is restricted; only one thread runs at a time within the interpreter, but if a thread is waiting for I/O (or a 'sleep') then other threads can run.
You still need to use queues and semaphores and so forth. See the 'threading' module in the library. | 1 | 0 | 0 | How can a client both react to user input and data received from the server?
I created a UDP server, which can handle multiple clients and can react to the data received from each clients. So far the clients only react to user input.
Is it possible, that the clients check for both user input and data on a specific port... | Socketprogramming python | 0 | 0 | 1 | 90 |
12,852,084 | 2012-10-12T04:06:00.000 | 0 | 0 | 0 | 0 | python-2.7,ctypes,windows-7-x64,setupapi,pywinusb | 12,862,740 | 1 | false | 0 | 1 | There is a SetupDiGetClassDevsA and SetupDiGetClassDevsW. The Ex versions allow connecting to a remote machine. The A version takes a byte string for the second parameter, while the W version takes a Unicode string. The return value is a handle to a device information set.
The device information set has to be iterat... | 1 | 0 | 0 | I'm trying to create a simple read/write application for a fairly simple USB device, but it's turning out to be not so simple at all.
I'm using WinUSB and SetupAPI DLLs and working from scratch since I can't seem to find anything that actually works for what I need. PyWinUSB and PyUSB and so on and so forth came close,... | Calling SetupDiGetClassDevs from Python only returns an integer value | 0 | 0 | 0 | 1,154 |
12,853,267 | 2012-10-12T06:13:00.000 | 1 | 0 | 0 | 0 | python,user-interface,3d | 12,854,078 | 1 | false | 0 | 1 | In our company we have been working with the combination, Python, PyQt and OpenGL. It has not been super easy to integrate, but it was the best solution we found around 4 years ago. | 1 | 0 | 0 | I'm looking for a framework to write a GUI in python, the GUI will also include 3D graphics. I would like the development time to be really short, and the framework easy to get started with.
What do you recommend?
I'm considering PyQt but it doesn't seems to have good 3D support.
Another alternative would be a browser ... | 3D & GUI for python | 0.197375 | 0 | 0 | 1,682 |
12,857,063 | 2012-10-12T10:26:00.000 | 1 | 0 | 1 | 1 | python,multithreading,directory | 12,857,136 | 1 | true | 0 | 0 | "Busy" polling is a waste of resources. There are a number of different, operating-system dependant APIs that allow this kind of monitoring.
Some of your choices (for Linux that is) include:
python-inotifyx - simple Python binding to the Linux inotify
python-pyinotify - simple Linux inotify Python bindings
python-gami... | 1 | 0 | 0 | I need to write a program which continuously checks a directory for new files and does some processing whenever there a new file is added. Obviously I will probably need to use some threads but is there any convenient way or pointers that anyone can suggest for achieving this in python ? (FOr both linux and windows) | Checking a directory continuously for new files | 1.2 | 0 | 0 | 384 |
12,858,167 | 2012-10-12T11:32:00.000 | 0 | 0 | 1 | 0 | python,archive,tarfile | 12,858,290 | 2 | false | 0 | 0 | Did you try extractall() method? As I remeber one of the this method arguments contains information where archive should be extracted. | 1 | 2 | 0 | I am writing a program in python and using tarfile to extract tarfiles. Some of these tarfiles contain folders which start with a / or (Alternatively for windows \) which cause problems (files are extracted to wrong place). How can I get around this issue and make sure that the extraction ends up in correct place ? | Extracting a tar file with folders starting with / | 0 | 0 | 0 | 159 |
12,861,495 | 2012-10-12T14:43:00.000 | 1 | 0 | 1 | 0 | python,tkinter | 12,863,076 | 1 | true | 0 | 1 | It is my understanding that tk needs to be run in the main thread. | 1 | 0 | 0 | I am writing a Tkinter App which does some long running operation. In order to prevent Tkinter window from hanging, i am introducing threading :- one thread for performing long running operation, second thread will be for updating GUI based on the QUEUE which will be filled by long running operation. Now I am thinking ... | Python Tkinter in thread or in main app? | 1.2 | 0 | 0 | 688 |
12,861,946 | 2012-10-12T15:05:00.000 | 2 | 0 | 1 | 0 | python,uninstallation,pip,setup.py | 12,871,055 | 2 | true | 0 | 0 | I've solved it. Two steps:
Step 1: I install my project 'zeus'
python setup.py install
Setp 2: uninstall it:
pip uninstall zeus
Done | 2 | 1 | 0 | pip freeze result show:
-e git+git@github.com:Tallmad/zeus@6155c80f5b87cba0aeb8c1bfb6fc6b6dd86b0fa8#egg=zeus-dev
It fails:
pip uninstall git+git@github.com:Tallmad/zeus@6155c80f5b87cba0aeb8c1bfb6fc6b6dd86b0fa8#egg | How to uninstall Python site-package which was installed using "python setup.py develop"? | 1.2 | 0 | 0 | 3,804 |
12,861,946 | 2012-10-12T15:05:00.000 | 0 | 0 | 1 | 0 | python,uninstallation,pip,setup.py | 70,636,526 | 2 | false | 0 | 0 | install again with --record to store installing files.
python setup.py install --record install.log
manually remove those files from the record file
xargs rm -rf < install.log | 2 | 1 | 0 | pip freeze result show:
-e git+git@github.com:Tallmad/zeus@6155c80f5b87cba0aeb8c1bfb6fc6b6dd86b0fa8#egg=zeus-dev
It fails:
pip uninstall git+git@github.com:Tallmad/zeus@6155c80f5b87cba0aeb8c1bfb6fc6b6dd86b0fa8#egg | How to uninstall Python site-package which was installed using "python setup.py develop"? | 0 | 0 | 0 | 3,804 |
12,862,260 | 2012-10-12T15:22:00.000 | 0 | 1 | 1 | 0 | python | 12,863,073 | 1 | false | 0 | 0 | Most likely the problem is that TestLib.py isn't in your working directory. Make sure your Dailyscript.py sets its directory to wherever you ran it from (over SSH) before executing python sample.py.
Also, if you have SSH access, why aren't you just using SSH? | 1 | 0 | 0 | I am trying to run a python file from the telnet session
Steps:
Dailyscript.py
Telnetting in to montavista
from the telnet session I am trying to run another python file "python sample.py"
sample.py
Importing TestLib (in this file)
But, when I run directly form my linux box, it is running fine.
Is there any thing ... | Import Error: No Module found named TestLIb | 0 | 0 | 1 | 581 |
12,862,344 | 2012-10-12T15:27:00.000 | 0 | 0 | 0 | 0 | python,signals,ipc | 12,863,718 | 1 | true | 0 | 0 | Signals are not designed to be general inter-process communication mechanisms that allow for passing data. They can't do much more than provide a notification. What the target process does in response can be fairly general (generating output to a particular file that the sender then knows to go look at, for example), b... | 1 | 2 | 0 | I have a python script that can run for long time in the background, and am trying to find a way of getting a status update from it. Basically we're considering to send it a SIGUSR1 signal, and then have it report back a status update.
Catching the signal in Python is not the issue, lots of information about that.
But ... | Have python process talk back on SIGUSR1 call | 1.2 | 0 | 0 | 882 |
12,864,616 | 2012-10-12T17:58:00.000 | 3 | 0 | 0 | 0 | python,django | 12,864,644 | 3 | false | 1 | 0 | you could pass request.META['QUERY_STRING'] to the template.
You can grab the get params before you render the template and pass them to the template and render them on the correct link.
You could also build a query string from request.GET | 1 | 10 | 0 | I have a certain link to a url in a Django template. I would like to grab all the GET parameters of the current page url and add them to the url of the template's link. The current page might have zero GET parameters. | Generating a url with the same GET parameters as the current page in a Django template | 0.197375 | 0 | 0 | 1,843 |
12,867,465 | 2012-10-12T21:38:00.000 | 1 | 0 | 1 | 0 | python,recursion | 12,869,565 | 2 | false | 0 | 1 | I find it helps a LOT to express recursions in words. What the algorithm says is basically "what's visible at radius N is what's visible from radius N-1". Like, uh, the edge gets bigger. | 1 | 0 | 0 | I am attempting to teach myself python and have hit a rough spot once it has come to recursion. I have done the classic recursive functions (factorial, fibonacci numbers...) but I am going back over old code and trying to convert most of my iterative functions to recursive functions for practice.
This is the wall that ... | Recursive Function To Help Clear Tiles (Field Of View) | 0.099668 | 0 | 0 | 241 |
12,868,135 | 2012-10-12T22:48:00.000 | 0 | 0 | 0 | 0 | eclipse,python-2.7 | 12,868,194 | 2 | true | 1 | 0 | Have you installed java runtime? If not, you need to install it first. If you have it already, you might need to adjust your path. | 1 | 0 | 0 | I installed Python 2.7 recently and with it Django--as part of the installation I had to add a PATH environment variable with the path to my Python installation.
After I did that, when I launch Eclipse, I get an error saying "javaw.exe" was not found. I need both Python and Eclipse on my machine, is there something I ... | Eclipse error: "javaw.exe not found" | 1.2 | 0 | 0 | 556 |
12,869,051 | 2012-10-13T01:10:00.000 | 1 | 0 | 0 | 0 | python,html,rss,widget,feedparser | 12,869,309 | 2 | true | 1 | 0 | One of several options: i'm thinking this might be quickest/easiest...
Upload the python script to the server. Have it create/update a publicly readable file under the webroot. Write some javascript to load that page into your html page.
If you want to get fancy schedule the script to run periodically via cron. | 2 | 0 | 0 | This seems like a very simple question, so I will remove if it's a repeat. I just can't seem to find the answer.
I'm using the feedparser module to parse an RSS feed. I want to post the output to a widget on a site. I don't want the python script to write the whole page. I just want to be able to get the output to the ... | Place Python Output in HTML Widget | 1.2 | 0 | 0 | 221 |
12,869,051 | 2012-10-13T01:10:00.000 | 1 | 0 | 0 | 0 | python,html,rss,widget,feedparser | 12,869,418 | 2 | false | 1 | 0 | I'll paste my comment into the answer here as well.
There are a lot of ways to go about it, but I'll focus on the design decision question first.
To make things simple, create two pages. First page for displaying the generated info without the generated info, just the styling and all other icing on the cake. Include a... | 2 | 0 | 0 | This seems like a very simple question, so I will remove if it's a repeat. I just can't seem to find the answer.
I'm using the feedparser module to parse an RSS feed. I want to post the output to a widget on a site. I don't want the python script to write the whole page. I just want to be able to get the output to the ... | Place Python Output in HTML Widget | 0.099668 | 0 | 0 | 221 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.