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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,612,037 | 2012-03-08T02:16:00.000 | 4 | 0 | 0 | 0 | python,types | 9,612,066 | 2 | true | 0 | 0 | The return type is a bytestring. The length of the string is the size in bytes of the data. | 2 | 1 | 0 | I'm reading data from local and from remote (urllib2) files in a Python script.
What is the return datatype?
How can I get the size of this data? ("real" size, not the size of representation in Python, in case that differs). | python: get size of buffer | 1.2 | 0 | 0 | 12,777 |
9,612,484 | 2012-03-08T03:26:00.000 | 14 | 0 | 1 | 0 | python,multithreading,locking | 9,613,674 | 1 | true | 0 | 0 | Assigning an object value to a global variable is an atomic operation in Python. Other threads cannot read a variable incorrectly by reading it while it's being assigned. The GIL guarantees this in the C implementation of Python, but other implementations can and do make that same guarantee in different ways.
If the gl... | 1 | 4 | 0 | Let us suppose I have 2 threads and a single global variable in a python code with the threading module.
In this code, only thread-1 modifies the global variable's value, whereas, thread-2 only reads the value of the global variable and perform its task depending on that value.
In this situation, do I need to protect t... | locking global variables under the Threading module of python | 1.2 | 0 | 0 | 6,645 |
9,613,759 | 2012-03-08T06:30:00.000 | 1 | 0 | 0 | 0 | python,django,unit-testing,code-coverage | 9,618,165 | 3 | false | 1 | 0 | Templates do not store any kind of line number information like python source code does. The best you could do is monkey patch the NodeList object to record how many times each node has been evaluated, and then re-render the templates in a special mode that will show which nodes are evaluated.
EDIT: I have been correct... | 1 | 24 | 0 | Is there any way to produce a report containing the code coverage in my django test suite for my site's templates? I already have coverage for python, but coverage for templates to identify dead or untested template code would be awesome.
To clarify: I want to find lines in my templates that are never executed or emitt... | Django Template Test Coverage | 0.066568 | 0 | 0 | 1,443 |
9,615,514 | 2012-03-08T09:41:00.000 | 0 | 0 | 0 | 0 | javascript,jquery,python,google-app-engine,google-cloud-datastore | 9,615,608 | 3 | false | 1 | 0 | The two scenarios you have explained are behaviours built into your browser. Most browsers will try to resubmit form data if you press F5 on a page where data has been submitted. This is to try to avoid data being lost by the average user.
It is as though you were to enter the site, complete the form and click Submit a... | 3 | 1 | 0 | I have a form on my page with many fields. I save field values in the datastore once user input a value (without waiting for form submission). Some score is calculated based on field values and displayed to the user. I also generate user's client id and store that in user's cookies for one hour.
I am not sure what shou... | How to properly handle page refresh? | 0 | 0 | 0 | 279 |
9,615,514 | 2012-03-08T09:41:00.000 | 0 | 0 | 0 | 0 | javascript,jquery,python,google-app-engine,google-cloud-datastore | 9,615,888 | 3 | false | 1 | 0 | Create a SESSION ID when the user enters the Registration page and store it in the database. I think session id will change only when user close the browser.
If user refresh the page retrive the values from the database with the SESSION ID.
When user click submit button and successfully query the values to database. De... | 3 | 1 | 0 | I have a form on my page with many fields. I save field values in the datastore once user input a value (without waiting for form submission). Some score is calculated based on field values and displayed to the user. I also generate user's client id and store that in user's cookies for one hour.
I am not sure what shou... | How to properly handle page refresh? | 0 | 0 | 0 | 279 |
9,615,514 | 2012-03-08T09:41:00.000 | 0 | 0 | 0 | 0 | javascript,jquery,python,google-app-engine,google-cloud-datastore | 9,616,023 | 3 | false | 1 | 0 | The best way, when you load the page, you should check it if there was any content for each form field already saved in db otherwise try some client side form field cache technique. | 3 | 1 | 0 | I have a form on my page with many fields. I save field values in the datastore once user input a value (without waiting for form submission). Some score is calculated based on field values and displayed to the user. I also generate user's client id and store that in user's cookies for one hour.
I am not sure what shou... | How to properly handle page refresh? | 0 | 0 | 0 | 279 |
9,617,049 | 2012-03-08T11:37:00.000 | 3 | 0 | 0 | 0 | python,http,chat,tornado,long-polling | 9,618,212 | 1 | true | 0 | 0 | You have to adjust long-poll timeout to practical network environment, for example some adsl modems silently drop connections after, say, 10 minutes of inactivity. Some laptops might move to another wireless network or go to sleep, etc.
IMO you shouldn't have more than 5 minutes for practical public use case on the int... | 1 | 3 | 0 | I'm creating a web chat service for my company product which is a local social network serving a lot of concurrent connections from online users. Long-polling is used together with Tornado over Python. However, when there's a lot of inactive long-polling connections (receiving no incoming messages), I should close some... | How long should I let a long-polling connection stay? | 1.2 | 0 | 1 | 1,115 |
9,618,641 | 2012-03-08T13:49:00.000 | 0 | 1 | 0 | 1 | python,file,rsync,unison | 9,619,361 | 3 | false | 0 | 0 | I think rsync is the solution. If you are concerned about data integrity, look at the explanation of the "--checksum" parameter in the man page.
Other arguments that might come in handy are "--delete" and "--archive". Make sure the exit code of the command is checked properly. | 1 | 0 | 0 | I have data across several computers stored in folders. Many of the folders contain 40-100 G of files of size from 500 K to 125 MB. There are some 4 TB of files which I need to archive, and build a unfied meta data system depending on meta data stored in each computer.
All systems run Linux, and we want to use Python. ... | What is the best utility/library/strategy with Python to copy files across multiple computers? | 0 | 0 | 0 | 836 |
9,618,773 | 2012-03-08T13:59:00.000 | 0 | 0 | 0 | 0 | python,database,queue | 9,618,894 | 3 | false | 1 | 0 | You could create a function that each process must call in order to talk to the DB. You could re-write the scripts so that they must call that function rather than talk directly to the DB. Within that function, you could have a scope-based lock so that only one process would be talking to the DB at a time. | 2 | 0 | 0 | I got a lot scripts running: scrappers, checkers, cleaners, etc. They have some things in common:
they are forever running;
they have no time constrain to finish their job;
they all access the same MYSQL DB, writting and reading.
Accumulating them, it's starting to slow down the website, which runs on the same system... | How to ensure several Python processes access the data base one by one? | 0 | 0 | 0 | 157 |
9,618,773 | 2012-03-08T13:59:00.000 | 1 | 0 | 0 | 0 | python,database,queue | 9,619,460 | 3 | false | 1 | 0 | You say that your dataset is <1GB, the problem is CPU bound.
Now start analyzing what is eating CPU cycles:
Which queries are really slow and executed often. MySQL can log those queries.
What about the slow queries? Can they be accelerated by using an index?
Are there unused indices? Drop them!
Nothing helps? Can you ... | 2 | 0 | 0 | I got a lot scripts running: scrappers, checkers, cleaners, etc. They have some things in common:
they are forever running;
they have no time constrain to finish their job;
they all access the same MYSQL DB, writting and reading.
Accumulating them, it's starting to slow down the website, which runs on the same system... | How to ensure several Python processes access the data base one by one? | 0.066568 | 0 | 0 | 157 |
9,618,776 | 2012-03-08T13:59:00.000 | 3 | 0 | 0 | 0 | javascript,python,html | 9,618,891 | 3 | false | 1 | 0 | The only way I know of to do this from your server is to run the page in an actual browser engine that will parse the HTML, build the normal DOM environment, run the javascript in the page and then reach into that DOM engine and get the innerHTML from the body tag.
This could be done by firing up Chrome with the approp... | 2 | 3 | 0 | I want to get the HTML content of a web page but most of the content is generated by javascript.
Is it posible to get this generated HTML (with python if posible)? | How can I get the HTML generated with javascript? | 0.197375 | 0 | 1 | 2,524 |
9,618,776 | 2012-03-08T13:59:00.000 | 0 | 0 | 0 | 0 | javascript,python,html | 9,618,929 | 3 | false | 1 | 0 | If most of the content is generated by Javascript then the Javascript may be doing ajax calls to retrieve the content. You may be able to call those server side scripts from your Python app.
Do check that it doesn't violate the website's terms though and get permission. | 2 | 3 | 0 | I want to get the HTML content of a web page but most of the content is generated by javascript.
Is it posible to get this generated HTML (with python if posible)? | How can I get the HTML generated with javascript? | 0 | 0 | 1 | 2,524 |
9,619,207 | 2012-03-08T14:28:00.000 | 5 | 1 | 1 | 0 | python,c,embedded | 9,619,591 | 2 | true | 0 | 0 | It seems that you can't access the low level registers. I recommend just writing a short C extension code to allow Python to access the registers you need. | 1 | 5 | 0 | I have an embedded device with Python installed on in. Is it possible to explicitly access registers in pure Python, or should I write C extensions for my Python code? | Accessing low-level registers of an embedded device using Python | 1.2 | 0 | 0 | 548 |
9,621,385 | 2012-03-08T16:44:00.000 | 0 | 0 | 0 | 0 | python,django,pinax | 10,642,779 | 1 | false | 1 | 0 | I don't think there's any alternative, luckily it's active again lately. | 1 | 7 | 0 | I am planning on transferring my django site to pinax so I dont have to deal with the user registration and what not. Before I make this move, I was wondering what the alternative options are so I dont have to make this transfer twice.
So what alternatives to pinax exists? and which one is your favorite? | What alternatives to pinax exists? | 0 | 0 | 0 | 1,366 |
9,624,584 | 2012-03-08T20:38:00.000 | 0 | 1 | 1 | 0 | python,linux,json | 9,624,622 | 2 | false | 0 | 0 | python needs the python module for json, which is not the same as the php module for json.
There are some to pick from, e.g. you can use python-cjson, so make sure that this module is installed.
You can ask rpm about which packages are installed like this: rpm -qa | grep json | 1 | 2 | 0 | I am new to this whole python deal, and admit that I am half lost - don't know whether I am coming or going. So, here's the question and I hope someone can assist me.
I am running a RedHat system and by default, it has python 2.4 installed. I have a python script that gives me an error when attempting to import json.
... | Python - import json returning module not found | 0 | 0 | 0 | 7,168 |
9,625,124 | 2012-03-08T21:22:00.000 | 2 | 0 | 1 | 0 | visual-studio-2010,ironpython,visual-studio-debugging | 9,894,459 | 1 | true | 0 | 0 | Ok. Problem solved. I had a bunch of Python interpreters installed and the default interpreter was Python 3.2. I switched the default interpreter to IronPython 2.7 and everything is peachy now. The settings is in Tools|Options|Python Tools|Interpreter Options|Default Interpreter | 1 | 1 | 0 | I use VS 2010 to debug a single IronPython module. Everything works great. I can set breakpoints, watch local variables, etc. The only annoyance (which is serious) is that yellow arrow that marks the current step in the debugger is not synchronized with the real line being edited. Did anyone run into this issue?
I crea... | Debugging IronPython in Visual Studio 2010 - Source lines not synchronized | 1.2 | 0 | 0 | 784 |
9,627,652 | 2012-03-09T01:19:00.000 | -2 | 0 | 1 | 0 | python,python-imaging-library,tiff | 9,627,696 | 6 | false | 0 | 0 | You could convert it to PDF and use pyPDF to split the pages | 1 | 9 | 0 | What's the best way to split a multi-page TIFF with python? PIL doesn't seem to have support for multi-page images, and I haven't found an exact port for libtiff for python. Would PyLibTiff be the way to go? Can somebody provide a simple example of how I could parse multiple pages within a TIFF? | Split multi-page tiff with python | -0.066568 | 0 | 0 | 15,794 |
9,628,257 | 2012-03-09T02:44:00.000 | 0 | 0 | 0 | 0 | wxpython,arcgis,arcpy | 19,055,227 | 2 | false | 0 | 1 | ArcGIS has it's own rendering engine. You would need to create an ArcPy tool or script or add-in for something like ArcGIS Explorer or the paid version ArcMap. You could also look into making an ArcPy tool, script, or add-in for their ArcGIS Runtime. | 1 | 0 | 0 | I am working on an Desktop application built with wx Python. I would like the application to visualize maps(shapefiles) like a GIS software and provide interactions with the map. I was looking through arcpy and arcgisscripting but I am not sure if it help me render the shapefile on the Panel. Please do let me know if i... | wxPython and ARCGIS | 0 | 0 | 0 | 1,086 |
9,628,303 | 2012-03-09T02:52:00.000 | 0 | 1 | 0 | 0 | python,naming-conventions,variable-names | 9,628,338 | 3 | false | 0 | 0 | Would CompletedAction, FinishedAction, ClosedAction, or PastAction be of any use? | 2 | 1 | 0 | In my game, there is are ActionFactory (makes AbstractActions), AbstractAction (actions that could exist), PotentialAction (actions that a being could do, which are assosietted with a specific being) classes. I need a name for a class that reperessents an actual, choosen action which was done by a specific being, has s... | What is a good name for chosen actions, possibly in the past? | 0 | 0 | 0 | 84 |
9,628,303 | 2012-03-09T02:52:00.000 | 0 | 1 | 0 | 0 | python,naming-conventions,variable-names | 9,710,839 | 3 | true | 0 | 0 | I went with RealAction, mainly because of API consistency - all actual, specific real-world classes are prefixed with Real (and have an associated Potential class) | 2 | 1 | 0 | In my game, there is are ActionFactory (makes AbstractActions), AbstractAction (actions that could exist), PotentialAction (actions that a being could do, which are assosietted with a specific being) classes. I need a name for a class that reperessents an actual, choosen action which was done by a specific being, has s... | What is a good name for chosen actions, possibly in the past? | 1.2 | 0 | 0 | 84 |
9,628,893 | 2012-03-09T04:21:00.000 | 2 | 1 | 1 | 0 | php,python | 9,629,033 | 2 | true | 0 | 0 | To expand on Brad's answer, there's several options, each with pros & cons...
Pipes (ie: STDIN/STDOUT): proc_open()
Shared memory: shmop_open()
AF_UNIX family sockets: socket_bind()
You'll probably want to use the first option but read up on the others before making a commitment. | 1 | 0 | 0 | I have a custom codechecker in python, Also there is a bigger project running in PHP, which stores users code in MySQL database.
I am new to python, so I'm not sure how I can pass the code from PHP to Python.
Do I have to store the file to the filesystem to pass it to Python? (In that case too many files might be creat... | Passing code to python from PHP | 1.2 | 0 | 0 | 109 |
9,629,040 | 2012-03-09T04:41:00.000 | 0 | 0 | 0 | 0 | python | 9,629,110 | 2 | false | 0 | 0 | First off, without knowing how many times you are checking the fle with the moves, it is difficult to know why the file-share is getting DoS-ed. Most networks and network shares these days can handle that level of traffic - they are all gigabit Ethernet, so unless you are transferring large chunks of data each time, yo... | 1 | 0 | 0 | So I have tried to find a answer but must not be searching correctly or what I'm trying to do is the wrong way to go about it.
So I have a simple python script that creates a chess board and pieces in a command line environment. You can in put commands to move the pieces. So one of my co workers thought it would be co... | Python over a network share | 0 | 0 | 1 | 347 |
9,630,668 | 2012-03-09T07:57:00.000 | 2 | 0 | 1 | 0 | python,datetime | 9,630,768 | 2 | false | 0 | 0 | It sounds like you have current time X (seconds since the epoch), and you have a reference time Y. You want the number of seconds between them.
Use mktime to get seconds from the epoch to your reference point, and then just subtract X from Y, or Y from X (depending on which order you want). | 1 | 0 | 0 | time.time() gives current time in seconds from a given reference. Is there a mean to convert a date to a number of seconds since given reference?
I thought of calendar.timegm(), but I am not sure how to format the argument.
thanks! | Convert date to second from a reference - Python | 0.197375 | 0 | 0 | 146 |
9,634,473 | 2012-03-09T13:00:00.000 | 1 | 1 | 0 | 1 | python,environment-variables | 9,634,524 | 2 | true | 0 | 0 | A subshell can change variables it inherited from the parent, but the changes made by the child don't affect the parent.
When a new subshell is started, in which the variable exported from the parent is visible. The variable is unsetted by del os.environ['var'], but the value for this variable in the parent stays the s... | 1 | 2 | 0 | I am running my Test Harness which is written in Python. Before running a test through this test harness, I am exporting some environment variables through a shell script which calls the test harness after exporting the variables. When the harness comes in picture, it checks if the variables are in the environment and ... | Environment variables getting preserved in Python script even after exiting | 1.2 | 0 | 0 | 2,224 |
9,634,800 | 2012-03-09T13:26:00.000 | 1 | 0 | 0 | 1 | python,django,linux,celery | 9,635,351 | 2 | false | 1 | 0 | If you make changes in tasks.py for celery, then you will have to restart it once to apply changes by running command ./manage.py celeryd start or python manage.py celeryd start --settings=settings for using settings.py as configuration for celery. It will not be affected by the changes in your projects until you make ... | 1 | 5 | 0 | I'm using several django instances, each in a virtualenv, on the same
server.
How can I start the celery server and make sure it is always running and
updated? I.e. after a server restart or code update?
The /etc/init.d script and the config file assume a single Django
installation. Do I have to use the ./manage.p... | celery with multiple django instances | 0.099668 | 0 | 0 | 1,580 |
9,636,029 | 2012-03-09T14:50:00.000 | 1 | 0 | 1 | 0 | python,encoding,utf-8 | 14,041,166 | 2 | false | 0 | 0 | If you have an ascii encoded file,f:
1)f1=unicode(f)
2)f2=f1.encode('utf-8')
I this way, you get rid of errors like:"UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in position 5: ordinal not in range(128)" | 1 | 0 | 0 | I know about codecs library, but I don't want to write string to file.
Is there a way to hold resulting string in variable? | how to convert string from known encoding to utf-8 on the fly in python? | 0.099668 | 0 | 0 | 270 |
9,636,294 | 2012-03-09T15:06:00.000 | 0 | 0 | 0 | 0 | javascript,python,node.js,compiler-construction | 9,636,911 | 2 | false | 1 | 0 | To accomplish the sandbox, it would be fairly easy to do this by simply running your code inside of a closure that reassigns all of the worrisome calls to NaN
for instance, if the code executes inside a closure where eval=NaN | 1 | 4 | 0 | I'm a newer and if the question is so easy I apologize for that.
Assume I want to dev a classical online judge system, obviously the core part is
get users' code to a file
compile it on server
run it on server (with some sandbox things to prevent damage)
the program exit itself, then check the answer.
or get the sign... | Is that possible to develop a ACM ONLINE JUDGE system using NODE.JS(or PYTHON)? | 0 | 0 | 1 | 1,228 |
9,638,446 | 2012-03-09T17:30:00.000 | -1 | 0 | 1 | 0 | python,partial-classes | 9,638,616 | 9 | false | 0 | 0 | First I'd like to say that something this complicated it probably not a good idea just to make finding your place in the class easier - it would be best to add comments, highlight sections etc. However, I see two ways you could do this:
Write the class in several files, then read them in as text, concatenate them and... | 4 | 44 | 0 | Using "new" style classes (I'm in python 3.2) is there a way to split a class over multiple files? I've got a large class (which really should be a single class from an object-oriented design perspective, considering coupling, etc, but it'd be nice to split over a few files just for ease of editing the class. | Is there any Python equivalent to partial classes? | -0.022219 | 0 | 0 | 25,118 |
9,638,446 | 2012-03-09T17:30:00.000 | 9 | 0 | 1 | 0 | python,partial-classes | 9,638,593 | 9 | false | 0 | 0 | Class definitions containing hundreds of lines do occur "in the wild" (I have seen some in popular open-source Python-based frameworks), but I believe that if you ponder what the methods are doing, it will be possible to reduce the length of most classes to a manageable point. Some examples:
Look for places where mos... | 4 | 44 | 0 | Using "new" style classes (I'm in python 3.2) is there a way to split a class over multiple files? I've got a large class (which really should be a single class from an object-oriented design perspective, considering coupling, etc, but it'd be nice to split over a few files just for ease of editing the class. | Is there any Python equivalent to partial classes? | 1 | 0 | 0 | 25,118 |
9,638,446 | 2012-03-09T17:30:00.000 | 0 | 0 | 1 | 0 | python,partial-classes | 11,873,383 | 9 | false | 0 | 0 | I met the same situation - I want to slipt my class to 2 files.
the reason is that - I want part 1 for GUI layout, only layout
and another file keeps all function.
like c#'s Partial class. one for XAML and another one for functions. | 4 | 44 | 0 | Using "new" style classes (I'm in python 3.2) is there a way to split a class over multiple files? I've got a large class (which really should be a single class from an object-oriented design perspective, considering coupling, etc, but it'd be nice to split over a few files just for ease of editing the class. | Is there any Python equivalent to partial classes? | 0 | 0 | 0 | 25,118 |
9,638,446 | 2012-03-09T17:30:00.000 | 0 | 0 | 1 | 0 | python,partial-classes | 9,639,189 | 9 | false | 0 | 0 | First off, I don't see how splitting the class into multiple files makes editing any easier. A decent IDE should be able to find any method easily whether in one file or multiple; if you're not using a decent IDE, splitting the class means the maintainer has to guess which file a given method is in, which sounds harder... | 4 | 44 | 0 | Using "new" style classes (I'm in python 3.2) is there a way to split a class over multiple files? I've got a large class (which really should be a single class from an object-oriented design perspective, considering coupling, etc, but it'd be nice to split over a few files just for ease of editing the class. | Is there any Python equivalent to partial classes? | 0 | 0 | 0 | 25,118 |
9,639,466 | 2012-03-09T18:56:00.000 | 6 | 0 | 1 | 0 | python,multithreading,gevent,eventlet,green-threads | 10,991,681 | 2 | true | 0 | 0 | With gevent < 1.0 it is most likely a bad idea, as libevent isn't thread safe. You might be okay if you make sure that the OS threads never interact with libevent… But that could be tricky, and bugs cause by libevent's lack of thread safety don't sound like any fun to debug.
However, gevent >= 1.0 uses libev, which is ... | 1 | 4 | 0 | Firstly, is it safe to mix green threads such as eventlet or gevent with python native threads from the standard library, i.e. Lib/threading.py in the same python process?
Secondly, if it is safe, is it a bad idea? | Is it safe to mix green threads and native threads in a single python process? | 1.2 | 0 | 0 | 2,151 |
9,640,056 | 2012-03-09T19:47:00.000 | 0 | 0 | 1 | 0 | python,python-2.x,isinstance | 9,640,281 | 2 | false | 0 | 0 | In 2.x, user-defined classes (and a few stdlib classes) do not derive from object by default. This is fixed in 3.x. | 1 | 6 | 0 | It is my understanding that since type/class unification every value is of a type that derives from object. However I can't find absolute confirmation of this in the docs. While it stands to reason that isinstance(anything, object) should always be True, I could also imagine there being legacy edge cases in the Python ... | Is there any value in Python for which isinstance(value, object) is not True? | 0 | 0 | 0 | 476 |
9,641,916 | 2012-03-09T22:36:00.000 | 0 | 0 | 0 | 0 | python,numpy,pandas | 11,955,915 | 4 | false | 0 | 0 | @user248237:
I second Keith's suggestion that its probably a 32/64 bit compatibility issue. I ran into the same problem just this week while trying to install a different module. Check the versions of each of your modules and make everything matches. In general, I would stick to the 32 bit versions -- not all modules... | 3 | 7 | 1 | I'm trying to get my code (running in eclipse) to import pandas.
I get the following error: "ImportError: numpy.core.multiarray failed to import"when I try to import pandas. I'm using python2.7, pandas 0.7.1, and numpy 1.5.1 | Python Pandas: can't find numpy.core.multiarray when importing pandas | 0 | 0 | 0 | 5,833 |
9,641,916 | 2012-03-09T22:36:00.000 | 1 | 0 | 0 | 0 | python,numpy,pandas | 12,003,130 | 4 | false | 0 | 0 | Just to make sure:
Did you install pandas from the sources ? Make sure it's using the version of NumPy you want.
Did you upgrade NumPy after installing pandas? Make sure to recompile pandas, as there can be some changes in the ABI (but w/ that version of NumPy, I doubt it's the case)
Are you calling pandas and/or Num... | 3 | 7 | 1 | I'm trying to get my code (running in eclipse) to import pandas.
I get the following error: "ImportError: numpy.core.multiarray failed to import"when I try to import pandas. I'm using python2.7, pandas 0.7.1, and numpy 1.5.1 | Python Pandas: can't find numpy.core.multiarray when importing pandas | 0.049958 | 0 | 0 | 5,833 |
9,641,916 | 2012-03-09T22:36:00.000 | 1 | 0 | 0 | 0 | python,numpy,pandas | 12,007,981 | 4 | false | 0 | 0 | Try to update to numpy version 1.6.1. Helped for me! | 3 | 7 | 1 | I'm trying to get my code (running in eclipse) to import pandas.
I get the following error: "ImportError: numpy.core.multiarray failed to import"when I try to import pandas. I'm using python2.7, pandas 0.7.1, and numpy 1.5.1 | Python Pandas: can't find numpy.core.multiarray when importing pandas | 0.049958 | 0 | 0 | 5,833 |
9,641,974 | 2012-03-09T22:42:00.000 | 0 | 1 | 0 | 0 | java,python,parsing,logging | 9,642,425 | 2 | true | 1 | 0 | I recently started writing python scripts, but recently i wrote a java gc log parser to print the timestamp when a gc happened and counts etc, and i found Python real easy in writing it. What kind of fields are you interested while parsing the syslogs? I think if you know what you are looking for in the logs(patterns e... | 2 | 0 | 0 | I know perl and python is tested solution for this kind of log parsing and data mining -
Anybody have experience dealing with syslog parsing with Java ?
I have to create a Java demon anyway to load the parsed output to DB ..
So I was thinking why not going all the way -
python might be useful when I will be runnin... | Log parser solutions python/perl vs Java | 1.2 | 0 | 0 | 838 |
9,641,974 | 2012-03-09T22:42:00.000 | 1 | 1 | 0 | 0 | java,python,parsing,logging | 11,693,757 | 2 | false | 1 | 0 | I translated some Java GC log parser/analyzer from Perl to Java. In Java the code looked like more lines and the code obviously more verbose but the execution was at least 5 times faster. | 2 | 0 | 0 | I know perl and python is tested solution for this kind of log parsing and data mining -
Anybody have experience dealing with syslog parsing with Java ?
I have to create a Java demon anyway to load the parsed output to DB ..
So I was thinking why not going all the way -
python might be useful when I will be runnin... | Log parser solutions python/perl vs Java | 0.099668 | 0 | 0 | 838 |
9,642,259 | 2012-03-09T23:18:00.000 | 0 | 1 | 0 | 0 | php,javascript,python,gearman | 9,642,671 | 2 | false | 1 | 0 | Put your Python script in your CGI directory and use the cgi and json modules in your script to read AJAX from post/get params. Of course you can do a system call from PHP to run a Python script, but I can't think of a good reason why you would. | 1 | 0 | 0 | I want to take results from a web page, sent from dom as json through ajax, then send this data to a python script, run it, then return the new results back as json. I was told a php script running gearman would be a good bet, but I'm still not sure how that would work. | How can I run a python script through a webserver and return results to javascript? | 0 | 0 | 1 | 703 |
9,643,548 | 2012-03-10T02:53:00.000 | 1 | 0 | 0 | 0 | python | 9,643,693 | 1 | true | 0 | 0 | You should use HTTPS on your server, so that the data is encrypted as it leaves the server.
Ultimately, though, the browser will decrypt the data. If at anytime you don't even want the target end-user to see the data, then you have to follow this rule: don't send it. | 1 | 0 | 0 | I am working on a Python script that will extract data from Database and prepare data for a front graph amCharts tool. I am returning data via an AJAX call made from the front end side in JSON / XML format.
Is it safe to return data in JSON / XML format to browser - in case if my tool goes to live wouldn’t the JSON / X... | JSON XML Graph Data | 1.2 | 0 | 1 | 347 |
9,643,975 | 2012-03-10T04:39:00.000 | 1 | 0 | 0 | 0 | python,django,security,heroku | 9,644,524 | 1 | true | 1 | 0 | I don't see any reason why it wouldn't be.
After all, when you login to the admin panel, the links to the css and js are always public. Meaning at that point they are just like any other static resource and they don't require to be logged in order to view them. So you can store them whenever you want and as long as the... | 1 | 0 | 0 | I have a Django app hosted in the cloud (Heroku if that makes a difference though I can't see how) and am looking to move all static content to AWS (images, CSS etc).
Is it secure to have Django's Admin media (ie the media/ css/ and js/ folders) hosted on a publicly accessible site? | Is it secure to host Django Admin media on a public folder on AWS | 1.2 | 0 | 0 | 176 |
9,644,110 | 2012-03-10T05:13:00.000 | 13 | 1 | 1 | 0 | python,file-io,text-parsing | 31,152,300 | 4 | false | 0 | 0 | The difference lies in how the end-of-line (EOL) is handled. Different operating systems use different characters to mark EOL - \n in Unix, \r in Mac versions prior to OS X, \r\n in Windows. When a file is opened in text mode, when the file is read, Python replaces the OS specific end-of-line character read from the fi... | 1 | 67 | 0 | What makes parsing a text file in 'r' mode more convenient than parsing it in 'rb' mode?
Especially when the text file in question may contain non-ASCII characters. | Difference between parsing a text file in r and rb mode | 1 | 0 | 0 | 84,866 |
9,644,121 | 2012-03-10T05:15:00.000 | 1 | 0 | 0 | 0 | python,django | 9,645,186 | 1 | false | 1 | 0 | Which version of Django do you use? Before Django 1.4, the STATIC_URL and ADMIN_MEDIA_PREFIX are indeed different parts. In Django 1.4, ADMIN_MEDIA_PREFIX is deprecated and STATIC_URL is used solely.
The way you're using to serve corresponding files is important also. You could check the URLs of media files in the adm... | 1 | 1 | 0 | Trying to gain some high level clarity on how Django serves (admin) static files.
When altering the STATIC_URL setting in Django's settings.py to a new location (I'm serving images from a 3rd party server) it seems to disrupt ADMIN_MEDIA_PREFIX and thus stop the Admin media (css, images, js) from being served.
Why does... | Why does altering STATIC_URL in Django disrupt ADMIN_MEDIA_PREFIX | 0.197375 | 0 | 0 | 565 |
9,644,338 | 2012-03-10T06:05:00.000 | 0 | 1 | 1 | 0 | python,unicode,encoding | 9,644,413 | 6 | false | 0 | 0 | Help on class unicode in module builtin:
class unicode(basestring)
| unicode(string [, encoding[, errors]]) -> object
|
| Create a new Unicode object from the given encoded string.
| encoding defaults to the current default string encoding.
| errors can be 'strict', 'replace' or 'ignore' and defaults to 'stric... | 1 | 1 | 0 | I want to use "Importação de petróleo" in my program.
How can I do that because all encodings give me errors as cannot encode. | How to encode 'Importação de petróleo' string in python? | 0 | 0 | 0 | 518 |
9,644,735 | 2012-03-10T07:29:00.000 | 1 | 0 | 0 | 0 | python,matrix,numpy,scipy,interpolation | 11,876,131 | 1 | false | 0 | 0 | Very late, but...
I have a problem similar to yours, and am getting the segmentation fault with bisplines, and also memory error with rbf (in which the "thin_plate" function works great for me.
Since my data is unstructured but is created in a structured manner, I use downsampling to half or one third of the density of... | 1 | 3 | 1 | I have a numpy masked matrix. And wanted to do interpolation in the masked regions.
I tried the RectBivariateSpline but it didn't recognize the masked regions as masked and used those points also to interpolate. I also tried the bisplrep after creating the X,Y,Z 1d vectors. They were each of length 45900. It took a lot... | Interpolation of large 2d masked array | 0.197375 | 0 | 0 | 1,646 |
9,644,784 | 2012-03-10T07:37:00.000 | 3 | 0 | 1 | 0 | python,string-parsing | 9,644,866 | 4 | false | 0 | 0 | Split on ") " and add a ) back to each element except the last. | 1 | 6 | 0 | I am parsing a file that has lines such as
type("book") title("golden apples") pages(10-35 70 200-234) comments("good read")
And I want to split this into separate fields.
In my example, there are four fields: type, title, pages, and comments.
The desired result after splitting is
['type("book")', 'title("golden app... | Splitting on spaces, except between certain characters | 0.148885 | 0 | 0 | 5,904 |
9,645,004 | 2012-03-10T08:21:00.000 | 18 | 0 | 1 | 0 | python,gcc,cygwin | 9,646,031 | 2 | false | 0 | 0 | I had this problem too, and this is a bug in the Python code. The only way I found to fix it was to edit the file C:\Python27\Lib\distutils\cygwinccompiler.py.
In this file you must remove every occurence of -mno-cygwin.
The same goes for GCC installed through MinGW. | 1 | 7 | 0 | i'm trying to learn a lot of python on windows and that includes installing several packages, however everytime i invoke python setup.py install i have a problem with -mno -cygwin for gcc.
i've have read already a lot of articles and it seems they want that these individual packages to wait for the fix on their own b... | Python: -mno -cygwin | 1 | 0 | 0 | 5,264 |
9,645,388 | 2012-03-10T09:33:00.000 | 0 | 0 | 1 | 0 | python,reflection,twisted | 9,645,892 | 7 | false | 0 | 0 | Better yet subprocess the plugins, then hypervise the subprocess, when the files change reload the plugins process.
Edit: cleaned up. | 1 | 4 | 0 | I've written an IRC bot using Twisted and now I've gotten to the point where I want to be able to dynamically reload functionality.
In my main program, I do from bots.google import GoogleBot and I've looked at how to use reload to reload modules, but I still can't figure out how to do dynamic re-importing of classes.
S... | Dynamically reload a class definition in Python | 0 | 0 | 1 | 6,092 |
9,647,381 | 2012-03-10T14:53:00.000 | 3 | 0 | 0 | 0 | python,post,cookies,get,urllib2 | 9,647,462 | 1 | false | 1 | 0 | This is a part of Web-Scraping :
Web-scraping is a standard task that can serve various needs.
Scraping data out of secure-website means https
Handling https is not a problem with mechanize and BeautifulSoup
Although urllib2 with HTTPCookieJar also works fine
If managing the cookies is the problem, then I would recomm... | 1 | 2 | 0 | Id like to know if there is a way to get information from my banking website with Python, Id like to retrieve my card history and display it, and possibly save it into a text document each month.
I have found the urls ext to login and get the information from the website, which works from a browser, but I have been usi... | Python get data from secured website | 0.53705 | 0 | 1 | 2,748 |
9,649,879 | 2012-03-10T20:24:00.000 | 0 | 0 | 0 | 1 | python,twisted,twistd | 9,650,823 | 2 | false | 0 | 1 | To use 'twistd -y', your .tac file must create a suitable object (e.g., by calling service.Application()) and store it in a variable named 'application'. twistd loads your .tac file and scans the global variables for one of this name.
Please read the 'Using Application' HOWTO for details. | 1 | 0 | 0 | I am trying to use twisted but when i try to run some of the example code provided with the twisted package, it seems to always crash when i use "twistd" instead of "python"
for example, using the example code given with twisted,
if i run to command : twisted -ny echoserv.py
Unhandled Error
Traceback (most recent call... | stack dump in twisted app.py 'application' error when using twistd but works with python? | 0 | 0 | 0 | 528 |
9,650,670 | 2012-03-10T22:18:00.000 | 1 | 0 | 0 | 0 | python,image-processing,computer-vision | 9,651,522 | 2 | false | 0 | 0 | I do not know if there is a library but you could segment these areas using a simple thresholding segmentation algorithm. Say, you want to find red spots. Extract the red channel from the image, select a threshold, and eliminate pixels that are below the threshold. The resulting pixels are your spots. To find a suitabl... | 1 | 1 | 1 | I have millions of images containing every day photos. I'm trying to find a way to pick out those in which some certain colours are present, say, red and orange, disregarding the shape or object. The size may matter - e.g., at least 50x50 px.
Is there an efficient and lightweight library for achieving this? I know ther... | Image spot detection in Python | 0.099668 | 0 | 0 | 2,147 |
9,651,852 | 2012-03-11T02:18:00.000 | 4 | 0 | 0 | 0 | python,plugins,syntax,color-scheme,sublimetext | 9,651,889 | 1 | true | 0 | 0 | Sublime Text uses the same format for syntax coloring themes as TextMate (.tmTheme format). | 1 | 1 | 0 | I've created a new syntax highlighting theme and am trying to make it available for as many editors as possible. My latest thing I'm tackling is a theme for Sublime Text 2. I have not too much knowledge of the theme sadly and need to make a quick theme for it ASAP. I've searched and google'd many times but still haven'... | How to make Sublime Text 2 themes? | 1.2 | 0 | 0 | 929 |
9,654,020 | 2012-03-11T10:04:00.000 | 5 | 1 | 0 | 0 | python,unit-testing,tdd | 9,654,684 | 2 | true | 0 | 0 | Regarding your conclusion first: both unit tests and system tests (integration tests) both have their use, and are in my opinion just as useful. During development I find it easier to start with unit tests, but for testing legacy code I find your approach where you start with the integration tests easier. I don't think... | 1 | 7 | 0 | I have been trying to get the hang of TDD and unit testing (in python, using nose) and there are a few basic concepts which I'm stuck on. I've read up a lot on the subject but nothing seems to address my issues - probably because they're so basic they're assumed to be understood.
The idea of TDD is that unit tests ar... | How to approach unittesting and TDD (using python + nose) | 1.2 | 0 | 0 | 1,322 |
9,654,527 | 2012-03-11T11:30:00.000 | 0 | 0 | 0 | 0 | python | 9,654,945 | 1 | false | 1 | 0 | I dont hear about of these libraries, but you can try SqlAlchemy and WTForms. | 1 | 0 | 0 | I'm looking for python-libraries which can make autogenerated panel for administer site (like django) using models (ORM) or descriptions of tables from database. | Generate admin panel automatically | 0 | 0 | 0 | 93 |
9,655,027 | 2012-03-11T12:43:00.000 | 2 | 0 | 1 | 0 | python | 9,655,049 | 3 | false | 0 | 0 | Every python object has a special member called __dict__ which is a dictionary containing all the instance's member.
self.__dict__.keys() lists their names
self.__dict__['foo'] gives you access to the value of the member foo
BTW, basically, writing something like self.foo = 1 is equivalent (at the basic level of things... | 1 | 0 | 0 | Disclaimer: I'm doing my first steps in python that's why the question may sound a little silly.
How to list all variables which are stored in self? | How to obtain all fields of an object? | 0.132549 | 0 | 0 | 1,402 |
9,656,064 | 2012-03-11T15:04:00.000 | 3 | 0 | 1 | 0 | python,tdd | 9,656,098 | 2 | false | 0 | 0 | You've pretty much got it. Database testing is done by starting with a clean, up-to-date schema and adding a small amount of known, fixed data into the database. You can then do operations on this controlled environment, knowing what results you expect to see.
Working with network objects is a bit more complex, but it ... | 1 | 2 | 0 | I wonder if TDD could help my programming. However, I cannot use it simply as most of my functions take large network objects (many nodes and links) and do operations on them. Or I even read SQL tables.
Most of them time it's not really the logic that breaks (i.e. not semantic bugs), but rather some functions calls aft... | TDD with large data in Python | 0.291313 | 0 | 1 | 420 |
9,657,333 | 2012-03-11T17:51:00.000 | 0 | 0 | 1 | 0 | python | 9,657,438 | 2 | false | 0 | 1 | You need PyQt or PySide to use Qt in your Python script.
To generate python script from ui file run pyuic -x form.ui | 1 | 0 | 0 | 1: i create main window in QtCreator.
how i use this form in my python code in eclipse.
2: can write python and build complete python application in QtCreator ? (How).
thanks. | How To Add .ui Files To Python | 0 | 0 | 0 | 238 |
9,658,846 | 2012-03-11T20:58:00.000 | 1 | 0 | 1 | 1 | python,eclipse,python-3.x,pydev | 9,658,901 | 1 | false | 0 | 0 | If I understand you correctly, you need to import the other class from the other file into your original file to be able to use the class.
For example, from otherfile import OtherClass
Otherwise, please add more info. | 1 | 0 | 0 | This is probably a very simple question. But it's driving me nuts and I can't find the solution. I setup Eclipse and PyDev in my Windows box and I've written a class to do something. Then I created another .py file to run a program that users that class, but the program cannot find the class.
It works well if I put al... | Not finding other files in the same workspace folder in Eclipse with PyDev | 0.197375 | 0 | 0 | 712 |
9,659,004 | 2012-03-11T21:21:00.000 | 1 | 0 | 0 | 1 | python,python-3.x,scons | 9,662,504 | 1 | true | 0 | 0 | You can use scons command-line parameter --no-exec would only print build commands but not execute them. | 1 | 0 | 0 | Is there a quick way to get the order that SCons will process your program's files?
I'd like to snag the ordered list of program file names and skip the compilation process.
thanks in advance! | getting compilation order from SCons | 1.2 | 0 | 0 | 74 |
9,661,063 | 2012-03-12T02:31:00.000 | 2 | 0 | 1 | 0 | python,pipe,pygame,path-finding | 9,667,720 | 1 | true | 0 | 1 | You're overthinking this. Either method is fine, but you probably don't want to use threads for CPU-bound operations. Use the multiprocessing module instead if you're shooting for concurrency.
But really, the pygame code should be negligible in terms of processing. Focus on making your pathfinding efficient (perhaps... | 1 | 0 | 0 | I'm writing a pathfinding visualizer in python and Pygame. I intend to write a visualizer that can simultaneously simulate multiple pathfinding algorithms. I have two possible approaches
I write a server part of the application, that will calculate path and will send it to client part, that will use pygame to draw gri... | Pathfinding Visualizer in python | 1.2 | 0 | 0 | 626 |
9,662,757 | 2012-03-12T06:44:00.000 | 3 | 0 | 1 | 0 | python,performance,serialization,deserialization | 9,662,794 | 4 | false | 0 | 0 | Time them and find out!
I'd expect cPickle to be the fastest but that's no guarantee. | 1 | 8 | 0 | I am calculating some very large numbers using Python, and I'd like to store previously calculated results in Berkeley DB.
The problem is that Berkeley DB has to use strings, and I have to store an integer tuple for the calculation results.
For example, I get (m, n) as my result, one way is to store this as "%d,%d" % (... | Python: performance comparison of using `pickle` or `marshal` and using `re` | 0.148885 | 0 | 0 | 8,125 |
9,663,321 | 2012-03-12T07:44:00.000 | 2 | 0 | 1 | 0 | java,python,jython | 9,663,378 | 3 | false | 1 | 0 | I know how to use python with java through jython, but backwards ... try to ask your question to jython community. | 3 | 3 | 0 | I am a Java developer. I would like to know what capabilities and/or positives I can add to a Java application, by including Python as a development language.
I am posting this here as I am not getting a good answer from google. I would request that you don't vote down, marking it to be a descriptive question, so that ... | What are the extra capabilities Python gives when used with Java? | 0.132549 | 0 | 0 | 124 |
9,663,321 | 2012-03-12T07:44:00.000 | 1 | 0 | 1 | 0 | java,python,jython | 9,663,439 | 3 | false | 1 | 0 | 1st: jython is many times slower than java.
2nd: as I recall integration in direction jython -> java is not very seemless.
3rd: you get python syntax, maybe some batteries (i don't really know this). This is a plus.
4th: you get good heavy multithreading support in python instead of green thread and GIL. That can be a ... | 3 | 3 | 0 | I am a Java developer. I would like to know what capabilities and/or positives I can add to a Java application, by including Python as a development language.
I am posting this here as I am not getting a good answer from google. I would request that you don't vote down, marking it to be a descriptive question, so that ... | What are the extra capabilities Python gives when used with Java? | 0.066568 | 0 | 0 | 124 |
9,663,321 | 2012-03-12T07:44:00.000 | 8 | 0 | 1 | 0 | java,python,jython | 9,663,494 | 3 | false | 1 | 0 | In general, there are no (overall) benefits for doing this. You're simply adding in another language with its own set of runtime features, that, for the most part does the same things that you can do in Java. Unless you have specific reason to add Python integration into your Java application, it would be a very poor i... | 3 | 3 | 0 | I am a Java developer. I would like to know what capabilities and/or positives I can add to a Java application, by including Python as a development language.
I am posting this here as I am not getting a good answer from google. I would request that you don't vote down, marking it to be a descriptive question, so that ... | What are the extra capabilities Python gives when used with Java? | 1 | 0 | 0 | 124 |
9,664,539 | 2012-03-12T09:30:00.000 | 1 | 1 | 0 | 0 | python,eclipse,pydev | 22,150,831 | 2 | false | 0 | 0 | CTRL+ALT+ENTER will execute the selected lines. | 1 | 1 | 0 | I'm using Pydev with Eclipse. Is it possible to execute a line of python code or a text selection with my IDE? Thanks! | Execute Python line of code in Eclipse | 0.099668 | 0 | 0 | 3,017 |
9,664,809 | 2012-03-12T09:49:00.000 | 1 | 0 | 0 | 1 | python,build,build-process,build-automation,jobs | 28,289,788 | 3 | false | 0 | 0 | Another option is to use make.
Write a Makefile manually or let a python script write it
use meaningful intermediate output file stages
Run make, which should then call out the processes. The processes would be a python (build) script with parameters that tell it which files to work on and what task to do.
parallel e... | 1 | 13 | 0 | I need a framework which will allow me to do the following:
Allow to dynamically define tasks (I'll read an external configuration file and create the tasks/jobs; task=spawn an external command for instance)
Provide a way of specifying dependencies on existing tasks (e.g. task A will be run after task B is finished)
B... | Python framework for task execution and dependencies handling | 0.066568 | 0 | 0 | 4,879 |
9,665,586 | 2012-03-12T10:42:00.000 | 0 | 0 | 0 | 1 | python,list | 9,666,450 | 5 | false | 0 | 0 | re.findall returns a list of matches. In your case you are getting lists with only one value. If that is always the case then @x539 answer will get the first item in the list. | 1 | 1 | 0 | The below is a part of a script i'm trying to write. The script opens my iptables log, each line in the log contains the details in the example below.
#example of a single line
#Mar 9 14:57:51 machine kernel: [23780.638839] IPTABLES Denied UDP: IN=p21p1 OUT= MAC=ff:ff:ff:ff:ff:ff:00:00:00:00:00:00:00:00 SRC=10.100.1... | Python - List issues (multiple lists?) | 0 | 0 | 0 | 189 |
9,665,913 | 2012-03-12T11:06:00.000 | 1 | 1 | 0 | 0 | python,performance,chat,tornado,long-polling | 9,668,433 | 1 | true | 0 | 0 | I would run the server in a mode where you let the client tell which client they are. i.e. change the code so it can be run this way as required. This is less secure, but makes testing easier. In production, don't use this option. This will give you a realistic test from a small number of client machines. | 1 | 2 | 0 | I've just created a web chat server with Tornado over Python. The communication mechanism is to use long-polling and I/O events.
I want to benchmark this web chat server at large scale, meaning I want to test this chat server (Tornado based) to see how many chatters it can withstand.
Because I'm using cookies to identi... | How to benchmark web chat performance? | 1.2 | 0 | 1 | 510 |
9,666,425 | 2012-03-12T11:46:00.000 | 0 | 0 | 0 | 0 | python,openerp | 9,667,268 | 3 | false | 1 | 0 | If we talking about web interface then you could disable it by javascript. | 1 | 4 | 0 | This might be a simple question.but,does any one know how to disable a button after clicking it in OpenERP?
Please help!!!!!
Thanks for all your help.... | How to disable a button after clicking it in OpenERP | 0 | 0 | 1 | 2,267 |
9,669,335 | 2012-03-12T14:51:00.000 | 1 | 0 | 1 | 0 | python,oop | 9,669,642 | 4 | false | 0 | 0 | There's no problem with having a long __init__ method, but I would avoid it simply because its more difficult to test. My approach would be to create smaller methods which are called from __init__. This way you can test them and the initialization separately.
Whether they should be called when needed or run up front ... | 3 | 6 | 0 | I have a program that I am writing in Python that does the following:
The user enters the name of a folder. Inside that folder a 8-15 .dat files with different extensions.
The program opens those dat files, enters them into a SQL database and then allows the user to select different changes made to the database. Then t... | Are verbose __init__ methods in Python bad? | 0.049958 | 0 | 0 | 920 |
9,669,335 | 2012-03-12T14:51:00.000 | 1 | 0 | 1 | 0 | python,oop | 9,669,457 | 4 | false | 0 | 0 | It looks the action you are describing are initialization, so it'd be perfectly ok to put them into __init__. On the other hand, these actions seem to be pretty expensive, and probably useful in the other part of a program, so you might want to encapsulate them in some separate function. | 3 | 6 | 0 | I have a program that I am writing in Python that does the following:
The user enters the name of a folder. Inside that folder a 8-15 .dat files with different extensions.
The program opens those dat files, enters them into a SQL database and then allows the user to select different changes made to the database. Then t... | Are verbose __init__ methods in Python bad? | 0.049958 | 0 | 0 | 920 |
9,669,335 | 2012-03-12T14:51:00.000 | 1 | 0 | 1 | 0 | python,oop | 9,669,472 | 4 | false | 0 | 0 | The __init__ method is called when the object is instantiated.
Coming from a C++ background I believe its not good to do actual work other than initialization in the constructor. | 3 | 6 | 0 | I have a program that I am writing in Python that does the following:
The user enters the name of a folder. Inside that folder a 8-15 .dat files with different extensions.
The program opens those dat files, enters them into a SQL database and then allows the user to select different changes made to the database. Then t... | Are verbose __init__ methods in Python bad? | 0.049958 | 0 | 0 | 920 |
9,670,168 | 2012-03-12T15:43:00.000 | 1 | 0 | 1 | 0 | python,mysql,mongodb | 9,670,254 | 2 | true | 0 | 0 | Memcached - easy, quick, found everywhere. I use it a lot. | 2 | 2 | 0 | What's the best way to store, index, and lookup text strings (URLs in this case)?
I'm creating a caching system for one of my sites. It's actually a bit more complex than that, thus the reason I'm rolling my own. I'm looking for the quickest, most-efficient way to resolve lookups on URLs, which obviously are text str... | most efficient lookup for url caching system for REST API | 1.2 | 0 | 0 | 269 |
9,670,168 | 2012-03-12T15:43:00.000 | 0 | 0 | 1 | 0 | python,mysql,mongodb | 9,671,877 | 2 | false | 0 | 0 | MongoDB is a database, not a caching system. The speed difference between it and MySQL is not likely to be huge.
As D Mac mention memcached is an excellent choice for this. You do need to be aware that memcached is a true caching system and can throw your data away at any moment. You must be able to handle that.
A good... | 2 | 2 | 0 | What's the best way to store, index, and lookup text strings (URLs in this case)?
I'm creating a caching system for one of my sites. It's actually a bit more complex than that, thus the reason I'm rolling my own. I'm looking for the quickest, most-efficient way to resolve lookups on URLs, which obviously are text str... | most efficient lookup for url caching system for REST API | 0 | 0 | 0 | 269 |
9,671,628 | 2012-03-12T17:14:00.000 | 1 | 0 | 1 | 0 | python,model,fortran,geospatial | 9,672,016 | 2 | true | 0 | 0 | SWAT is probably written to run non-interactively (in "batch" mode). If it generates lots and lots of files with a single call, your program can read them in and process them. If it needs to be called a lot of times to generate your results, you can call SWAT from your python program. Figure out how the command line op... | 1 | 3 | 0 | I'm taking a shot in the dark that someone can guide me with this. I've just started working on this and information is not so easy to find. I have a python code that simulates land use change and can output arcgis raster images. The watershed model SWAT uses these images to calculate land use parameters generating ... | how to couple a python code with a SWAT watershed model | 1.2 | 0 | 0 | 1,746 |
9,672,495 | 2012-03-12T18:14:00.000 | 0 | 0 | 0 | 1 | python,hadoop,mapreduce,hadoop-streaming | 10,921,996 | 2 | false | 0 | 0 | I had the same issue, and I think the problem is that the Hadoop virtual environments won't recognize your system's pythonpath. If you install packages to /Library/Python/2.7/site-packages, Hadoop will pick them up and it will work. | 2 | 2 | 0 | I have a PYTHONPATH set up in and it works fine too except when I run map-reduce job
It fails saying
Traceback (most recent call last):
File "/work/app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201203091218_0006/attempt_201203091218_0006_m_000020_0/work/./mapper.py", line 57, in
from src.utilities... | Hadoop-streaming : PYTHONPATH not working when mapper runs | 0 | 0 | 0 | 1,189 |
9,672,495 | 2012-03-12T18:14:00.000 | 0 | 0 | 0 | 1 | python,hadoop,mapreduce,hadoop-streaming | 21,020,422 | 2 | false | 0 | 0 | we need to add MapReduce Service Environment Safety Valve, In mycase we are using cloudera-manager GUI, I added PYTHONPATH it's working. | 2 | 2 | 0 | I have a PYTHONPATH set up in and it works fine too except when I run map-reduce job
It fails saying
Traceback (most recent call last):
File "/work/app/hadoop/tmp/mapred/local/taskTracker/hduser/jobcache/job_201203091218_0006/attempt_201203091218_0006_m_000020_0/work/./mapper.py", line 57, in
from src.utilities... | Hadoop-streaming : PYTHONPATH not working when mapper runs | 0 | 0 | 0 | 1,189 |
9,675,386 | 2012-03-12T21:56:00.000 | 2 | 1 | 0 | 0 | python,matlab | 9,675,452 | 4 | false | 0 | 0 | You can always start matlab as separate subprocess and collect results via std.out/files. (see subprocess package). | 1 | 2 | 1 | pymat doesnt seem to work with current versions of matlab, so I was wondering if there is another equivalent out there (I havent been able to find one). The gist of what would be desirable is running an m-file from python (2.6). (and alternatives such as scipy dont fit since I dont think they can run everything from th... | Running m-files from Python | 0.099668 | 0 | 0 | 5,746 |
9,677,174 | 2012-03-13T01:29:00.000 | 0 | 0 | 1 | 0 | python,winapi,console,conio | 9,863,330 | 1 | false | 0 | 0 | What you could do is use:x=ord(character)
That will allow you to get the ASCII value, then you can use:print chr(x) and it should give you the character that you need. | 1 | 2 | 0 | I'm writing a terminal game in python. It has a map loader function, normally it works fine when I use regular characters in the map. (abcdefg) but when I use something like █, and save the map as 'ansi', it renders it as a half solid. When I change the encoding to unicode, the display is scrambled with output such as ... | Python - Printing unicode to console window with WConio | 0 | 0 | 0 | 226 |
9,678,003 | 2012-03-13T03:31:00.000 | 15 | 0 | 1 | 0 | python,module | 9,678,335 | 2 | true | 0 | 0 | 1) Zen of Python #19: "Namespaces are one honking great idea -- let's do more of those!"
Named modules are good because they eliminate any chance of a collision between functions with the same name. If everything was a builtin, then os.error() would collide with logging.error() (and heaven forbid you try to define your... | 2 | 1 | 0 | Why does python use modules, instead of just including the module functions in the main language. It would be very useful and pretty easy, especially for the main ones such as random, re, and os. If Python preaches simplicity and minimalist, why do you have to write in extra lines of code? | Why does Python use Modules? | 1.2 | 0 | 0 | 362 |
9,678,003 | 2012-03-13T03:31:00.000 | 4 | 0 | 1 | 0 | python,module | 9,679,091 | 2 | false | 0 | 0 | Memory and speed efficiency
Objects that have been created (and everything is an object in Python) occupy the memory allocated to the Python interpreter process. When you import a module, its code is executed, resulting in the creation of many objects (functions, classes, data, etc.), most of which must persist in memo... | 2 | 1 | 0 | Why does python use modules, instead of just including the module functions in the main language. It would be very useful and pretty easy, especially for the main ones such as random, re, and os. If Python preaches simplicity and minimalist, why do you have to write in extra lines of code? | Why does Python use Modules? | 0.379949 | 0 | 0 | 362 |
9,678,876 | 2012-03-13T05:35:00.000 | 1 | 0 | 1 | 0 | python,eclipse,debugging,vim,pydev | 9,680,289 | 2 | true | 0 | 0 | My vote is for clewn, allthough I admit I haven't used it for python code. Just C, C++ code, but yes it worked like a charm.
If I remember correctly I even got this working, to a degree, on AIX 5.3 with dbx. | 1 | 6 | 0 | Is there a way to use vim to debug python programs and have it look/act somewhat like Eclipse with the PyDev plugin?
What I mean by that is:
have it be able to step debug (is that the right term?)
see the state all of all variables as the program executes
be able to see where in the program the debug process is - mayb... | Use VIM to step debug python like Eclipse and PyDev | 1.2 | 0 | 0 | 3,275 |
9,678,989 | 2012-03-13T05:49:00.000 | 0 | 0 | 0 | 0 | python,web-applications,persistence,cherrypy | 9,832,722 | 3 | false | 1 | 0 | I have developed a transparent persistent storage system for python this is currently in an alpha-stage. Once you create a persistent object, you can access and modify its attributes using standard python syntax (obj.x=3;) and the persistence is done behind the scenes (by overloading the setattr methods, etc.). Conta... | 2 | 2 | 0 | I am trying rewrite a simple Rails application I made a while ago with cherrypy and Python3. So far I have been unable to find a Python replacement for ActiveRecord (the persistence part of the application). Most of the recommendations I've found on StackOverflow have been for SQL Alchemy. I looked into this and it ... | Persistence for a python (cherrypy) web application? | 0 | 1 | 0 | 456 |
9,678,989 | 2012-03-13T05:49:00.000 | 1 | 0 | 0 | 0 | python,web-applications,persistence,cherrypy | 9,679,132 | 3 | false | 1 | 0 | SQL Alchemy is a industrial standard is no choice. But it's not as difficult as it seems at first sight | 2 | 2 | 0 | I am trying rewrite a simple Rails application I made a while ago with cherrypy and Python3. So far I have been unable to find a Python replacement for ActiveRecord (the persistence part of the application). Most of the recommendations I've found on StackOverflow have been for SQL Alchemy. I looked into this and it ... | Persistence for a python (cherrypy) web application? | 0.066568 | 1 | 0 | 456 |
9,680,762 | 2012-03-13T08:48:00.000 | 0 | 0 | 1 | 1 | python,eclipse,command-line,pydev | 9,687,892 | 3 | false | 0 | 0 | Actually, so far you can't do that without grabbing the code and changing it yourself (i.e.: that's hardcoded).
But still, if you don't use the unbuffered output (i.e.: -u option), the PyDev console will end up not showing the I/O output as it's printed (as it'll be buffered).
So, what is it that breaks because -u? (ma... | 1 | 0 | 0 | My code is broken by eclipse but works normaly if I launch it from command prompt with python and no option. I need to delete -u option when the python interpreter is launched in eclipse and pydev, how can I do that? | PyDev: how remove command line switch -u | 0 | 0 | 0 | 336 |
9,680,836 | 2012-03-13T08:52:00.000 | 4 | 0 | 0 | 0 | python,django,fastcgi | 9,686,346 | 2 | false | 1 | 0 | Timeout is in webserver, not in Django. You make a request to webserver and get a response from it, so you can't get anything outside of that response. In your case you should create a background task on server, usually getting started by cron or celery (it hink you can't run celery on hostgator so use cron) with a que... | 1 | 3 | 0 | I have a webhook which takes a little time to complete (around 5 minutes). However, the request gets timeout after around 30 seconds.
I am on a shared hosting with HostGator and using FCGI for deployment.
I think the request gets timed-out as there is not HTTPResponse until the request is processed. If I can generate s... | How to prevent FCGI request timeout in Django | 0.379949 | 0 | 0 | 4,285 |
9,683,258 | 2012-03-13T11:39:00.000 | 9 | 0 | 1 | 0 | python,python-3.x | 9,683,280 | 1 | false | 0 | 0 | \ is an escape character. Try open(r"C:\try\in0.txt") or open("C:\\try\\in0.txt"). | 1 | 4 | 0 | Admittedly, I am a novice; however, (I think) I did what the tutorial said (for the version I installed) and I can't get Python to read a file. Others have had problems with long file names or paths, but I kept mine short and sweet... so I thought.
The file itself contains one word on a single line.
The print('string... | Python 3.2.2 open('C:\file.txt') doesn't work | 1 | 0 | 0 | 5,259 |
9,684,254 | 2012-03-13T12:51:00.000 | 2 | 0 | 1 | 0 | python,numpy | 9,684,668 | 7 | false | 0 | 0 | You have to mach the versions of python and numpy. Both need to be 32 bit or 64 bit. | 4 | 30 | 0 | I cannot install numpy because it can't find python 2.7, althought I have installed python.
I have message: "Python version 2.7 required, which can't find in registry"
Do have a solve of my problem? | I cannot install numpy because it can't find python 2.7, althought I have installed python | 0.057081 | 0 | 0 | 49,615 |
9,684,254 | 2012-03-13T12:51:00.000 | 1 | 0 | 1 | 0 | python,numpy | 33,490,552 | 7 | false | 0 | 0 | You should install python 2.7 32bit. The numerical python windows version are all 32bit. | 4 | 30 | 0 | I cannot install numpy because it can't find python 2.7, althought I have installed python.
I have message: "Python version 2.7 required, which can't find in registry"
Do have a solve of my problem? | I cannot install numpy because it can't find python 2.7, althought I have installed python | 0.028564 | 0 | 0 | 49,615 |
9,684,254 | 2012-03-13T12:51:00.000 | 0 | 0 | 1 | 0 | python,numpy | 41,151,405 | 7 | false | 0 | 0 | Run installer
Click cancel when error shows up
Click show details
It will say at the end of the list Execute: C:\.........\numpy-1.7.1-sse3.exe, go to that folder, grab that file and drop it in C:\python27\
Once it's in said folder, run it from that location. Setup will run and find it. | 4 | 30 | 0 | I cannot install numpy because it can't find python 2.7, althought I have installed python.
I have message: "Python version 2.7 required, which can't find in registry"
Do have a solve of my problem? | I cannot install numpy because it can't find python 2.7, althought I have installed python | 0 | 0 | 0 | 49,615 |
9,684,254 | 2012-03-13T12:51:00.000 | 7 | 0 | 1 | 0 | python,numpy | 13,573,063 | 7 | false | 0 | 0 | This problem also affects 32-bit numpy on 32-bit Python.
The cause is that the numpy installer assumes you opted for "install for all users" when you installed Python, i.e. that the Python installer used the machine-wide HKEY_LOCAL_MACHINE part of the registry.
If you instead chose "install for me only", those registr... | 4 | 30 | 0 | I cannot install numpy because it can't find python 2.7, althought I have installed python.
I have message: "Python version 2.7 required, which can't find in registry"
Do have a solve of my problem? | I cannot install numpy because it can't find python 2.7, althought I have installed python | 1 | 0 | 0 | 49,615 |
9,685,946 | 2012-03-13T14:23:00.000 | 2 | 0 | 1 | 0 | python,string,math | 25,169,146 | 8 | false | 0 | 0 | The best way would be to do:
print eval("2 + 2")
If you wanted to you could use a variable:
addition = eval("2 + 2")
print addition
If you really wanted to, you could use a function:
def add(num1, num2):
eval("num1 + num2") | 1 | 52 | 0 | Let's say I have a standard Python string (such as one obtained from raw_input()), maybe "2 + 2" for simplicity's sake.
I'd like to convert this string to standard math operations in Python, such that "2 + 2" would return 4.
Is there an easy way to do this, or would I have to split on the spaces and parse each number... | Math operations from string | 0.049958 | 0 | 0 | 165,625 |
9,686,505 | 2012-03-13T14:54:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,google-docs-api | 9,948,934 | 2 | true | 1 | 0 | Currently the Documents List API library for Python (The GData Library) is rigidly synchronous. One solution would be to serialize the requests as tasks for a task queue and run them later, but the library itself won't help, I'm afraid. | 1 | 6 | 0 | Is there any way to queue up document list API requests and handle them asynchronously (similar to the google app engine async urlfetch requests)?
I could conceivably copy/rewrite a lot of the client request modification logic in DocsClient around a urlfetch request, but I'd rather avoid that if there's some other meth... | Asynchronous versions of Google APIs? | 1.2 | 0 | 0 | 2,692 |
9,687,002 | 2012-03-13T15:26:00.000 | 16 | 0 | 0 | 1 | python,ctypes | 9,784,508 | 2 | true | 0 | 1 | I have fixed this myself by reading the documentation.
I wanted to know the memory location of a block of memory allocated by a library. I had the ctypes pointer that pointed to said block. To get the memory address of the block I used ctypes.addressof(p_block.contents).
The confusion arose around my understanding that... | 1 | 11 | 0 | Short version:
How can I get the address that a ctypes pointer points to?
Long version:
I have registered a python function as a callback with a C library. The C library expects function signature of void (*p_func)(char stat, char * buf, short buf_len) so I register an appropriate python function. When I get into the p... | Get the memory address pointed to by a ctypes pointer | 1.2 | 0 | 0 | 12,060 |
9,689,016 | 2012-03-13T17:30:00.000 | 0 | 0 | 1 | 0 | python,variables,save | 9,689,083 | 2 | false | 0 | 0 | 1.) After typing all commands just do CTRL+S.
2) Give a file name and say OK.
This works for Python Shell. | 1 | 1 | 0 | Is there a way to save the current Python session? I would like to be able to save all my Python variables, functions, and imported libraries. If possible, having the history saved would be nice. I have looked all over Google and Stackoverflow for a simple command to do this, but have found nothing quite fitting what I... | Save variables in Python session? | 0 | 0 | 0 | 1,832 |
9,689,355 | 2012-03-13T17:51:00.000 | 4 | 0 | 1 | 0 | python | 9,689,406 | 3 | false | 0 | 0 | If the class in question can use one of several different modules, then it could make sense to pass in the one you want it to use.
In every situation I have encountered so far, however, the modules needed are certain, so using import would be preferred. | 1 | 36 | 0 | I was wondering if passing module objects to a class or object which requires it rather than using import might not be a bad idea, as it avoids hard dependencies on those modules.
I was wondering if someone more aware of the Python Zen than I might be able to explain why this is a terrible/not terrible idea? | Python - 'import' or pass modules as parameters? | 0.26052 | 0 | 0 | 16,658 |
9,689,588 | 2012-03-13T18:06:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,memcached,bigtable | 9,689,883 | 3 | false | 1 | 0 | I think that app engine does not cache anything for you. While it could be that, internally, it caches some things for a split second, I don't think you should rely on that.
I think you will be charged the normal number of read operations for every entity you read from every query. | 2 | 3 | 0 | I seem to remember reading somewhere that google app engine automatically caches the results of very frequent queries into memory so that they are retrieved faster.
Is this correct?
If so, is there still a charge for datastore reads on these queries? | Does app engine automatically cache frequent queries? | 0.066568 | 1 | 0 | 1,313 |
9,689,588 | 2012-03-13T18:06:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine,memcached,bigtable | 9,690,080 | 3 | false | 1 | 0 | No, it doesn't. However depending on what framework you use for access to the datastore, memcache will be used. Are you developing in java or python? On the java side, Objectify will cache GETs automatically but not Queries. Keep in mind that there is a big difference in terms of performance and cachability between get... | 2 | 3 | 0 | I seem to remember reading somewhere that google app engine automatically caches the results of very frequent queries into memory so that they are retrieved faster.
Is this correct?
If so, is there still a charge for datastore reads on these queries? | Does app engine automatically cache frequent queries? | 0.066568 | 1 | 0 | 1,313 |
9,690,752 | 2012-03-13T19:31:00.000 | 6 | 0 | 1 | 0 | php,python,ruby,ocr,tesseract | 9,703,643 | 2 | false | 0 | 0 | We use OCR XTR Lite from Vividata at my office. It uses the ScanSoft engine and is very accurate but isn't a free solution. Currently it is being scripted from bash and I process from 75,000 to 150,000 pages a day with it. Accuracy is almost perfect and it auto-rotates the images to determine the OCR orientation. | 1 | 30 | 0 | I've used Tesseract a bit and it's results leave much to be desired. I'm currently detecting very small images (35x15, without border, but have tried adding one with imagemagick with no ocr advantage); they range from 2 chars to 5 and are a pretty reliable font, however the characters are variable enough that simply u... | What OCR options exist beyond Tesseract? | 1 | 0 | 0 | 14,671 |
9,691,306 | 2012-03-13T20:09:00.000 | 3 | 0 | 0 | 1 | python,windows,winapi,pywin32 | 9,694,585 | 2 | false | 0 | 0 | You'll need to get a HWND handle to the window in question (EnumWindowHandles might be a good start), and then try calling IsHungAppWindow to see if the system thinks it's unresponsive. | 1 | 5 | 0 | I've got a Windows application running some expensive equipment; this application dies in a variety of creative ways. Usually when it goes, the process dies completely. I wrote a little monitoring program which looks for the process' name in the list of things which are currently running, and that works great for those... | Checking "liveness" of a Windows application? | 0.291313 | 0 | 0 | 368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.