Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,824,801 | 2011-04-28T20:47:00.000 | 3 | 0 | 1 | 0 | python,google-app-engine | 5,826,255 | 4 | false | 1 | 0 | str(entity.key()) will return a base64-encoded representation of the key.
entity.key().name() or entity.key().id() will return just the name or ID, omitting the kind and the ancestry. | 1 | 5 | 0 | In the Java low-level API, there is a way to turn an entity key into a string so you can pass it around to a client via JSON if you want. Is there a way to do this for python? | Serialize an entity key to a string in Python for GAE | 0.148885 | 0 | 0 | 1,650 |
5,824,881 | 2011-04-28T20:54:00.000 | 1 | 0 | 1 | 0 | python,methods,call,magic-methods | 18,765,810 | 14 | false | 0 | 0 | Specify a __metaclass__ and override the __call__ method, and have the specified meta classes' __new__ method return an instance of the class, viola you have a "function" with methods. | 3 | 171 | 0 | I know that __call__ method in a class is triggered when the instance of a class is called. However, I have no idea when I can use this special method, because one can simply create a new method and perform the same operation done in __call__ method and instead of calling the instance, you can call the method.
I would ... | Python __call__ special method practical example | 0.014285 | 0 | 0 | 134,138 |
5,824,881 | 2011-04-28T20:54:00.000 | 1 | 0 | 1 | 0 | python,methods,call,magic-methods | 60,960,755 | 14 | false | 0 | 0 | This is too late but I'm giving an example. Imagine you have a Vector class and a Point class. Both take x, y as positional args. Let's imagine you want to create a function that moves the point to be put on the vector.
4 Solutions
put_point_on_vec(point, vec)
Make it a method on the vector class. e.g my_vec.put_poin... | 3 | 171 | 0 | I know that __call__ method in a class is triggered when the instance of a class is called. However, I have no idea when I can use this special method, because one can simply create a new method and perform the same operation done in __call__ method and instead of calling the instance, you can call the method.
I would ... | Python __call__ special method practical example | 0.014285 | 0 | 0 | 134,138 |
5,824,881 | 2011-04-28T20:54:00.000 | 4 | 0 | 1 | 0 | python,methods,call,magic-methods | 13,199,242 | 14 | false | 0 | 0 | IMHO __call__ method and closures give us a natural way to create STRATEGY design pattern in Python. We define a family of algorithms, encapsulate each one, make them interchangeable and in the end we can execute a common set of steps and, for example, calculate a hash for a file. | 3 | 171 | 0 | I know that __call__ method in a class is triggered when the instance of a class is called. However, I have no idea when I can use this special method, because one can simply create a new method and perform the same operation done in __call__ method and instead of calling the instance, you can call the method.
I would ... | Python __call__ special method practical example | 0.057081 | 0 | 0 | 134,138 |
5,826,084 | 2011-04-28T23:09:00.000 | 3 | 0 | 1 | 0 | python,python-3.x,komodoedit | 6,878,970 | 3 | false | 0 | 0 | i had the same problem
try to use python3.1 %F in Komodo's run command tool instead of
%(python3) %F | 2 | 3 | 0 | I would like to use Komodo Edit to edit scripts written in Python 3.2. How do I setup Komodo Edit to run the Python 3.2 interpreter? I am using the latest version of Mac OSX.
The reason I ask because I am currently using Komodo Edit and am running some version of the Python interpreter. When I use the print(b, end=' ')... | How to setup Komodo Edit for Python 3.2 | 0.197375 | 0 | 0 | 8,043 |
5,826,084 | 2011-04-28T23:09:00.000 | 3 | 0 | 1 | 0 | python,python-3.x,komodoedit | 5,826,612 | 3 | true | 0 | 0 | You can change the default Python interpreter in Preferences -> Languages -> Python. | 2 | 3 | 0 | I would like to use Komodo Edit to edit scripts written in Python 3.2. How do I setup Komodo Edit to run the Python 3.2 interpreter? I am using the latest version of Mac OSX.
The reason I ask because I am currently using Komodo Edit and am running some version of the Python interpreter. When I use the print(b, end=' ')... | How to setup Komodo Edit for Python 3.2 | 1.2 | 0 | 0 | 8,043 |
5,826,697 | 2011-04-29T00:48:00.000 | 1 | 0 | 1 | 0 | python | 5,826,729 | 6 | false | 0 | 0 | The answer to both question is to use a loop.
Print the "{" and then loop through all the elements printing them.
But the input inside a loop and keep looping until you get what you want. | 1 | 2 | 0 | So i had to write a program that asks for a user input (which should be a 3 letter string) and it outputs the six permutations of the variations of the placements of the letters inside the string. However, my professor wants the output to be surrounded by curly brackets whereas mine is a list (so it is square brackets)... | Advice on python program | 0.033321 | 0 | 0 | 121 |
5,827,219 | 2011-04-29T02:27:00.000 | -1 | 0 | 1 | 0 | python,cuda,gpgpu,pycuda | 6,029,955 | 2 | false | 0 | 0 | You can use nVidia CUDA Profiler and see what gets executed before the failure. | 1 | 4 | 1 | Anyone following CUDA will probably have seen a few of my queries regarding a project I'm involved in, but for those who haven't I'll summarize. (Sorry for the long question in advance)
Three Kernels, One Generates a data set based on some input variables (deals with bit-combinations so can grow exponentially), another... | PyCUDA/CUDA: Causes of non-deterministic launch failures? | -0.099668 | 0 | 0 | 913 |
5,827,277 | 2011-04-29T02:39:00.000 | 6 | 0 | 1 | 0 | python,attributes,properties,subclass | 5,827,389 | 2 | false | 0 | 0 | You should not subclass then, you should use composition. Wrap your other class instance in a new class instance and use as necessary. | 1 | 7 | 0 | I basically want to create a subclass that "hides" methods on the superclass so that they don't show up in a dir() or hasattr() call and the users can't call them (at least not through any of the normal channels). I would also like to do this with the least amount of "magic" possible. Thanks. | How to "hide" superclass methods in a subclass | 1 | 0 | 0 | 2,748 |
5,829,964 | 2011-04-29T08:48:00.000 | 0 | 1 | 1 | 0 | python,file,io,gzip | 5,832,082 | 1 | false | 0 | 0 | I think flushing data to file (compressed) just writes the data into file, but headers are written only on close(), so you need to close the file first, and only after you can open it and read all data you need. If you need to write large data ammounts, you can try to use database, like PostgreSQL or MySQL where you ca... | 1 | 3 | 0 | My program does a lot of file processing, and as the files are large I prefer to write them as GZIP. One challenge is that I often need to read files as they are being written. This is not a problem without GZIP compression, but when compression is on, the reading complains about failed CRC, which I presume might hav... | Reading gzip file that is currently being written to | 0 | 0 | 0 | 586 |
5,830,706 | 2011-04-29T10:09:00.000 | 0 | 0 | 0 | 0 | java,python | 5,835,814 | 2 | false | 1 | 0 | You could always run the jar files in a subprocess and use PIPE for IO (or temp files). This works pretty well for us (we are generating PDF from our Django app with flying saucer and iText) | 1 | 0 | 0 | Hi I have few jar files which are few calculations compiled into jar files. I have a python web app which is supposed to interact with these jar files and get me the data. I have heard that it can be done using the java bridge. Can someone let me know how this could be done or at least point me to the right link. | Integrating python webapp with some jar files | 0 | 0 | 0 | 124 |
5,830,767 | 2011-04-29T10:16:00.000 | 1 | 0 | 0 | 0 | python,django | 5,830,888 | 3 | false | 1 | 0 | I found all wysiwyg editors I've used are much more confusing to use than just some plain old html. It is super easy to get started. Do it in plain html. | 1 | 0 | 0 | I've never done any web development before. I'm using django because I'm OK at python. I just want to make a small webapp which does a small task fast... | Is there any wysiwyg app which I can use to make the frontend pages of a sinmple django webapp? | 0.066568 | 0 | 0 | 198 |
5,831,548 | 2011-04-29T11:43:00.000 | 6 | 0 | 0 | 0 | python,sqlite | 5,832,180 | 7 | false | 0 | 0 | Yes. When you create the connection to the database, replace :memory: with the path where you want to save the DB.
sqlite uses caches for file based DBs, so this shouldn't be (much) slower. | 3 | 19 | 0 | Is it possible to save my in-memory sqlite database to hard disk?
If it is possible, some python code would be awesome.
Thanks in advance.
EDIT:
I succeeded this task by using apsw . It works like a charm. Thanks for your contribution. | python save in memory sqlite | 1 | 1 | 0 | 13,227 |
5,831,548 | 2011-04-29T11:43:00.000 | 13 | 0 | 0 | 0 | python,sqlite | 5,925,061 | 7 | false | 0 | 0 | (Disclosure: I am the APSW author)
The only safe way to make a binary copy of a database is to use the backup API that is part of SQLite and is exposed by APSW. This does the right thing with ordering, locking and concurrency.
To make a SQL (text) copy of the a database then use the APSW shell which includes a .dump ... | 3 | 19 | 0 | Is it possible to save my in-memory sqlite database to hard disk?
If it is possible, some python code would be awesome.
Thanks in advance.
EDIT:
I succeeded this task by using apsw . It works like a charm. Thanks for your contribution. | python save in memory sqlite | 1 | 1 | 0 | 13,227 |
5,831,548 | 2011-04-29T11:43:00.000 | 1 | 0 | 0 | 0 | python,sqlite | 5,831,644 | 7 | false | 0 | 0 | Open a disk based database and just copy everything from one to the other. | 3 | 19 | 0 | Is it possible to save my in-memory sqlite database to hard disk?
If it is possible, some python code would be awesome.
Thanks in advance.
EDIT:
I succeeded this task by using apsw . It works like a charm. Thanks for your contribution. | python save in memory sqlite | 0.028564 | 1 | 0 | 13,227 |
5,832,346 | 2011-04-29T12:58:00.000 | 0 | 1 | 0 | 1 | php,python | 5,832,407 | 2 | false | 0 | 0 | If you want things to be synchronous use a named socket(Amazing feature on Unix systems.)
If you want things to be asynchronous use pickle(there is a php version of it too.) | 1 | 0 | 0 | I need exchange data between python daemon (cluster nods send data to this daemon) and php script (apache) which, is accessed by webbrowsers. What do you recommend as technology which could establish some connection between them. Both, python daemon and apache/php is on the same machine.
Thank you. | Python data passing | 0 | 0 | 0 | 568 |
5,832,787 | 2011-04-29T13:36:00.000 | 4 | 0 | 0 | 0 | python,mysql | 5,832,825 | 3 | false | 0 | 0 | It is very simple - select data from one server, select data from another server and aggregate using Python. If you would like to have SQL query with JOIN - put result from both servers into separate tables in local SQLite database and write SELECT with JOIN. | 2 | 29 | 0 | In MySQL, I have two different databases -- let's call them A and B.
Database A resides on server server1, while database B resides on server server2.
Both servers {A, B} are physically close to each other, but are on different machines and have different connection parameters (different username, different password et... | MySQL -- Joins Between Databases On Different Servers Using Python? | 0.26052 | 1 | 0 | 32,061 |
5,832,787 | 2011-04-29T13:36:00.000 | 3 | 0 | 0 | 0 | python,mysql | 5,832,954 | 3 | false | 0 | 0 | No. It is not possible to do the join as you would like. But you may be able to sort something out by replicating one of the servers to the other for the individual database.
One data set is under the control of one copy of MySQL and the other dataset is under the control of the other copy of MySQL. The query can only... | 2 | 29 | 0 | In MySQL, I have two different databases -- let's call them A and B.
Database A resides on server server1, while database B resides on server server2.
Both servers {A, B} are physically close to each other, but are on different machines and have different connection parameters (different username, different password et... | MySQL -- Joins Between Databases On Different Servers Using Python? | 0.197375 | 1 | 0 | 32,061 |
5,832,899 | 2011-04-29T13:47:00.000 | 2 | 0 | 0 | 0 | python,permissions,plone,zope,archetypes | 5,843,705 | 3 | false | 1 | 0 | Well, it is a sort of validation constraint, so maybe add a validator to the title field that in reality does not bother about the title, but checks the user etc.? (I think a field validator is passed enough information to pull this off, if not, overriding the post_validate method or listening to the corresponding even... | 1 | 7 | 0 | I have created a custom Archetypes content type called "Résumé" and would like to enforce a limitation that lets a Member add only one item of this type inside a folder. Even better would be redirecting the member to the edit page of his or her item, if it already exists in that folder.
How can I enforce this limitatio... | Limiting one Content item per Member in a Folder on Plone 4 | 0.132549 | 0 | 0 | 301 |
5,833,418 | 2011-04-29T14:32:00.000 | 50 | 0 | 0 | 0 | python,database,migration,django-south | 5,897,509 | 5 | false | 1 | 0 | You can at least inspect the sql generated by doing manage.py migrate --db-dry-run --verbosity=2. This will not do anything to the database and will show all the sql. I would still make a backup though, better safe than sorry. | 2 | 28 | 0 | Here's what I want to do.
Develop a Django project on a development server with a development database. Run the south migrations as necessary when I change the model.
Save the SQL from each migration, and apply those to the production server when I'm ready to deploy.
Is such a thing possible with South? (I'd also be ... | Django - South - Is There a way to view the SQL it runs? | 1 | 1 | 0 | 10,745 |
5,833,418 | 2011-04-29T14:32:00.000 | 2 | 0 | 0 | 0 | python,database,migration,django-south | 5,932,967 | 5 | false | 1 | 0 | I'd either do what Lutger suggested (and maybe write a log parser to strip out just the SQL), or I'd run my migration against a test database with logging enabled on the test DB.
Of course, if you can run it against the test database, you're just a few steps away from validating the migration. If it passes, run it aga... | 2 | 28 | 0 | Here's what I want to do.
Develop a Django project on a development server with a development database. Run the south migrations as necessary when I change the model.
Save the SQL from each migration, and apply those to the production server when I'm ready to deploy.
Is such a thing possible with South? (I'd also be ... | Django - South - Is There a way to view the SQL it runs? | 0.07983 | 1 | 0 | 10,745 |
5,833,717 | 2011-04-29T14:58:00.000 | 2 | 0 | 1 | 0 | python,3d | 5,833,950 | 2 | false | 0 | 0 | Most likely it's because of how objects are rendered in OpenGL. Depending on how you want to set up your rendering, OBJ files are very easy to read in and render in OpenGL. One reason they may have duplicate vertices is if you want to do interleaved vertex arrays, it may end up being easier to create the interleaved ar... | 1 | 2 | 0 | I am writing a python converter that takes in an .obj file and outputs it in another format. I've noticed that .obj files have a lot of duplicate vertices, and a lot of the faces refer to these duplicates.
So I wrote the script to only add a vertex once and ignore any duplicates, and if any face references a duplicate ... | 3D formats: obj and duplicate vertices | 0.197375 | 0 | 0 | 1,638 |
5,833,907 | 2011-04-29T15:17:00.000 | 0 | 0 | 1 | 0 | python,list,performance,append | 5,834,331 | 5 | false | 0 | 0 | First of all, 38 two-character sets per second, 1 stop bit, 8 data bits, and no parity, is only 760 baud, not fast at all.
But anyway, my suggestion, if you're worried about having overly large lists/don't want to use one huge list, is just to store store a list on disk once it reaches a certain size and start a new li... | 2 | 23 | 0 | I have a project where I am reading in ASCII values from a microcontroller through a serial port (looks like this : AA FF BA 11 43 CF etc)
The input is coming in quickly (38 two character sets / second).
I'm taking this input and appending it to a running list of all measurements.
After about 5 hours, my list has grown... | Repeatedly appending to a large list (Python 2.6.6) | 0 | 0 | 0 | 43,596 |
5,833,907 | 2011-04-29T15:17:00.000 | 16 | 0 | 1 | 0 | python,list,performance,append | 5,834,017 | 5 | false | 0 | 0 | One thing you might want to consider is writing your data to a file as it's collected. I don't know (or really care) if it will affect performance, but it will help ensure that you don't lose all your data if power blips. Once you've got all the data, you can suck it out of the file and jam it in a list or an array or ... | 2 | 23 | 0 | I have a project where I am reading in ASCII values from a microcontroller through a serial port (looks like this : AA FF BA 11 43 CF etc)
The input is coming in quickly (38 two character sets / second).
I'm taking this input and appending it to a running list of all measurements.
After about 5 hours, my list has grown... | Repeatedly appending to a large list (Python 2.6.6) | 1 | 0 | 0 | 43,596 |
5,838,025 | 2011-04-29T22:28:00.000 | 0 | 0 | 0 | 1 | python,windows-7,io,uac | 5,838,035 | 4 | false | 0 | 0 | You need to execute this program as administrator or an account you have granted permissions to if you want to write to the program files folder. If you run the executable as normal user you won't have access. | 3 | 3 | 0 | I made a program that both gathers data from a .txt file by reading it, and writes data to a different .txt file. However, there is a problem. When I run the program in a normal directory It runs perfectly fine. A problem arises when I place it in the C:\Program Files directory. When I run it I get IOERROR: [Errno 13] ... | IO within the Program Files Directory | 0 | 0 | 0 | 1,184 |
5,838,025 | 2011-04-29T22:28:00.000 | 2 | 0 | 0 | 1 | python,windows-7,io,uac | 5,838,045 | 4 | false | 0 | 0 | The most likely cause of this is that the "Program Files" directories in Windows 7 require administrative privileges to create sub directories.
You could run python as an administrator (hold shift, right click python.exe, run as administrator), or write to a directory that is not Program Files. | 3 | 3 | 0 | I made a program that both gathers data from a .txt file by reading it, and writes data to a different .txt file. However, there is a problem. When I run the program in a normal directory It runs perfectly fine. A problem arises when I place it in the C:\Program Files directory. When I run it I get IOERROR: [Errno 13] ... | IO within the Program Files Directory | 0.099668 | 0 | 0 | 1,184 |
5,838,025 | 2011-04-29T22:28:00.000 | 2 | 0 | 0 | 1 | python,windows-7,io,uac | 5,838,105 | 4 | false | 0 | 0 | I suggest saving the folder in %appdata%\my subdirectory. You won't need administrator privilege for that. | 3 | 3 | 0 | I made a program that both gathers data from a .txt file by reading it, and writes data to a different .txt file. However, there is a problem. When I run the program in a normal directory It runs perfectly fine. A problem arises when I place it in the C:\Program Files directory. When I run it I get IOERROR: [Errno 13] ... | IO within the Program Files Directory | 0.099668 | 0 | 0 | 1,184 |
5,838,735 | 2011-04-30T00:54:00.000 | 0 | 0 | 0 | 1 | python,django | 5,838,777 | 4 | true | 0 | 0 | Use relative paths? ../../../../file | 1 | 4 | 0 | My cwd is ~/Desktop/Development/Python/djcode/mysite, and I want to open a file on my Desktop. What is the syntax to open files in a different directory? (for example, if the file was in the cwd I would use open('file'). Thank you. | Open file in Python | 1.2 | 0 | 0 | 16,048 |
5,842,487 | 2011-04-30T14:47:00.000 | 2 | 1 | 0 | 0 | python,html | 5,842,534 | 5 | false | 1 | 0 | You are mixing up client-side and server-side execution of code.
Browsers support only Javascript.
Any application-server or Python-based webframework support template language where you can mix HTML and Python in some way or the other. | 1 | 9 | 0 | Is it possible to write Python scripts in HTML code similarly as you write PHP between <?php ... ?> tags?
I'd like to achieve that my Python application will run in the browser.
thank you for help | Python scripts in HTML | 0.07983 | 0 | 0 | 49,400 |
5,842,593 | 2011-04-30T15:03:00.000 | -1 | 0 | 1 | 0 | python,descriptor | 5,842,714 | 3 | false | 0 | 0 | @property does not allow you to define dedicated setter and getter methods at the same time.
If a getter method is "good enough" then use @property otherwise you need property(). | 2 | 17 | 0 | I'm aware that a property is a descriptor, but are there specific examples of when using a descriptor class might be more advantageous, pythonic, or provide some benefit over using @property on a method function? | When and why might I assign an instance of a descriptor class to a class attribute in Python rather than use a property? | -0.066568 | 0 | 0 | 2,029 |
5,842,593 | 2011-04-30T15:03:00.000 | 9 | 0 | 1 | 0 | python,descriptor | 5,842,753 | 3 | true | 0 | 0 | Better encapsulation and re-usability: A descriptor class can have custom attributes set on instantiating. Sometimes it's useful to keep data confined in this manner, instead of having to worry about it getting set or overwritten on the descriptor's owner. | 2 | 17 | 0 | I'm aware that a property is a descriptor, but are there specific examples of when using a descriptor class might be more advantageous, pythonic, or provide some benefit over using @property on a method function? | When and why might I assign an instance of a descriptor class to a class attribute in Python rather than use a property? | 1.2 | 0 | 0 | 2,029 |
5,843,508 | 2011-04-30T17:39:00.000 | 2 | 0 | 1 | 0 | python,xcode,xcode4,pyobjc | 7,815,044 | 3 | false | 0 | 1 | I've successfully built a MacRuby GUI app in XCode 4.2 on Lion today following a MacRuby tutorial on Apple's site. MacRuby also includes a template in XCode 4.2. I'm a Python programmer and really hoped to use it, but at this point I've given up on PyObjC. I use Tk in Python for quick little apps and maybe switch to Ma... | 1 | 13 | 0 | Xcode 3 had templates for building Cocoa subclasses in Python. I've recently upgraded to Xcode 4 but I cannot find out how I can use other languages besides the C family (C, C++, Obj-C) in Xcode 4.
Does anyone know? | PyObjC on Xcode 4 | 0.132549 | 0 | 0 | 7,826 |
5,844,869 | 2011-04-30T21:56:00.000 | 35 | 0 | 1 | 1 | python,virtualenv | 13,261,064 | 4 | false | 0 | 0 | Virtualenv is a tool to create isolated Python environments.
Let's say you're working in 2 different projects, A and B.
Project A is a web project and the team is using the following packages:
Python 2.8.x
Django 1.6.x
The project B is also a web project but your team is using:
Python 2.7.x
Django 1.4.x
The machine... | 1 | 358 | 0 | I've been hearing the buzz about virtualenv lately, and I'm interested. But all I've heard is a smattering of praise, and don't have a clear understanding of what it is or how to use it.
I'm looking for (ideally) a follow-along tutorial that can take me from Windows or Linux with no Python on it, and explain every step... | Comprehensive beginner's virtualenv tutorial? | 1 | 0 | 0 | 149,425 |
5,844,870 | 2011-04-30T21:56:00.000 | 1 | 0 | 0 | 0 | python,stream,live,urllib | 5,844,901 | 3 | false | 1 | 0 | You'll have to periodically re-download the website. Don't do it constantly because that will be too hard on the server.
This is because HTTP, by nature, is not a streaming protocol. Once you connect to the server, it expects you to throw an HTTP request at it, then it will throw an HTTP response back at you containing... | 3 | 1 | 0 | I'm trying to read in info that is constantly changing from a website.
For example, say I wanted to read in the artist name that is playing on an online radio site.
I can grab the current artist's name but when the song changes, the HTML updates itself and I've already opened the file via:
f = urllib.urlopen("SITE")
S... | Parsing lines from a live streaming website in Python | 0.066568 | 0 | 1 | 858 |
5,844,870 | 2011-04-30T21:56:00.000 | 0 | 0 | 0 | 0 | python,stream,live,urllib | 5,844,908 | 3 | false | 1 | 0 | Yes, this is correct approach. To get changes in web, you have to send new query each time. Live AJAX sites do exactly same internally.
Some sites provide additional API, including long polling. Look for documentation on the site or ask their developers whether there is some. | 3 | 1 | 0 | I'm trying to read in info that is constantly changing from a website.
For example, say I wanted to read in the artist name that is playing on an online radio site.
I can grab the current artist's name but when the song changes, the HTML updates itself and I've already opened the file via:
f = urllib.urlopen("SITE")
S... | Parsing lines from a live streaming website in Python | 0 | 0 | 1 | 858 |
5,844,870 | 2011-04-30T21:56:00.000 | 1 | 0 | 0 | 0 | python,stream,live,urllib | 5,844,912 | 3 | false | 1 | 0 | If you use urllib2 you can read the headers when you make the request. If the server sends back a "304 Not Modified" in the headers then the content hasn't changed. | 3 | 1 | 0 | I'm trying to read in info that is constantly changing from a website.
For example, say I wanted to read in the artist name that is playing on an online radio site.
I can grab the current artist's name but when the song changes, the HTML updates itself and I've already opened the file via:
f = urllib.urlopen("SITE")
S... | Parsing lines from a live streaming website in Python | 0.066568 | 0 | 1 | 858 |
5,845,717 | 2011-05-01T01:17:00.000 | 1 | 0 | 0 | 1 | python,x11,window-managers,xcb | 5,851,984 | 1 | false | 0 | 1 | The short answer is configure the window (size, stacking, etc.) by calling ConfigureWindow. The long answer is here you impose policy and honor specs such as XSizeHints. Best to have a look at some existing WMs' source and get a sense of what they do. Exactly what you do depends on your desired UI.
The simplest thing ... | 1 | 2 | 0 | For my sins (and for fun the learning experience) I am writing a window manager (I know, I know).
I'm using python and XCB (python-xpyb).
So far I have figured out that I need to use a SubStructureRedirect mask on the root window(s), and I am successfully being passed events related to applications' top-level windows. ... | What should a Window Manager do with a ConfigureRequestEvent? | 0.197375 | 0 | 0 | 848 |
5,846,022 | 2011-05-01T02:33:00.000 | 0 | 0 | 0 | 1 | python | 5,846,054 | 2 | false | 0 | 0 | Reinstalling would work. In the future, don't delete Frameworks you didn't install. | 1 | 0 | 0 | I download python 3.2 and my first thought was that I need to uninstall the python 2.6.1 pre-installed in my computer. But later I found in python.org "You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software". I used "sudo rm -rf /Library/Frameworks/Python.Fr... | how to recover python 2.6.1 that was pre-installed in my macbook pro? | 0 | 0 | 0 | 1,053 |
5,846,167 | 2011-05-01T03:10:00.000 | 2 | 0 | 1 | 1 | python,macos | 50,347,328 | 19 | false | 0 | 0 | Navigate to:
My Computer -> Properties -> Advanced -> Environment Variables -> System Variables
Suppose you had already having python 2.7 added in path variable and you want to change default path to python 3.x
then add path of python3.5.x folder before python2.7 path.
open cmd: type "python --version"
python version w... | 6 | 173 | 0 | I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1.
How can I change the default Python version? | How to change default Python version? | 0.02105 | 0 | 0 | 661,274 |
5,846,167 | 2011-05-01T03:10:00.000 | 2 | 0 | 1 | 1 | python,macos | 28,787,350 | 19 | false | 0 | 0 | I am using OS X 10.7.5 and Python 3.4.2. If you type python3 and what you want to run it will run it using python 3. For example
pyhton3 test001.py. That ran a test program I made called test001. I hope this helps. | 6 | 173 | 0 | I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1.
How can I change the default Python version? | How to change default Python version? | 0.02105 | 0 | 0 | 661,274 |
5,846,167 | 2011-05-01T03:10:00.000 | 0 | 0 | 1 | 1 | python,macos | 71,028,281 | 19 | false | 0 | 0 | Starting with macOS Catalina the default shell is zsh. Therefore, all those ~/.bash_profile changes are not going to change the default when you open a new terminal since the new terminal is a zsh shell and not a bash shell.
You can confirm your terminal is a zsh shell by typing echo $SHELL and you should see a respons... | 6 | 173 | 0 | I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1.
How can I change the default Python version? | How to change default Python version? | 0 | 0 | 0 | 661,274 |
5,846,167 | 2011-05-01T03:10:00.000 | 0 | 0 | 1 | 1 | python,macos | 69,782,553 | 19 | false | 0 | 0 | It should be noted that recent versions of Homebrew/MacOS will require a different entry for the PATH as the location where Homebrew installs Python has changed. Add this like to your .zshrc:
export PATH="/opt/homebrew/opt/python/libexec/bin:$PATH"
This will ensure that the appropriate unversioned python link install... | 6 | 173 | 0 | I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1.
How can I change the default Python version? | How to change default Python version? | 0 | 0 | 0 | 661,274 |
5,846,167 | 2011-05-01T03:10:00.000 | -3 | 0 | 1 | 1 | python,macos | 67,921,871 | 19 | false | 0 | 0 | After installing the newer version of python to your computer...
When you want to run a python program (e.g. 'program.py') from the terminal (using the latest version of python on your system); instead of running 'python program.py' run 'python3 program.py'
Similarly, if you want to use python in the terminal (using th... | 6 | 173 | 0 | I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1.
How can I change the default Python version? | How to change default Python version? | -0.031568 | 0 | 0 | 661,274 |
5,846,167 | 2011-05-01T03:10:00.000 | 1 | 0 | 1 | 1 | python,macos | 60,886,499 | 19 | false | 0 | 0 | In short: change the path in Environment Variables!
For Windows:
Advanced System Settings > Advance (tab). On bottom you'll find 'Environment Variables'
Double-click on the Path. You'll see path to one of the python installations, change that to path of your desired version. | 6 | 173 | 0 | I have installed Python 3.2 in my Mac. After I run /Applications/Python 3.2/Update Shell Profile.command, it's confusing that when I type Python -V in Terminal it says that Python 2.6.1.
How can I change the default Python version? | How to change default Python version? | 0.010526 | 0 | 0 | 661,274 |
5,847,201 | 2011-05-01T07:51:00.000 | 5 | 0 | 1 | 0 | python,differential-equations | 5,847,306 | 6 | false | 0 | 0 | For calculations in symbols - use sympy. | 1 | 21 | 0 | I'm working with a DE system, and I wanted to know which is the most commonly used python library to solve Differential Equations if any.
My Equations are non Linear First Order equations. | Differential Equations in Python | 0.16514 | 0 | 0 | 45,168 |
5,847,679 | 2011-05-01T09:50:00.000 | 2 | 0 | 0 | 0 | python,google-app-engine | 5,848,560 | 1 | true | 1 | 0 | No.
size=120 is something you could pass as the 2nd argument to the get_serving_url method. =s120 would be something that you append to the URL returned by get_serving_url.
The effect is the same: larger images are scaled down, but smaller images are not scaled up. | 1 | 0 | 0 | Hi My question is whether I've understood the usage correctly: Adding =s120 to the url will scale the image to 120 pixels and adding the parameter size=120 will behave differently: It will only shrink images larger than 120 pixels. Is this true?
Thank you | get_serving_url question | 1.2 | 0 | 0 | 188 |
5,848,147 | 2011-05-01T11:46:00.000 | 0 | 0 | 1 | 0 | python,algorithm,math,xor | 5,848,589 | 2 | false | 0 | 0 | The algorithm to find such pairs is simple - for every possible 'c' find matching 'd'. You'll get many solutions. Obviously you can't get single pair ('c', 'd') because then you could switch one bit in both strings (the same bit in both) and get different solution. | 2 | 1 | 0 | I've build a small module in python which takes a list of strings/buffers in the same size, and returns a xor string in the same size. Then, using that string, together with n-1 strings, I can complete the missing one.
It works great, so my question is:
do you know an already made python module for that?
is there a wa... | completion of part x using n-1 parts | 0 | 0 | 0 | 96 |
5,848,147 | 2011-05-01T11:46:00.000 | 0 | 0 | 1 | 0 | python,algorithm,math,xor | 5,848,277 | 2 | true | 0 | 0 | (1) There is unlikely to be a published module for that.
(2) I think that you mean that a ^ b ^ c ^ d == e, and you ask if the values of c and d can be recovered ("completed") if the values of a b and e are known. The answer to that question is no -- you have one equation with two unknowns.
Update in response to ques... | 2 | 1 | 0 | I've build a small module in python which takes a list of strings/buffers in the same size, and returns a xor string in the same size. Then, using that string, together with n-1 strings, I can complete the missing one.
It works great, so my question is:
do you know an already made python module for that?
is there a wa... | completion of part x using n-1 parts | 1.2 | 0 | 0 | 96 |
5,848,184 | 2011-05-01T11:55:00.000 | 0 | 0 | 0 | 1 | python,linux,performance,io,deadlock | 12,211,059 | 2 | false | 1 | 0 | Quick advice, make sure (like, super sure) that you do close your file.
So ALWAYS use a try-except-final block for this
Remember that the contens of a final block will ALWAYS be executed, that will prevent you a lot of head pain :) | 1 | 1 | 0 | In my server process, it looks like this:
Main backend processes:
Processes Huge list of files and , record them inside MySQL.
On every 500 files done, it writes "Progress Report" to a separate file /var/run/progress.log like this "200/5000 files done"
It is multi-processed with 4 children, each made sure to run on a ... | If I open and read the file which is periodically written, can I/O deadlock occur? | 0 | 1 | 0 | 773 |
5,848,496 | 2011-05-01T12:59:00.000 | 0 | 0 | 0 | 0 | python,url,flask | 5,848,509 | 2 | false | 1 | 0 | By pointing all the subdomains of that domain to the same website via DNS, and then inspecting the HTTP 1.1 Host header to determine which user website is being viewed. | 1 | 2 | 0 | Suppose there is a web app name thesite.com. I need to give every user
a url of his own. For eg- if alice signs up, she gets a space of her
own at the url "alice.thesite.com".. How do I achieve this.
Thanks
Alice | how to map url with usernames prefixed? | 0 | 0 | 1 | 164 |
5,849,020 | 2011-05-01T14:37:00.000 | 1 | 0 | 1 | 0 | python-2.7,imdbpy | 7,826,575 | 1 | false | 0 | 0 | I'm way too late, but I answer for other user that will need it in the future.
You can do this (not easily, at least).
My best advice is to use the imdbpy2sql.py script to populate a database of your choice (Postgresql, MySQL, SQLite and other) and then script your series of batch operation as SQL statements. It's pos... | 1 | 0 | 0 | I am starting using imdbpy and I am interesting in a way to implement a method with the following specifications:
Inputs:
numberToRetrieve (number of movies to retrive back)
movieGenre (the genre of movies by example:'horror')
Output:
List of movies object
Many thanks in advance!
Joshua | How can I retrieve a given number of movies under a given genre using imdbpy? | 0.197375 | 0 | 0 | 320 |
5,850,818 | 2011-05-01T19:37:00.000 | 1 | 0 | 1 | 0 | c#,python,com,py2exe,rpy2 | 5,914,954 | 1 | true | 0 | 0 | Given the current state of extremely limited support of rpy2 on Microsoft Windows, I'd consider other options. | 1 | 3 | 0 | I am hoping to port some Python code that uses RPY2 to run R functions into dlls using py2exe then, ultimately, to COM objects for integration with a C# project of a collaborator.
If incorporating rpy2 into py2exe is not too painful, this could save a fair bit of recoding. Does anyone have suggestions based on their e... | Has anyone used rpy2 with py2exe? | 1.2 | 0 | 0 | 350 |
5,851,154 | 2011-05-01T20:23:00.000 | 1 | 0 | 0 | 0 | python,algorithm,dijkstra,shortest-path,graph-algorithm | 5,852,526 | 10 | false | 0 | 0 | I would refer you to the following paper: "Sub-cubic Cost Algorithms for the All Pairs Shortest Path Problem" by Tadao Takaoka. There a sequential algorithm with sub-cubic complexity for graphs with unit weight (actually max edge weight = O(n ^ 0.624)) is available. | 3 | 14 | 1 | As the title said, I'm trying to implement an algorithm that finds out the distances between all pairs of nodes in given graph. But there is more: (Things that might help you)
The graph is unweighted. Meaning that all the edges can be considered as having weight of 1.
|E| <= 4*|V|
The graph is pretty big (at most ~144... | best algorithm for finding distance for all pairs where edges' weight is 1 | 0.019997 | 0 | 0 | 6,778 |
5,851,154 | 2011-05-01T20:23:00.000 | 1 | 0 | 0 | 0 | python,algorithm,dijkstra,shortest-path,graph-algorithm | 6,589,501 | 10 | false | 0 | 0 | I'm assuming the graph is dynamic; otherwise, there's no reason not to use Floyd-Warshall to precompute all-pairs distances on such a small graph ;)
Suppose you have a grid of points (x, y) with 0 <= x <= n, 0 <= y <= n. Upon removing an edge E: (i, j) <-> (i+1, j), you partition row j into sets A = { (0, j), ..., (i, ... | 3 | 14 | 1 | As the title said, I'm trying to implement an algorithm that finds out the distances between all pairs of nodes in given graph. But there is more: (Things that might help you)
The graph is unweighted. Meaning that all the edges can be considered as having weight of 1.
|E| <= 4*|V|
The graph is pretty big (at most ~144... | best algorithm for finding distance for all pairs where edges' weight is 1 | 0.019997 | 0 | 0 | 6,778 |
5,851,154 | 2011-05-01T20:23:00.000 | 9 | 0 | 0 | 0 | python,algorithm,dijkstra,shortest-path,graph-algorithm | 5,851,436 | 10 | false | 0 | 0 | Run a breadth-first search from each node. Total time: O(|V| |E|) = O(|V|2), which is optimal. | 3 | 14 | 1 | As the title said, I'm trying to implement an algorithm that finds out the distances between all pairs of nodes in given graph. But there is more: (Things that might help you)
The graph is unweighted. Meaning that all the edges can be considered as having weight of 1.
|E| <= 4*|V|
The graph is pretty big (at most ~144... | best algorithm for finding distance for all pairs where edges' weight is 1 | 1 | 0 | 0 | 6,778 |
5,851,588 | 2011-05-01T21:39:00.000 | 7 | 0 | 1 | 1 | python | 5,851,615 | 4 | false | 0 | 0 | It's only the same if you are in the "main" script of your python programm. If you import other files, __file__ will contain the path to that file, but sys.argv will still hold the same values. | 2 | 30 | 0 | Is there any difference between:
__file__
and
sys.argv[0]
Because both seem to be doing the same thing: they hold the name of the script.
If there is no difference, then why is it that __file__ is used in almost all someplaces whereas I have never seen sys.argv[0] being used. | Difference between __file__ and sys.argv[0] | 1 | 0 | 0 | 5,521 |
5,851,588 | 2011-05-01T21:39:00.000 | 26 | 0 | 1 | 1 | python | 5,851,608 | 4 | true | 0 | 0 | __file__ is the name of the current file, which may be different from the main script if you are inside a module or if you start a script using execfile() rather than by invoking python scriptname.py. __file__ is generally your safer bet. | 2 | 30 | 0 | Is there any difference between:
__file__
and
sys.argv[0]
Because both seem to be doing the same thing: they hold the name of the script.
If there is no difference, then why is it that __file__ is used in almost all someplaces whereas I have never seen sys.argv[0] being used. | Difference between __file__ and sys.argv[0] | 1.2 | 0 | 0 | 5,521 |
5,851,656 | 2011-05-01T21:46:00.000 | 3 | 0 | 0 | 0 | python,pygame | 5,853,562 | 2 | true | 0 | 1 | There's a good reason for this. Double buffering is a technique used to prevent "flickering". Basically, you want to draw a frame to memory instead of to the monitor and then push the frame all at once when its drawn. Otherwise, you can see different elements of the same frame go up at different times.
What you want... | 1 | 2 | 0 | I'm just beginning a very simple pygame code that draws a green line on a white background. However, I have to use pygame.display.flip() in order for it to show up, but it seems that I would have to use this every time I made a change and this seems too impractical for me to be doing it right. Am I missing something? | Beginner problem with pygame | 1.2 | 0 | 0 | 1,583 |
5,855,543 | 2011-05-02T09:33:00.000 | 4 | 0 | 1 | 1 | python,installation,dependencies | 5,855,669 | 2 | true | 0 | 0 | The most important thing to help you decide is to consider your audience.
Are they technically-inclined and likely to be comfortable following instructions specifying how to build the dependencies themselves? If so, go with (3). If not, writing a python or shell script, or a makefile to automate the task may be the... | 1 | 5 | 0 | I am thinking of a good way to ship my application which is a python package. Installing my package is easy making use of pythons distutils package.
The trouble comes with the dependencies my package relies on. If the dependencies are python packages I can deal with them easily again using distutils, but non python pa... | Best practice to install dependencies? | 1.2 | 0 | 0 | 3,223 |
5,857,320 | 2011-05-02T12:50:00.000 | 0 | 1 | 0 | 0 | c++,python,c,freebsd,ipv6 | 5,857,748 | 5 | false | 0 | 0 | I have the mind boogling ipv4 / ipv6 validating regexps around, which are quite long and non-trivial to produce. I can share if you want. | 2 | 2 | 0 | Is there a good high level library that can be used for IP address manipulation? I need to do things like:
Given a string find out if it is a valid IPv4/IPv6 address.
Have functionality like ntop and pton
etc
I can use the low level inet_ntop() etc. But is there a better library that handles these better and fast (c/... | Efficient IP address c/c++ library on unix | 0 | 0 | 1 | 1,307 |
5,857,320 | 2011-05-02T12:50:00.000 | 1 | 1 | 0 | 0 | c++,python,c,freebsd,ipv6 | 5,857,539 | 5 | false | 0 | 0 | If you are writing a sockets app it's highly unlikely that address manipulation is going to be your most important consideration. Don't waste time on this when you have network I/O to worry about. | 2 | 2 | 0 | Is there a good high level library that can be used for IP address manipulation? I need to do things like:
Given a string find out if it is a valid IPv4/IPv6 address.
Have functionality like ntop and pton
etc
I can use the low level inet_ntop() etc. But is there a better library that handles these better and fast (c/... | Efficient IP address c/c++ library on unix | 0.039979 | 0 | 1 | 1,307 |
5,857,951 | 2011-05-02T13:49:00.000 | 0 | 0 | 1 | 0 | python,interface,python-3.x | 5,858,213 | 3 | false | 0 | 0 | Yeah, python is all about duck typing, and it's perfectly acceptable to check for a few methods to decide whether an object supports the IO interface. Sometimes it even makes sense to just try calling your methods in a try/except block and catch TypeError or ValueError so you know if it really supports the same interfa... | 2 | 2 | 0 | Some Python methods work on various input sources. For example, the XML element tree parse method takes an object which can either be a string, (in which case the API treats it like a filename), or an object that supports the IO interface, like a file object or io.StringIO.
So, obviously the parse method is doing some... | Python 3: Determine if object supports IO | 0 | 0 | 1 | 183 |
5,857,951 | 2011-05-02T13:49:00.000 | 1 | 0 | 1 | 0 | python,interface,python-3.x | 5,858,102 | 3 | false | 0 | 0 | Or should I just forget about checking the interface, and just let a possible AttributeError get handled further up the stack?
The general pythonic principle seems to be doing whatever you want to do with the object you get and just capture any exception it might cause. This is the so-called duck typing. It does not n... | 2 | 2 | 0 | Some Python methods work on various input sources. For example, the XML element tree parse method takes an object which can either be a string, (in which case the API treats it like a filename), or an object that supports the IO interface, like a file object or io.StringIO.
So, obviously the parse method is doing some... | Python 3: Determine if object supports IO | 0.066568 | 0 | 1 | 183 |
5,858,392 | 2011-05-02T14:29:00.000 | 0 | 0 | 0 | 0 | python,django,model-view-controller,qt,hybrid | 5,858,438 | 2 | false | 1 | 0 | You'll still have to run the Django app as a web server, but you can restrict it to serve to only localhost or something. And sure, you can use QtWebKit as the client. | 1 | 14 | 0 | I'm writing a syndication client, with the aim being to have a client for devices, and a web site that has the same functionality. I shall develop the website using Django - this is already decided; the client shall be written in python with both a CLI and a PyQt4 GUI. I have been writing the clinet first, and it's fai... | Using Django minus the web server | 0 | 0 | 0 | 4,303 |
5,858,446 | 2011-05-02T14:34:00.000 | 0 | 0 | 0 | 0 | opencv,python-2.7,iplimage | 5,859,924 | 3 | false | 0 | 1 | This must be an issue with the default codecs. OpenCV uses brute force methods to open video files or capture from camera. It goes by trial and error through all sources/codecs/apis it can find in some reasonable order. (at least 1.1 did so).
That means that on n different systems (or days) you may get n different ways... | 1 | 1 | 1 | I am running Python2.7.1 and OpenCV 2.2 without problems in my WinXP laptop and wrote a tracking program that is working without a glitch. But for some strange reason I cannot get the same program to run in any other computer where I tried to install OpenCV and Python (using the same binaries or appropriate 64 bit bina... | IplImage 'None' error on CaptureFromFile() - Python 2.7.1 and OpenCV 2.2 WinXP | 0 | 0 | 0 | 1,705 |
5,858,460 | 2011-05-02T14:35:00.000 | 2 | 0 | 0 | 0 | python,sockets | 5,858,847 | 1 | true | 0 | 0 | Python simply retries the call and hides the signal from the user (helps with cross-platform consistency where -EINTR doesn't exist). You can safely ignore the EINTR issue but if you'd like to test it anyway, it's easy to do. Just set up a blocking operation that will not return (such as a socket.accept with no incomin... | 1 | 3 | 0 | So far my networking code works fine, but I'm a bit worried about something I hid under the carpet:
The man pages for accept, close, connect, recv and send mention that errno.EINTR can show up when a system call was interrupted by a signal.
I am quite clueless here.
What does python do with that ? Does it automaticall... | What do python sockets do with EINTR? | 1.2 | 0 | 1 | 1,281 |
5,858,877 | 2011-05-02T15:12:00.000 | 3 | 1 | 0 | 1 | python,linux,perl,bash,scripting | 5,858,924 | 8 | false | 0 | 0 | If you want to execute programs installed on the machine, nothing beats bash. You can always make a system call from Perl or Python, but I find it to be a hassle to read return values, etc.
And since you know it will work pretty much anywhere throughout all of of time... | 5 | 31 | 0 | Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting.
The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui... | Is there an advantage to using Bash over Perl or Python? | 0.07486 | 0 | 0 | 26,872 |
5,858,877 | 2011-05-02T15:12:00.000 | 2 | 1 | 0 | 1 | python,linux,perl,bash,scripting | 5,858,956 | 8 | false | 0 | 0 | The advantage of shell scripting is that it's globally present on *ix boxes, and has a relatively stable core set of features you can rely on to run everywhere. With Perl and Python you have to worry about whether they're available and if so what version, as there have been significant syntactical incompatibilities thr... | 5 | 31 | 0 | Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting.
The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui... | Is there an advantage to using Bash over Perl or Python? | 0.049958 | 0 | 0 | 26,872 |
5,858,877 | 2011-05-02T15:12:00.000 | 4 | 1 | 0 | 1 | python,linux,perl,bash,scripting | 5,860,436 | 8 | false | 0 | 0 | For big projects use a language like Perl.
There are a few things you can only do in bash (for example, alter the calling environment (when a script is sourced rather than run). Also, shell scripting is commonplace. It is worthwhile to learn the basics and learn your way around the available docs.
Plus there are time... | 5 | 31 | 0 | Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting.
The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui... | Is there an advantage to using Bash over Perl or Python? | 0.099668 | 0 | 0 | 26,872 |
5,858,877 | 2011-05-02T15:12:00.000 | 10 | 1 | 0 | 1 | python,linux,perl,bash,scripting | 5,860,163 | 8 | false | 0 | 0 | bash isn't a language so much as a command interpreter that's been hacked to death to allow for things that make it look like a scripting language. It's great for the simplest 1-5 line one-off tasks, but things that are dead simple in Perl or Python like array manipulation are horribly ugly in bash. I also find that ba... | 5 | 31 | 0 | Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting.
The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui... | Is there an advantage to using Bash over Perl or Python? | 1 | 0 | 0 | 26,872 |
5,858,877 | 2011-05-02T15:12:00.000 | 4 | 1 | 0 | 1 | python,linux,perl,bash,scripting | 5,858,911 | 8 | false | 0 | 0 | The most important advantage of POSIX shell scripts over Python or Perl scripts is that a POSIX shell is available on virtually every Unix machine. (There are also a few tasks shell scripts happen to be slightly more convenient for, but that's not a major issue.) If the portability is not an issue for you, I don't se... | 5 | 31 | 0 | Hey I've been using Linux for a while and thought it was time to finally dive into shell scripting.
The problem is I've failed to find any significant advantage of using Bash over something like Perl or Python. Are there any performance or power differences between the two? I'd figure Python/Perl would be more well sui... | Is there an advantage to using Bash over Perl or Python? | 0.099668 | 0 | 0 | 26,872 |
5,859,408 | 2011-05-02T16:05:00.000 | 2 | 0 | 1 | 0 | python,scripting,f#,xna,lua | 5,859,526 | 2 | false | 0 | 0 | As you're using .net anyway, any of the .net languages might allow you the easiest implementations. From a learning perspective etc. I'd prefer Lua any time due to it's rather simple basic constructs and syntax rules. | 2 | 3 | 0 | I am evaluating options for a scripting language to embed at my company.
We mostly make indie games, and we use managed frameworks (Unity and XNA). This means that we need a solution that works with both Mono and .Net, and we'd rather avoid stuff that is too slow.
The possibilities we are considering are the following:... | Scripting language choice | 0.197375 | 0 | 0 | 431 |
5,859,408 | 2011-05-02T16:05:00.000 | 1 | 0 | 1 | 0 | python,scripting,f#,xna,lua | 5,859,627 | 2 | false | 0 | 0 | I have a weird-er suggestion for you. How about using C# or VB.NET?
You can dynamically compile scripts and save the assemblies. This way you get minimum loading time.
You can also register them in the GAC and have no worry! | 2 | 3 | 0 | I am evaluating options for a scripting language to embed at my company.
We mostly make indie games, and we use managed frameworks (Unity and XNA). This means that we need a solution that works with both Mono and .Net, and we'd rather avoid stuff that is too slow.
The possibilities we are considering are the following:... | Scripting language choice | 0.099668 | 0 | 0 | 431 |
5,862,238 | 2011-05-02T20:41:00.000 | 6 | 0 | 0 | 1 | python,email,tornado | 7,483,440 | 2 | false | 1 | 0 | I wonder why you would handle registration like that. The usual way to handle registration is:
Write the user info to the database, but with an 'inactive' label attached to the user.
Send an email to the user.
If the user confirms the registration, then switch the user to 'active'.
If you don't want to write to the d... | 1 | 5 | 0 | I'm working with Tornado and MongoDB and I would like to send a confirmation email to the user when he creates an account in my application.
For the moment, I use a simple XHTML page with a form and I send information to my MongoDB database using Tornado. I would like to have an intermediate step which sends an email t... | How can I send a user registration confirmation email using Tornado and MongoDB? | 1 | 1 | 0 | 3,734 |
5,863,516 | 2011-05-02T23:19:00.000 | 5 | 0 | 0 | 0 | python,amazon-s3,multipart,boto | 5,909,965 | 1 | true | 0 | 0 | There is no explicit "upload_part_from_string" method available. You could probably use StringIO to wrap a file-like object around the string and then pass that to "upload_part_from_file" but I haven't tested that.
It would be easy to add this method. At the time I didn't think it would be all that useful since each ... | 1 | 3 | 0 | Is it possible to use the S3 multipart upload with strings instead of a file? The strings i am using are being generated during the upload process and so the size and the exact content is unknown the time the multipart upload starts. | Can you use multipart upload in boto with strings instead of a file handler? | 1.2 | 0 | 1 | 858 |
5,863,897 | 2011-05-03T00:34:00.000 | 2 | 0 | 1 | 0 | python,mpi | 5,870,035 | 1 | true | 0 | 0 | I don't know of a way to hash the package contents beyond hashing a zip archive of the code. But why not create a local package repository. Have the MPI nodes download the latest version of the package and install it (locally or in a virtualenv if you prefer) at the start of the run? You can always check the package ve... | 1 | 4 | 0 | I can have up to 20 machines in my MPI rings. How can I automate some sort of checking that all machines are using the same version of their python code? Is there a way to generate a hash of all the modules/source files in your program? | Ensure all code on all machines are the same - python mpi | 1.2 | 0 | 0 | 90 |
5,865,349 | 2011-05-03T05:19:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine | 5,872,643 | 5 | false | 1 | 0 | No. Writing an application that deploys other applications is in violation of the terms of service.
Note we don't have any 'hard' limits - those limits that aren't billing enabled can be increased on application to us if you provide a reasonable use-case. | 3 | 0 | 0 | I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space? | Deploying an app to users' appspot | 0 | 0 | 0 | 193 |
5,865,349 | 2011-05-03T05:19:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 5,870,645 | 5 | true | 1 | 0 | Yes, absolutely.
You just need to have each client create an App Engine account with an application to which you have administrator access. You can adjust the settings on the application to forbid downloads of your code by the other administrators if that's appropriate for your agreement with the client. This also allo... | 3 | 0 | 0 | I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space? | Deploying an app to users' appspot | 1.2 | 0 | 0 | 193 |
5,865,349 | 2011-05-03T05:19:00.000 | 1 | 0 | 0 | 1 | python,google-app-engine | 5,865,451 | 5 | false | 1 | 0 | No, you cannot do that. The app is hosted and run in the administrator's account which would be you. What you can do is, release the source code and point your users do install it in their appspot account, just like creating a new application. | 3 | 0 | 0 | I am working on a Python App, which runs on App Engine. Is there a way I can publish the app on each customers' appSpot account, so that the App uses the users' cloud storage? Instead of running the App on my AppSpot account and all the users storing the data on my Cloud space? | Deploying an app to users' appspot | 0.039979 | 0 | 0 | 193 |
5,866,496 | 2011-05-03T07:36:00.000 | 2 | 0 | 0 | 0 | python,selenium-rc | 5,871,749 | 1 | true | 0 | 0 | Your second XPath expression is wrong. Programmers trained in C-style languages frequently make this mistake, because they see [...] and think "index into an array", but that's not what brackets do in XPath.
If you use sel.get_xpath_count(something), then you need to use sel.get_text("xpath=(something)[item_number]").... | 1 | 1 | 0 | I am a newbie to Selenium and is implementing selenium-rc with Python client library. I tried traversing through my page's div using xpath(s) elements using the command "sel.get_xpath_count(xpath)".
It gives a count of 20, but when I iterate through every div using for statement and command "sel.get_text(xpath='%s[%d]'... | Selenium-rc Python client : Not able to iterate through the xpath? | 1.2 | 0 | 1 | 396 |
5,867,762 | 2011-05-03T09:47:00.000 | 2 | 0 | 0 | 1 | python | 5,867,954 | 1 | false | 0 | 0 | I have a example.py file. loaded on a linux server.
Many linux servers including Apache and Nginx load the files they need to serve when they start for performance sake. So, you may need to restart the server to pickup the latest python file. | 1 | 0 | 0 | I have a example.py file. loaded on a linux server. I put some prints in this file and saved it.
When I call this .py file I am not getting these changes.
Do I need to do something (Like for C we need to compile the .c file and put the .so to LD_LIBRARY_PATH) for python also.
Thanks, | Python changes are not reflected | 0.379949 | 0 | 0 | 900 |
5,869,514 | 2011-05-03T12:35:00.000 | 0 | 0 | 0 | 0 | python,sqlalchemy,identity-map | 5,869,588 | 2 | false | 1 | 0 | So this all depends on how you setup your sqlalchemy connection. Normally what you do is to manage each wsgi request to have it's own threadlocal session. This session will know about all of the goings-on of it, items added/changed/etc. However, each thread is not aware of the others. In this way the loading/preconfigu... | 1 | 6 | 0 | The identity map and unit of work patterns are part of the reasons sqlalchemy is much more attractive than django.db. However, I am not sure how the identity map would work, or if it works when an application is configured as wsgi and the orm is accessed directly through api calls, instead of a shared service. I would ... | sqlalchemy identity map question | 0 | 1 | 0 | 2,298 |
5,869,650 | 2011-05-03T12:47:00.000 | 9 | 0 | 1 | 0 | python,regex | 5,869,740 | 5 | true | 0 | 0 | Yes, it's a bug (or at least a misfeature). It's complaining that if a* matches nothing, it doesn't know how to capture 0 or more "nothings". | 3 | 9 | 0 | I've discovered something that I can't explain in Python re module.
Compilation of (a*)* or (a*|b)* throws an error:
raise error, v # invalid expression
sre_constants.error: nothing to repeat
I've tested this regexp in javascript and it seems to be ok.
Is it a bug? | Python regex strange behavior | 1.2 | 0 | 0 | 4,820 |
5,869,650 | 2011-05-03T12:47:00.000 | 5 | 0 | 1 | 0 | python,regex | 5,869,764 | 5 | false | 0 | 0 | a* can be null, giving (null)* which makes no sense to the interpreter. (a*|b) can also be null as it can evaluate to either (b) or (a*).you could use (a+)* and therefore (a+|b)* | 3 | 9 | 0 | I've discovered something that I can't explain in Python re module.
Compilation of (a*)* or (a*|b)* throws an error:
raise error, v # invalid expression
sre_constants.error: nothing to repeat
I've tested this regexp in javascript and it seems to be ok.
Is it a bug? | Python regex strange behavior | 0.197375 | 0 | 0 | 4,820 |
5,869,650 | 2011-05-03T12:47:00.000 | 1 | 0 | 1 | 0 | python,regex | 6,347,678 | 5 | false | 0 | 0 | There is actually an important reason for Python to reject (a*)*, and (a*|b)*. Since * is greedy, it matches the longest string it can. The problem is that if the regex modified by * is empty, then the regular expression parser tries to match as many repetitions of empty string as possible. This means that it would ma... | 3 | 9 | 0 | I've discovered something that I can't explain in Python re module.
Compilation of (a*)* or (a*|b)* throws an error:
raise error, v # invalid expression
sre_constants.error: nothing to repeat
I've tested this regexp in javascript and it seems to be ok.
Is it a bug? | Python regex strange behavior | 0.039979 | 0 | 0 | 4,820 |
5,869,899 | 2011-05-03T13:07:00.000 | 11 | 0 | 0 | 0 | python,web-frameworks,flask,django-class-based-views | 5,870,277 | 1 | true | 1 | 0 | Starting with Python 2.6 you can apply the decorators to classes as well. There is no builtin pattern for callable classes because there are too many ways to implement them, but essentially the trick would be to override __call__ on the class and to have a wrapper decorator that instanciates the class.
I was planning ... | 1 | 5 | 0 | What's the best way to write generic views using the Flask web framework?
Does the @app.route decorator support callable classes? Or am I thinking about this in entirely the wrong fashion?
Any help or advice would be greatly appreciated! | Class-based (generic) views in Flask | 1.2 | 0 | 0 | 2,127 |
5,875,798 | 2011-05-03T21:15:00.000 | 0 | 0 | 0 | 1 | python,command-line,terminal | 5,875,841 | 5 | false | 0 | 0 | Have a look at the Python package under Applications. There is a shell script there called Update Shell Profile.command
Run this and it should set your path up properly.
Unless you mark you script as executable with chmod +x, you'll need to run python over it first. e.g. `python myscript.py' | 4 | 1 | 0 | I have installed the new python release and would like to run .py files from the terminal.
How is this done from the terminal? I dont want to include the path in each command to run a .py file. | Running python from the mac terminal | 0 | 0 | 0 | 9,446 |
5,875,798 | 2011-05-03T21:15:00.000 | 0 | 0 | 0 | 1 | python,command-line,terminal | 5,876,379 | 5 | false | 0 | 0 | I installed all of my python through macports, which has pros and cons. One of the benefits is that you don't have to worry about stuff like this, it just works. You can install python 2.6 and python 2.7 (and others), and then use the python_select utility to set up which python is run when you call "python blah.py" | 4 | 1 | 0 | I have installed the new python release and would like to run .py files from the terminal.
How is this done from the terminal? I dont want to include the path in each command to run a .py file. | Running python from the mac terminal | 0 | 0 | 0 | 9,446 |
5,875,798 | 2011-05-03T21:15:00.000 | 0 | 0 | 0 | 1 | python,command-line,terminal | 36,117,645 | 5 | false | 0 | 0 | if you add a shebang at the start of the python file then you can run a python file by just its name from terminal
add #!/usr/bin/python
for mac(others add your respective path for python)
at the top of your python program and from your terminal you can run it just by filename(if it has executable permissions). | 4 | 1 | 0 | I have installed the new python release and would like to run .py files from the terminal.
How is this done from the terminal? I dont want to include the path in each command to run a .py file. | Running python from the mac terminal | 0 | 0 | 0 | 9,446 |
5,875,798 | 2011-05-03T21:15:00.000 | 0 | 0 | 0 | 1 | python,command-line,terminal | 36,117,693 | 5 | false | 0 | 0 | Since you have installed a working python, the easiest way to run python files from the terminal is to cd your terminal to the directory where the file is located and then just type python my_code.py in the terminal. | 4 | 1 | 0 | I have installed the new python release and would like to run .py files from the terminal.
How is this done from the terminal? I dont want to include the path in each command to run a .py file. | Running python from the mac terminal | 0 | 0 | 0 | 9,446 |
5,875,881 | 2011-05-03T21:24:00.000 | 0 | 0 | 0 | 0 | python,google-app-engine | 10,265,451 | 3 | false | 1 | 0 | Note that there is no gain of performance in using Drew's schema, because queries in list properties must check for equality against all the elements of the list. | 1 | 3 | 0 | I have a data model called Game.
In the Game model, I have two properties called player1 and player2 which are their names.
I want to find a player in gamebut I don't know how to buil the query because gql does not support OR clause and then I can't use select * from Game where player1 = 'tom' or player2 = 'tom' statem... | Google app engine gql query two properties with same string | 0 | 1 | 0 | 631 |
5,876,909 | 2011-05-03T23:31:00.000 | 0 | 1 | 0 | 0 | python,netbeans,ide,keyboard-shortcuts | 5,876,927 | 1 | true | 0 | 0 | Which version of NetBeans are you using?
I just tried it in NetBeans 6.9 and it works perfectly in Python source
(I presume you have Python plugin installed )
Version: 0.105 Source: NetBeans Beta
Plugin Description
Python support: editing, refactoring, hints, etc. | 1 | 1 | 0 | In netbeans the toggle comments shortcut is control + /, which works well for php and ruby but for python it simply does nothing, can someone help? | Toggle comment shortcut in netbeans python? | 1.2 | 0 | 0 | 1,001 |
5,877,621 | 2011-05-04T01:50:00.000 | 0 | 1 | 0 | 1 | php,python,iis | 5,877,854 | 2 | false | 0 | 0 | Is there a way that PHP can execute a python script (stored on Machine A) that is then ran locally (on Machine B)
Never. The browsers forbid this kind of security hole. | 2 | 0 | 0 | I have a webserver running IIS (Machine A) that is running PHP for me. When a user points their browser to a web page that is hosted on the webserver with a PHP script on it, they need to populate a few forms, and then hit a button that will then run the PHP script, which will fire off a python script I've already buil... | Execute a python script stored on a server/network location on a user's local machine using PHP | 0 | 0 | 0 | 937 |
5,877,621 | 2011-05-04T01:50:00.000 | 1 | 1 | 0 | 1 | php,python,iis | 5,877,648 | 2 | false | 0 | 0 | The question is not exactly clear, but from my understanding, you're trying to execute code on the local user's machine and you can't do that via Python.
Your best bet is to write JavaScript that will do the job for you (a few browsers only as you're working with local storage due to HTML5), or you can have your user u... | 2 | 0 | 0 | I have a webserver running IIS (Machine A) that is running PHP for me. When a user points their browser to a web page that is hosted on the webserver with a PHP script on it, they need to populate a few forms, and then hit a button that will then run the PHP script, which will fire off a python script I've already buil... | Execute a python script stored on a server/network location on a user's local machine using PHP | 0.099668 | 0 | 0 | 937 |
5,877,658 | 2011-05-04T01:56:00.000 | 9 | 0 | 0 | 1 | python,django,multithreading | 5,877,718 | 2 | true | 1 | 0 | Offloading the work to some other external process is really the right thing to do, and once you've done it, it's not likely to be the last time you do it. Celery/RabbitMQ is a decent solution, and the nice thing is they're already there. Recent RabbitMQ releases have a decent web-based management app and a decent mana... | 1 | 5 | 0 | I have a django site. Certain actions by the end user send email to the rest of users in a group.
When the number of users gets to be > 20 it can add 1-3 seconds to the request cycle, which I don't like. I'd like to be able to send the email from a non-blocking function.
I know RabbitMQ and Celery in conjunction ca... | Django non blocking email? Downsides to threading.thread or subprocess? | 1.2 | 0 | 0 | 1,266 |
5,879,869 | 2011-05-04T07:17:00.000 | 5 | 1 | 0 | 1 | python,macos,terminal | 5,879,906 | 3 | false | 0 | 0 | Try ./script.py instead of script.py ... or ensure your current directory is in your path and script.py should work.... | 1 | 12 | 0 | How can I run a python script in Terminal on Mac without using the "python" keyword, without having to edit my existing python files?
Right now I have to do this:
python script.py
What I like to do is this:
script.py | Run python script without the "python" keyword | 0.321513 | 0 | 0 | 8,958 |
5,880,438 | 2011-05-04T08:10:00.000 | 4 | 0 | 0 | 0 | python | 5,880,853 | 2 | false | 1 | 0 | This architecture really makes no sense. You're using Django, a full-stack web framework, for the front end, but not using it for the database. And you're using Pyramid, another full-stack web framework, for the web service side, thus ensuring that you duplicate all the business logic.
Much as I am an advocate of Djang... | 2 | 0 | 0 | I need to create web application, which can be reached by user as regular web site and as XML-RPC web service. Also web site should have mobile version. I'm planning to use next technologies:
Django (for web frontends (regular and mobile)).
Pyramid (for web service).
SQLAlchemy, Memcached (for persistence level)
Late... | Multi tier architecture implementation on Python | 0.379949 | 0 | 0 | 3,223 |
5,880,438 | 2011-05-04T08:10:00.000 | 0 | 0 | 0 | 0 | python | 5,880,567 | 2 | false | 1 | 0 | You should checkout the Turbogears framework as it is composed of several popular components: ORM with sqlalchemy, pylons for logic and support for WSGI, permits support for several templating engines for the frontend... endless.
I use it for several web-services behind AJAX-enabled front-ends (like Flex-based apps, am... | 2 | 0 | 0 | I need to create web application, which can be reached by user as regular web site and as XML-RPC web service. Also web site should have mobile version. I'm planning to use next technologies:
Django (for web frontends (regular and mobile)).
Pyramid (for web service).
SQLAlchemy, Memcached (for persistence level)
Late... | Multi tier architecture implementation on Python | 0 | 0 | 0 | 3,223 |
5,880,867 | 2011-05-04T08:49:00.000 | 1 | 0 | 0 | 1 | python,parallel-processing,celery | 5,882,479 | 1 | true | 0 | 0 | Giving an example is difficult as messaging is a bit complex, but what you can do basically is:
rewrite your program to be a task or write a task that calls your program using subprocess
configure celery to have 10 workers
execute as many tasks as you need to get your job done, Celery will add them to its queue
Celery... | 1 | 0 | 0 | lets say i have a python programm whitch i want to run always max 10 times in parallel using celery / rabbigmq and if some of the process finish i want to know about it so i can start a new process. how can i do so? some examples would be nice | python create celery task job | 1.2 | 0 | 0 | 485 |
5,881,873 | 2011-05-04T10:20:00.000 | 1 | 0 | 1 | 0 | python,inheritance | 5,881,961 | 4 | false | 0 | 0 | You have to walk through all objects in the global namespace (globals()) and check if the related object/class is a subclass of the some other class (check the Python docs for issubclass()). | 1 | 52 | 0 | Is there any way in python to query a namespace for classes which inherit from a particular class? Given a class widget I'd like to be able to call something like inheritors(widget) to get a list of all my different kinds of widget. | Python: find all classes which inherit from this one? | 0.049958 | 0 | 0 | 44,446 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.