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
14,436,912
2013-01-21T10:43:00.000
4
1
1
0
python,pip,setuptools,distutils,distribute
14,437,754
1
true
0
0
Some things that you might want to include in the source distribution but maybe not install include: the package's license a test suite the documentation (possibly a processed form like HTML in addition to the source) possibly any additional scripts used to build the source distribution Quite often this will be the m...
1
5
0
I'm developing a distribution for the Python package I'm writing so I can post it on PyPI. It's my first time working with distutils, setuptools, distribute, pip, setup.py and all that and I'm struggling a bit with a learning curve that's quite a bit steeper than I anticipated :) I was having a little trouble getting s...
What are the use cases for a Python distribution?
1.2
0
0
476
14,437,549
2013-01-21T11:21:00.000
2
0
0
0
python,qt,pyqt,qcombobox
14,437,632
1
true
0
1
You can use void QComboBox::setCompleter(QCompleter *completer)
1
0
0
I'm using the QComboBox to let the user select a very large quantity of choices. For the moment the user can type a character and the QComboBox selects the first row with this character, but I feel that it's just not enough. Is there any thing already done for the user to search directly the item by entering a text? Th...
Quick find item with QComboBox in Qt
1.2
0
0
568
14,439,001
2013-01-21T12:48:00.000
0
0
0
0
python,python-2.7,tkinter
14,441,255
1
false
0
1
You cannot call Tkinter commands from any thread other than the main thread. Tkinter is not thread safe.
1
0
0
I need some help, I am coding a Zip password Cracker.I am trying to create a gui interface for my cracker. I want to show a message box for right password if founded in password file.. But, showinfo message box is not executing after clicking on crack button, while if i am printing password using print it is working.....
Python-Help in Tkinter
0
0
0
150
14,441,086
2013-01-21T14:47:00.000
0
0
1
0
python,api
14,441,199
2
false
0
0
The process is mostly like this: 1) You write a new library (the wrapper) 2) This library depends on the existing library (the one you are going to wrap) 3) The wrapper will call the underlying library, offering a different API than the orignal library Usually you want to do this because the orignal library has not dev...
1
0
0
How to write a python helper API to wrap existing python library. I have never written anything like this or may be written but not realized it. Can someone tell me what exactly it is and how to do it ?
Understanding what is API wrapper around existing library
0
0
0
159
14,441,670
2013-01-21T15:17:00.000
2
0
0
0
python,python-3.x,gtk,gtk3,pygobject
14,460,308
1
true
0
0
I have found the way to do this: Return boolean True from the method which handles the key-press-event. Any value that doesn't evaluate to true passes control back to Gtk. In the particular way I implement this editor, the key-press-event signal of the toplevel vindow is connected to the method __key_event_handler, whi...
1
2
0
I'm writing a source code editor, and I want to disable any of the pre-defined keystrokes, e.g Ctrl-V for paste, how can I do that?
How to disable all default keystrokes on Gtk
1.2
0
0
383
14,442,636
2013-01-21T16:09:00.000
6
0
0
0
python,selenium-webdriver
18,076,075
6
false
1
0
I'm using driver.find_element_by_name("< check_box_name >").is_selected()
1
40
0
I've been searching a week how check if a checkbox is checked in Selenium WebDriver with Python, but I find only algorithms from JAVA. I've read the WebDriver docs and it doesn't have an answer for that. Anyone have a solution?
How can I check if a checkbox is checked in Selenium Python WebDriver?
1
0
1
62,290
14,444,015
2013-01-21T17:26:00.000
4
0
0
1
python,celery,amqp
14,453,045
1
true
0
0
I'm going to make the assumption that by 'task' you mean 'worker'. The question would make little sense otherwise. For some context it's important to understand the process hierarchy of Celery worker pools. A worker pool is a group of worker processes (or threads) that share the same configuration (process messages o...
1
2
0
A pretty straightforward question, maybe - I often see a celery task process running on my system that I cannot find when I use celery.task.control.inspect()'s active() method. Often this process will be running for hours, and I worry that it's a zombie of some sort. Usually it's using up a lot of memory, too. Is ther...
Python Celery - lookup task by pid
1.2
0
0
2,103
14,446,488
2013-01-21T20:16:00.000
0
0
0
0
python,image,user-interface
14,446,771
1
false
0
1
Personally I use os.system("xv foo.png &"), or any small image viewer. Depending on the details, you may also do g = os.popen("xv - &", "w") and write the image data to the file g. Again depending on the details, I sometimes make my program a web server (a few dozen lines of code, e.g. with Twisted), serve images fro...
1
1
0
I'd like a Python-accessible function show_image(...) that launches a fairly simple image viewer, where the image is specified as (for example) a NumPy array. Importantly, I'd like for this function not to block, but for the script to continue execution while maintaining interactivity of the window. I realize that the ...
Non-blocking image viewer function from Python?
0
0
0
864
14,455,327
2013-01-22T09:32:00.000
1
0
1
0
python,pip,setuptools,pypi
14,455,488
2
true
0
0
If you build no C-extensions, just ship the source tarball in tar.gz format. It can be installed on all platforms. A binary egg (installable by easy_install, not pip) is only neccessary if you build C-extensions and your software runs on Windows as people seldomly have a C-compiler on their machine.
1
2
0
I'm preparing my first package distribution for PyPI using setuptools etc. I've gotten the source distribution (.tar.gz) working well and now I'm wondering whether I should provide any other formats, like .zip and .egg. On a random walk through PyPI I noticed some projects that provided eggs for different Python versio...
Should I prepare eggs and zip in addition to tarball for PyPI?
1.2
0
0
113
14,455,871
2013-01-22T10:02:00.000
1
0
0
0
python,qt,pyqt,pyqt4,pyside
14,540,595
2
false
0
1
You could use a proxy model that takes gets it's data from two models, one for your default values, the other for your database, and use it to populate your QComboBox.
1
1
0
I have populated a combobox with an QSqlQueryModel. It's all working fine as it is, but I would like to add an extra item to the combobox that could say "ALL_RECORDS". This way I could use the combobox as a filtering device. I obviously don't want to add this extra item in the database, how can I add it to the combobo...
Adding an item to an already populated combobox
0.099668
1
0
243
14,456,251
2013-01-22T10:21:00.000
1
0
1
0
python,case-insensitive
14,456,290
9
false
0
0
Try converting string into any common(lower or upper) case and then compare
1
1
0
I need to match the following string File system full. The problem is Starting F can be lowercase or capital. How can I do this in Python when string comparisons are usually case-sensitive?
String comparison in Python that is case-insensitive for first letter
0.022219
0
0
8,483
14,459,821
2013-01-22T13:34:00.000
1
0
1
0
python,numbers,digits
14,460,639
5
false
0
0
Any solution that has you trying all permutations of digits will be horribly inefficient, running in O(n!). Just 14 digits (and the multiply operator) would give around 1 trillion combinations! An O(n lg n) solution would be: Sort the digits from high to low. Concatenate them into one string. Print the string. If y...
1
0
0
I want to know what is the biggest number you can make from multiplying digits entered by the user like this: 5*6*7*2 OR 567*2 OR 67*25 ...etc so 5/6/7/2 should be entered by the user as variables, but how do I tell python to form a number from two variables (putting the two digits next to each other and treating the o...
A number out of digits
0.039979
0
0
221
14,466,147
2013-01-22T19:09:00.000
6
0
1
0
python
14,466,204
2
true
0
0
If the functions are completely stateless, a module with functions would work just fine and is simpler. If, one the other hand, there is state involved, it is usually better to encapsulate that state in a class, and provide the functionality through member functions.
2
3
0
In my code either of the above two options would work equally well but I am interested in finding out the pros and cons of both approaches.
In python, is it considered better to define a module with functions or a module with a class that contains functions?
1.2
0
0
127
14,466,147
2013-01-22T19:09:00.000
1
0
1
0
python
14,466,741
2
false
0
0
First of all, every thing in python is an object, so, there is no considerable difference in terms of performance of using functions over classes or vice versa. If you are a beginner, then I would recommend using module with functions, as it's easier and more straight forward. The down side of this technique is that y...
2
3
0
In my code either of the above two options would work equally well but I am interested in finding out the pros and cons of both approaches.
In python, is it considered better to define a module with functions or a module with a class that contains functions?
0.099668
0
0
127
14,466,695
2013-01-22T19:41:00.000
2
0
1
0
python,class,rest,attributes
14,466,768
2
true
0
0
disclaimer: I know nothing about REST ... That said, I would typically be a little hesitant to add attributes to an object willy-nilly for the following reasons: You might accidentally replace some data that you don't want to replace due to a namespace clash dictionaries are easier to inspect rather than having to g...
1
0
0
I'm creating a Python class as an API to objects managed remotely via REST. The REST API includes a call that returns a list of dictionaries that define properties of the remote objects. I'm in the process of writing code to dynamically add these properties as attributes of the corresponding Python objects (ie: when t...
When is it appropriate to dynamically add attributes to a Python object?
1.2
0
1
191
14,468,078
2013-01-22T21:11:00.000
0
0
1
0
python,nlp,gensim
35,618,939
2
false
0
0
I was also struggling with the same case. To overcome i first stammed documents using NLTK and later processed it with gensim. Probably it can be a easier and handy way to perform your task.
1
2
1
I am using Gensim python toolkit to build tf-idf model for documents. So I need to create a dictionary for all documents first. However, I found Gensim does not use stemming before creating the dictionary and corpus. Am I right ?
Is stemming used when gensim creates a dictionary for tf-idf model?
0
0
0
940
14,469,941
2013-01-22T23:29:00.000
0
1
1
0
python,audio,dsl,supercollider
16,253,793
3
false
0
0
I'm not 100% sure what you want to do, but as an additional suggestion I would put forth: Spear with scripting in Common Lisp. If what you are doing involves a great deal of spectral analysis, then you can do the heavy Lifting in Spear, and script all of this using Common List with Common Music. Spear has some great to...
2
0
0
I want to write some code to do acoustic analysis and I'm trying to determine the proper tool(s) for the job. I would normally write something like this in Python using numpy and scipy and possibly Cython for the analysis part. I've discovered that the world of Python audio libraries is a bit chaotic, with scads of ver...
Audio Domain Specific Language vs Python
0
0
0
519
14,469,941
2013-01-22T23:29:00.000
4
1
1
0
python,audio,dsl,supercollider
14,707,108
3
false
0
0
I've got a lot of experience with SuperCollider and Python (with and without Numpy). I do a lot of audio analysis, and I'm afraid the answer depends on what you want to do. If you want to create systems that will input OR output audio in real time, then Python is not a good choice. The audio I/O libraries (as you say)...
2
0
0
I want to write some code to do acoustic analysis and I'm trying to determine the proper tool(s) for the job. I would normally write something like this in Python using numpy and scipy and possibly Cython for the analysis part. I've discovered that the world of Python audio libraries is a bit chaotic, with scads of ver...
Audio Domain Specific Language vs Python
0.26052
0
0
519
14,470,000
2013-01-22T23:34:00.000
2
0
0
1
python,asynchronous,network-programming,twisted
14,470,835
1
true
0
0
No. The tasks are not run in different threads; one might say that's the whole point of using Twisted in the first place. You are intended to be able to pass references to your protocol objects wherever you need them.
1
1
0
If I create a looping task using twisted.internet.task.LoopingCall, how can that task safely access a client's twisted connection and send data it collects? Are the tasks run in separate threads meaning it might not be safe to send data from the task itself? Can I pass the task a reference to the client (instance of ...
How do I make a twisted task send data down a cilent's connection?
1.2
0
0
96
14,478,041
2013-01-23T10:59:00.000
0
0
1
0
python,raspberry-pi
14,481,001
2
false
0
0
maybe git hooks will suite well? I'm using it for some sort of continuous integration on my home server.
1
4
0
I'd like to know if it is possible to have the interpreter of Python installed in one computer and having an IDE "linked" to that interpreter in other one, i.e.: I want to program some scripts for my Raspberry Pi, but it is too slow if using X Window, and too tedious if doing the work in "command line" mode (open nano,...
Python: IDE in one computer, interpreter in other
0
0
0
3,278
14,478,392
2013-01-23T11:16:00.000
0
0
0
0
python,google-app-engine,oauth,imap,two-legged
14,495,175
2
false
0
0
try: .. catch:.. logic can be used to handle such exceptions. As Google has retired OAuth1.0, its recommended to use OAuth2.0 instead of OAUth1.
1
1
0
I am Google Apps administrator and using xoauth.py and IMAP to download users mails without users password. But this process gets stopped after 1 hour. I searched many blogs and I came to know this token expires after 1 hour. Can anyone tell me how to extend that expiration time to Never, or how to refresh this token?
xoauth.py IMAP token expires after 1 hour
0
0
0
326
14,478,615
2013-01-23T11:28:00.000
2
0
1
0
python,vim
14,479,445
4
false
0
0
It's not the best solution for your problem but for one file you can reindent the whole file (if you configured the indentation rules to match your taste): Shift+V Shift+G =
1
2
0
I want to change the indentation in all my existing(!) Python files from 2-space to 4-space shift width. Any suggestions how to do this in Vim?
How to a posteriori double the indentation levels on all lines of a file in Vim?
0.099668
0
0
207
14,486,696
2013-01-23T18:25:00.000
2
0
0
1
python,daemon,celery
14,514,760
2
false
0
0
Run the Celery daemons under a supervisor, such as supervisord. When the celeryd process dies, the supervisor will spin it back up.
1
2
0
In Celery, the only way to conclusively reload modules is to restart all of your celery processes. I know how to remotely shutdown workers (broadcast('shutdown', destination = [<workers>])), but not how to bring them back up. I have a piece of Python code that works to create a daemon process with a new worker in it...
Using a celery task to create a new process
0.197375
0
0
2,089
14,490,753
2013-01-23T22:42:00.000
0
0
0
0
python,popup,screen,draw
15,838,631
2
false
0
1
I am using wxPython and looking for a way to have a popup message. Now I am using a popupmenu in which I append each item of the menu with one line of the message.
1
0
0
I'm writing a program and I need to inform the user about some changes with a popup message, but not a popup window. Something like the rectangle informing about new message in Kadu - no window, just a bitmap drawn directly on the screen for a few seconds. I wonder if there is a simple way to do that with win32 packag...
Python - popup message drawn on the screen
0
0
0
1,969
14,491,092
2013-01-23T23:07:00.000
4
0
0
0
python,canvas,tkinter
14,500,936
2
false
0
1
There is no way to color a pixel other than to create a 1x1 pixel object of some sort. And yes, at some point you will experience performance problems. The canvas simply wasn't designed to be used this way. If you're really needing to create a large area in which you can manage individual pixels, you can create a canv...
2
1
0
Someone know if it's possible to change the color of a pixel in a canvas without using un object, so without using something like canvas.create_oval or canvas.create_rectangle ?
Change the color of a pixel in a canvas, Tkinter, Python
0.379949
0
0
3,101
14,491,092
2013-01-23T23:07:00.000
0
0
0
0
python,canvas,tkinter
14,491,248
2
true
0
1
Within tkinter itself, it's impossible. Even if you manage to change a pixel on canvas window (which is possible with X11 and Windows APIs in a platform-dependent way), you'd have to ensure it's repainted properly. You can, of course, place a frame of size 1x1 over the canvas, with a background color you want. This way...
2
1
0
Someone know if it's possible to change the color of a pixel in a canvas without using un object, so without using something like canvas.create_oval or canvas.create_rectangle ?
Change the color of a pixel in a canvas, Tkinter, Python
1.2
0
0
3,101
14,491,542
2013-01-23T23:48:00.000
0
0
1
0
python,random,python-3.x
71,036,269
4
false
0
0
Note: The function time.clock() has been removed, after having been deprecated since Python 3.3: use time.perf_counter() or time.process_time() instead, depending on your requirements, to have well-defined behavior. (Contributed by Matthias Bussonnier in bpo-36895.)
2
1
0
I did some research before posting but seem to be at a lost (not too experienced in coding). I am attempting to generate or compute a random number for certain time interval with Python. I'm not looking for full code, I want help using the time library if that is the correct one to use. Pseudo-code: Allow python [PC] ...
Compute random number over certain time interval with Python
0
0
0
8,486
14,491,542
2013-01-23T23:48:00.000
0
0
1
0
python,random,python-3.x
14,504,070
4
false
0
0
If you want to take 3 seconds to get a random number, because you're concerned about the quality of the random number, you can use os.urandom() to generate the value. If all you really want to do is to select an item from your list at random, you can use random.choice()
2
1
0
I did some research before posting but seem to be at a lost (not too experienced in coding). I am attempting to generate or compute a random number for certain time interval with Python. I'm not looking for full code, I want help using the time library if that is the correct one to use. Pseudo-code: Allow python [PC] ...
Compute random number over certain time interval with Python
0
0
0
8,486
14,493,073
2013-01-24T02:44:00.000
0
0
1
0
python,sorting,built-in
14,493,224
2
false
0
0
You have just described the exact behavior of the list.sort() method, so once you have the tuples in a list, simply call the list's sort method (l.sort) with no arguments and it will be put in the desired order. When more complex sorts are required you can pass a "key function" as a named argument, key. The function is...
1
0
0
I want to make a custom sort for my Python code that uses the built in sort() function, but can sort a list based on two values. The list I want sorted is structured as a list of tuples, which each contain 2 integers. What I want to sort to do is sort the list of tuples based on each of their first integers, but if two...
Custom Python Sort: Double Precedence
0
0
0
149
14,496,006
2013-01-24T07:29:00.000
6
0
1
0
python,string,parsing
35,844,166
7
false
0
0
A one liner would be : str=str[::-1].replace(".",".-",1)[::-1]
1
107
0
So I have a long list of strings in the same format, and I want to find the last "." character in each one, and replace it with ". - ". I've tried using rfind, but I can't seem to utilize it properly to do this.
Finding last occurrence of substring in string, replacing that
1
0
0
141,346
14,499,893
2013-01-24T11:09:00.000
1
0
0
0
python,linux,amazon-web-services,debian
14,500,253
2
false
1
0
Assuming Server #1 is running a script through cron, then there should be no reason you can't just use ssh to remotely change Server #2. I believe if you use the elastic-ip addresses it might not count as bandwidth usage. Barring that, I'd use SNS. The model would instead be something like: Server #1 notifies Server...
1
2
0
I have two servers. Basically Server #1 runs a script throughout the day and when its done I need to send a notification to Server #2 to get it to run some other scripts. I am currently leaning on Amazon AWS tools and using Python so I was wondering if someone could recommend a simple, secure and easy to program way of...
Communicate between two servers - Amazon SQS / SNS?
0.099668
0
1
479
14,500,185
2013-01-24T11:24:00.000
0
0
1
0
python,macos,installation,py2app,dmg
14,504,112
1
true
1
0
I believe what you are looking for is to add: #!/usr/bin/python to the first line of your code will allow your friend to just double click on the file and it should open. Just as a warning osx does not tell us what version and as such what version of python and what standard libraries are going to be present. Also, jus...
1
1
0
I have developed an application for a friend. Aplication is not that complex, involves only two .py files, main.py and main_web.py, main being the application code, and _web being the web interface for it. As the web was done later, it's kept in this format, I know it can be done with one app but not to complicate it t...
Make a Python app package/install for Mac
1.2
0
0
1,071
14,500,656
2013-01-24T11:47:00.000
-1
0
0
0
python,audio,audio-streaming
14,503,589
1
true
0
0
All sound you "hear" on your pc has to run through your soundcard, Maybe somehow write a script that "records" the sounds runnning through the device. Maybe u can use Pymedia module?
1
1
0
I am using Python, and I want to analyze audio files from internet streaming media (for example Youtube, Soundcloud, etc.) Is there a universal way to do so? There is a pre-loading for every music or video, there must be a way to access it? How? I want to run this script on an external server, that might be relevant to...
Cross-platform audio import from different sources
1.2
0
1
65
14,503,078
2013-01-24T13:58:00.000
1
0
0
0
python,web-crawler
14,503,228
6
false
1
0
if you are using google chrome, you can check the url which is dynamically being called in network->headers of the developer tools so based on that you can identify whether it is a GET or POST request. If it is a GET request you can find the parameters straight away from the url. If it is a POST request you can find ...
1
3
0
I want to crawl a website having multiple pages and when a page number is clicked it is dynamically loaded.How to screen scrape it? i.e as the url is not present as href or a how to crawl to other pages? Would be greatful if someone helped me on this. PS:URL remains the same when different page is clicked.
How to crawl a web site where page navigation involves dynamic loading
0.033321
0
1
4,658
14,503,387
2013-01-24T14:15:00.000
2
0
0
0
python,flask
14,527,032
1
false
1
0
It's hard to answer a question like this, because it is so general. First, your Blueprint needs to be implemented in a way that makes no assumptions about the state of the app object it will be registered with. Second, you'll want to use a configurable url scheme to prevent route conflicts. There are far more nuanced ...
1
3
0
The Flask documentation says : that you can register blueprints multiple times though not every blueprint might respond properly to that. In fact it depends on how the blueprint is implemented if it can be mounted more than once. But I can't seem to find out what must be done to mount a blueprint safely more than onc...
Implementing a Flask blueprint so that it can be safely mounted more than once?
0.379949
0
0
636
14,503,973
2013-01-24T14:44:00.000
1
0
1
0
python,global-variables,global,pylint
14,504,480
4
false
0
0
In python, a module sharing global data like this is pretty much a singleton. you could accomplish the same thing with a singleton class, or ask yourself whether there is any reason you actually need a singleton. If you don't need a singleton -- use a regular class (instance). If you do need a singleton, google/sear...
1
33
0
Pylint W0603 states: Using the global statement. Used when you use the "global" statement to update a global variable. PyLint just try to discourage this usage. That doesn't mean you can not use it ! I wonder why is it so? Is there any more Pythonic way of modifying immutable, module-wide variables inside a funct...
Python global keyword vs. Pylint W0603
0.049958
0
0
26,931
14,504,437
2013-01-24T15:05:00.000
0
0
0
0
python,web,python-2.7
14,508,350
1
false
0
0
The easiest way to do this is using CGI plugin for your webserver that handles python scripts.
1
0
0
I have a python script that works from the command line. Instead of people running the script from command line and knowing which parameters go where I would like them to go to a webpage and select options and then run the script from the webpage. What is the easiest way to do this?
Easiest way to execute a command line python script from a webpage
0
0
0
833
14,506,025
2013-01-24T16:25:00.000
1
0
0
0
sockets,python-2.7,client
14,514,022
2
true
0
0
The corrected, tested, and working function: MAXSIZE = 65535 TIMEOUT = 10 def transientConnect(host,port,sendData): error,response = False,'' try: sendSocket = socket.socket() sendSocket.connect((host,port)) sendSocket.send(sendData) gotData ...
1
2
0
I wrote the following function for use in a collection of socket utilities I use for testing. (Using Python 2.7.3, if that's important.) The main reason I pulled the select library into it was so I could implement a timeout instead of just waiting forever for a response. The problem I've found though is that the res...
Server response on socket being truncated at 2K
1.2
0
1
1,405
14,508,976
2013-01-24T19:15:00.000
0
1
0
0
php,python,redis
14,511,844
2
false
0
0
Store the data manually the very first time (while developing the software). Every 2.5 seconds of running, use polling to check for updated data. If the data is updated, then update the data currently stored. When the user logs on, you plot the chart with the values in the database.
2
0
0
I have a weather station supplying me data every 2.5 seconds. (using weewx) I want to show this live on my website using highcharts to plot live data. Currently i can pickup the messages from the redis channel 'weather' using Predis just to test. The issue is that the data is only sent every 2.5, so when a users opens ...
Redis: Live data via channel
0
0
1
238
14,508,976
2013-01-24T19:15:00.000
0
1
0
0
php,python,redis
14,511,705
2
true
0
0
What you should do is have a second listener dump data into a key current_weather every time an event comes across. When you first load the page, pull from that key to build the chart, then start listening for updates.
2
0
0
I have a weather station supplying me data every 2.5 seconds. (using weewx) I want to show this live on my website using highcharts to plot live data. Currently i can pickup the messages from the redis channel 'weather' using Predis just to test. The issue is that the data is only sent every 2.5, so when a users opens ...
Redis: Live data via channel
1.2
0
1
238
14,509,190
2013-01-24T19:28:00.000
0
0
1
1
python,subprocess,pipe
14,509,236
2
false
0
0
I dont know about python, but as far as C is concerned, pipe is not independent for each process. Pipes are for the sole pupose of communicating between the parent and the child processes or even between the child processes themselves. The data written in a pipe by a particular process can be read by another process fr...
1
1
0
If I generate multiple subprocess.Popen(['commands', 'that', 'I', 'called']) and for each I do stdin.write(..) or p.communicate(...)to interact with the commands, is it guarantee to be independent and will come back to the each process (stdout from the called command)?
Are pipes in each process independent?
0
0
0
104
14,509,192
2013-01-24T19:28:00.000
-1
0
1
0
python,import
14,509,299
5
false
0
0
I think you can add Foo to the current Python path using os.path.join() or os.path.append() and do from import Project1.file1 import function_name.
1
42
0
I have some code in a project which I'd like to reuse in another project. What do I need to do (in both folders) so that I can do this? The directory structure is something like: Foo Project1 file1.py file2.py Bar Project2 fileX.py fileY.py I want to use functions from file1.py and file2.py in fileX.py and fi...
How to import functions from other projects in Python?
-0.039979
0
0
51,011
14,509,269
2013-01-24T19:34:00.000
2
0
1
0
python,serialization,save
14,509,829
5
false
0
0
Use a database. SQLAlchemy with SQLight is a good start. You'll end up there in the end anyway. or Dump everything out with the pickle module. (there really isn't anything to understand, you save objects and then load them again, it's really simple).
1
13
0
I've made a class in which I want to keep track of stats of students. I intend to make a GUI later to manipulate this data. My main question is: what is the best way to save and later retrieve this data? I've read about pickle and JSON, but I don't really get how they work (especially about how they save the data, like...
Best method of saving data
0.07983
0
0
28,277
14,509,517
2013-01-24T19:49:00.000
0
0
0
0
python,mysql,sqlite,pandas
14,509,945
3
false
0
0
SQLite is great for embedded databases, but it's not really great for anything that requires access by more than one process at a time. For this reason it cannot be taken seriously for your application. MySQL is a much better alternative. I'm also in agreement that Postgres would be an even better option.
2
0
0
I'm building a finance application in Python to do time series analysis on security prices (among other things). The heavy lifting will be done in Python mainly using Numpy, SciPy, and pandas (pandas has an interface for SQLite and MySQL). With a web interface to present results. There will be a few hundred GB of data....
MySQL v. SQLite for Python based financial web app
0
1
0
1,382
14,509,517
2013-01-24T19:49:00.000
0
0
0
0
python,mysql,sqlite,pandas
14,514,661
3
false
0
0
For many 'research' oriented time series database loads, it is far faster to do as much analysis in the database than to copy the data to a client and analyze it using a regular programming language. Copying 10G across the network is far slower than reading it from disk. Relational databases do not natively support ti...
2
0
0
I'm building a finance application in Python to do time series analysis on security prices (among other things). The heavy lifting will be done in Python mainly using Numpy, SciPy, and pandas (pandas has an interface for SQLite and MySQL). With a web interface to present results. There will be a few hundred GB of data....
MySQL v. SQLite for Python based financial web app
0
1
0
1,382
14,509,986
2013-01-24T20:19:00.000
0
0
1
0
python
60,312,770
8
false
0
0
I'm using has_leading_zero = re.match(r'0\d+', str(data)) as a solution that accepts any number and treats 0 as a valid number without a leading zero
1
9
0
I have a binary string say '01110000', and I want to return the number of leading zeros in front without writing a forloop. Does anyone have any idea on how to do that? Preferably a way that also returns 0 if the string immediately starts with a '1'
Python trick in finding leading zeros in string
0
0
0
10,560
14,510,670
2013-01-24T21:00:00.000
0
0
0
0
soap-client,python-2.6,suds
14,530,273
1
false
1
0
This may not exactly be a suds issue. Could you pasted your full code? Have you validate that the same Service call returns the results when you use a Tool (SOAPUI may be) to invoke the service?
1
0
0
I am accessing our jira system to get some information through SOAP. They updated the jira system lately and I started seeing some problems. The problem is very well known but I couldn't wrap head around the solution which was posted. File "C:\CRMAPPS\APPS\PYTHON~1\lib\xml\sax\handler.py", line 38, in fatalError ra...
Exception while performing a SOAP request using suds in python
0
0
0
189
14,511,669
2013-01-24T22:06:00.000
1
0
0
0
python,google-drive-api
14,556,472
2
true
0
0
As you have correctly stated, you will need to keep (or work out) the file hierarchy for a changed file to know whether a file has changed within a folder tree. There is no way of knowing directly from the changes feed whether a deeply nested file within a folder has been changed. Sorry.
2
3
0
I am currently working on an app that syncs one specific folder in a users Google Drive. I need to find when any of the files/folders in that specific folder have changed. The actual syncing process is easy, but I don't want to do a full sync every few seconds. I am condisering one of these methods: 1) Moniter the chan...
How can I find if the contents in a Google Drive folder have changed
1.2
0
1
547
14,511,669
2013-01-24T22:06:00.000
0
0
0
0
python,google-drive-api
20,685,131
2
false
0
0
There are a couple of tricks that might help. Firstly, if your app is using drive.file scope, then it will only see its own files. Depending on your specific situation, this may equate to your folder hierarchy. Secondly, files can have multiple parents. So when creating a file in folder-top/folder-1/folder-1a/folder-1a...
2
3
0
I am currently working on an app that syncs one specific folder in a users Google Drive. I need to find when any of the files/folders in that specific folder have changed. The actual syncing process is easy, but I don't want to do a full sync every few seconds. I am condisering one of these methods: 1) Moniter the chan...
How can I find if the contents in a Google Drive folder have changed
0
0
1
547
14,512,022
2013-01-24T22:30:00.000
2
0
1
0
python,amazon-web-services,boto
14,512,942
1
true
0
0
The installer does not create a config file for you. You have to manually create one. You can create a system-wide config file in /etc/boto.cfg or a personal config file in ~/.boto. Or you can create one somewhere else and point the BOTO_CONFIG environment variable at it.
1
0
0
I am trying to set my AWS id and secret in boto.cfg for the AWS python library "boto". I've installed it on my mac with pip install and I don't see it in /etc How do I locate and access it or do I have to create it? And if so how?
how to access and edit python library config file
1.2
0
0
150
14,514,438
2013-01-25T02:33:00.000
2
0
0
0
python,cairo,pycairo
14,521,313
1
true
0
1
I have finally found what was wrong with cairo and the bad alpha blending. Cairo supports ARGB32 surface, but only with premultiplied alpha. That is, every component of a pixel is stored premultiplied with the alpha component. I have not found an answer for this over the internet, and I assume premultiplied alpha is no...
1
3
0
I am using pycairo (actually cairocffi) on Ubuntu 12.04. The library on the system is cairo 1.10. I've created an empty ImageSurface, having an ARGB32 format. If, for example, I try to fill a semi-transparent white rectangle (RGBA(1,1,1,0.5)), I see a semi-transparent grey rectangle. This is the same for every semi-tra...
Cairo, ImageSurface : Cannot get correct alpha blending
1.2
0
0
835
14,516,447
2013-01-25T06:20:00.000
1
0
0
1
python,multithreading,celery
14,516,799
2
false
0
0
If I didn't want to have a separate service (outside of Celery) sync to file, the way I would accomplish this in Celery is to bind a one worker pool (a pool with concurrency 1) to a specific queue that accepts only file write tasks. This way tasks run serially and there won't be any race conditions while writing. Alte...
2
5
0
I am trying to use Celery to output to multiple files. The task is very simple: Get some data along with a file path Append that data to the file path (and create the file if it doesn't exist) I do not want to open/close the file handle each time, since I would write to the same file in many cases. So I made a simple...
Using celery to output to files
0.099668
0
0
2,459
14,516,447
2013-01-25T06:20:00.000
4
0
0
1
python,multithreading,celery
14,516,523
2
false
0
0
The pool does not seem to be shared by the celery threads. Ideal way to do it is to assign a single process the task of writing to files and all the celery threads should write to that process via queue.
2
5
0
I am trying to use Celery to output to multiple files. The task is very simple: Get some data along with a file path Append that data to the file path (and create the file if it doesn't exist) I do not want to open/close the file handle each time, since I would write to the same file in many cases. So I made a simple...
Using celery to output to files
0.379949
0
0
2,459
14,516,737
2013-01-25T06:45:00.000
1
0
0
0
python,django,django-views,django-database
14,516,949
2
false
1
0
there are some cheats for this. The general solution is trying to include the initial code in some special places, so that when the server starts up, it will run those files and also run the code. Have you ever tried to put print 'haha' in the settings.py files :) ? Note: be aware that settings.py runs twice during st...
1
6
0
I want to initialize some variables (from the database) when Django starts. I am able to get the data from the database but the problem is how should I call the initialize method . And this should be only called once. Tried looking in other Pages, but couldn't find an answer to it. The code currently looks something l...
Django : Call a method only once when the django starts up
0.099668
0
0
8,360
14,517,343
2013-01-25T07:31:00.000
2
0
1
0
python,git,python-3.x,python-2.7,dulwich
14,520,710
4
false
0
0
Since branches are just pointers to random commits and they don't "describe" trees in any way, there is nothing linking some random commit TO a branch. The only sensible way I would take to look up if a given commit is an ancestor of a commit to which some branch points is to traverse all ancestor chains from branch-to...
1
0
0
I would like to do the following command from Python script using dulwich: $ git branch --contains <myCommitSha> | wc -l What I intend is to check if a particular commit (sha) is placed in more than one branches. Of course I thought that I can execute the above command from Python and parse the output (parse the number...
Check which branches contain a specific git commit sha using Python dulwich?
0.099668
0
0
2,673
14,518,005
2013-01-25T08:26:00.000
0
0
0
0
python-2.7,cairo,pycairo
14,520,708
1
false
0
1
Mesh patterns were added in cairo 1.12 which is the latest release. Thus, most language bindings likely don't support them yet. I don't know anything about the combination of python and cairo and thus don't know any workaround. I don't know any simple way to simulate what you need with other patterns, sorry. (Although ...
1
1
0
I'm a newbie in this type of approach to programming since I really doesn't care for hardcore graphics generation. I design, write, run, and study parametrized climate models with python. But, at last, I have encountered myself with a visualization issue. I was looking for something in Cairo library that allows me to m...
Using mesh gradients in Cairo for coloring a path
0
0
0
926
14,519,625
2013-01-25T10:13:00.000
7
0
1
0
python,django,python-3.x,python-2.7
14,519,663
4
true
1
0
Django only has experimental support for Python 3, so you'll have to go with Python 2.7 for now.
2
8
0
I am interested in learning Python but I don't know which version I should chose. When I Googled, I got answers posted over a year ago. If I want to learn Django, which version will be useful and will get support? Note that I know C, C++, Java and C#.
Python 2.7 or 3.3 for learning Django
1.2
0
0
6,488
14,519,625
2013-01-25T10:13:00.000
0
0
1
0
python,django,python-3.x,python-2.7
14,519,922
4
false
1
0
If you already know several languages then learn both Python 2 and 3. The difference is small enough to allow many projects to support both versions using single (the same) source code. For actual deployment you might prefer Python 2.7 if you need to use dependencies that are not ported to Python 3.
2
8
0
I am interested in learning Python but I don't know which version I should chose. When I Googled, I got answers posted over a year ago. If I want to learn Django, which version will be useful and will get support? Note that I know C, C++, Java and C#.
Python 2.7 or 3.3 for learning Django
0
0
0
6,488
14,523,959
2013-01-25T14:36:00.000
1
0
1
1
python,python-idle
14,524,064
1
true
0
0
Try this : Options > Configure IDLE > General tab > Initial Window size
1
0
0
I'm sorry if this is really basic but: when I open the Python IDLE editor, the shell opens, then I have to open the editor from the shell. Is there any way I can have the shell and editor automatically resize to a specific size upon opening? Can I use a batch file perhaps?
How to auto resize a window when opening a program.
1.2
0
0
869
14,525,344
2013-01-25T15:55:00.000
-9
0
0
0
arrays,numpy,python-2.7,size,max
23,838,980
4
false
0
0
It is indeed related to the system maximum address length, to say it simply, 32-bit system or 64-bit system. Here is an explanation for these questions, originally from Mark Dickinson Short answer: the Python object overhead is killing you. In Python 2.x on a 64-bit machine, a list of strings consumes 48 bytes per list...
2
30
1
I'm trying to create a matrix containing 2 708 000 000 elements. When I try to create a numpy array of this size it gives me a value error. Is there any way I can increase the maximum array size? a=np.arange(2708000000) ValueError Traceback (most recent call last) ValueError: Maximum allo...
What's the maximum size of a numpy array?
-1
0
0
82,332
14,525,344
2013-01-25T15:55:00.000
19
0
0
0
arrays,numpy,python-2.7,size,max
14,525,604
4
false
0
0
You're trying to create an array with 2.7 billion entries. If you're running 64-bit numpy, at 8 bytes per entry, that would be 20 GB in all. So almost certainly you just ran out of memory on your machine. There is no general maximum array size in numpy.
2
30
1
I'm trying to create a matrix containing 2 708 000 000 elements. When I try to create a numpy array of this size it gives me a value error. Is there any way I can increase the maximum array size? a=np.arange(2708000000) ValueError Traceback (most recent call last) ValueError: Maximum allo...
What's the maximum size of a numpy array?
1
0
0
82,332
14,526,249
2013-01-25T16:38:00.000
2
0
0
1
python,postgresql,connection-pooling,celery
14,526,700
6
false
0
0
You can override the default behavior to have threaded workers instead of a worker per process in your celery config: CELERYD_POOL = "celery.concurrency.threads.TaskPool" Then you can store the shared pool instance on your task instance and reference it from each threaded task invocation.
2
47
0
I am using Celery standalone (not within Django). I am planning to have one worker task type running on multiple physical machines. The task does the following Accept an XML document. Transform it. Make multiple database reads and writes. I'm using PostgreSQL, but this would apply equally to other store types that ...
Celery Worker Database Connection Pooling
0.066568
1
0
24,474
14,526,249
2013-01-25T16:38:00.000
3
0
0
1
python,postgresql,connection-pooling,celery
14,549,811
6
false
0
0
Have one DB connection per worker process. Since celery itself maintains a pool of worker processes, your db connections will always be equal to the number of celery workers. Flip side, sort of, it will tie up db connection pooling to celery worker process management. But that should be fine given that GIL allows only...
2
47
0
I am using Celery standalone (not within Django). I am planning to have one worker task type running on multiple physical machines. The task does the following Accept an XML document. Transform it. Make multiple database reads and writes. I'm using PostgreSQL, but this would apply equally to other store types that ...
Celery Worker Database Connection Pooling
0.099668
1
0
24,474
14,527,010
2013-01-25T17:18:00.000
0
0
1
0
python,ftp,zip
14,527,258
4
false
0
0
The zipfile module can be used to extract things from a zip file; the ftplib would be used to access the zipfile. Unfortunately, ftplib doesn't provide a file-like object for zipfile to use to access the contents of the file. I suppose you could read the zip & store it in memory, for example in a string, which could ...
1
1
0
I'm trying to download a zip file via ftp, but then extract the files inside without ever actually saving the zip. Any idea how I do this?
Download zip file via FTP and extract files in memory in Python
0
0
0
7,256
14,528,379
2013-01-25T18:46:00.000
1
0
1
0
python,command-line,usb,python-idle
14,528,530
1
true
0
0
IDLE swaps out the sys.stdout and sys.stderr objects at the Python level this causes issues with some pyd modules. Try using another debugger.
1
0
0
I've found a lot of people having the reverse issue, but haven't yet found a question that involves IDLE not being able to run something that runs fine from the command line. I'm using a new module that I haven't used before that uses one .pyd file and one .dll, and involves a device that connects through USB. I sadly ...
Python code runs fine from command line, but won't work from IDLE
1.2
0
0
187
14,531,396
2013-01-25T22:31:00.000
8
1
0
0
python,python-2.7,pyramid
14,539,402
1
true
1
0
The UnencryptedCookieSessionFactory manages one cookie, that is signed. This means that the client can read1 what is in the cookie, but cannot change the values in the cookie. If you set cookies directly using response.set_cookie(), the client can not only read the cookie, they can change the value of the cookie and yo...
1
2
0
I do not understand the difference between setting up a Unencrypted Session Factory in order to set cookies, as compared to using request.response.set_cookie(..) and request.cookies[key].
In Pyramid Framework what is the difference between default Unencrypted Session Factory and setting cookies manually?
1.2
0
0
451
14,532,105
2013-01-25T23:44:00.000
12
0
1
0
python,algorithm,list,python-2.7,integer
14,533,924
8
false
0
0
sorted(x, cmp=lambda a, b: -1 if str(b)+str(a) < str(a)+str(b) else 1)
2
21
0
Say I have an array of positive whole integers; I'd like to manipulate the order so that the concatenation of the resultant array is the largest number possible. For example [97, 9, 13] results in 99713; [9,1,95,17,5] results in 9955171. I'm not sure of an answer.
Constructing the largest number possible by rearranging a list
1
0
0
6,324
14,532,105
2013-01-25T23:44:00.000
5
0
1
0
python,algorithm,list,python-2.7,integer
14,532,125
8
false
0
0
Hint one: you concatenate strings, not integers. Hint two: itertools.permutations().
2
21
0
Say I have an array of positive whole integers; I'd like to manipulate the order so that the concatenation of the resultant array is the largest number possible. For example [97, 9, 13] results in 99713; [9,1,95,17,5] results in 9955171. I'm not sure of an answer.
Constructing the largest number possible by rearranging a list
0.124353
0
0
6,324
14,535,650
2013-01-26T09:36:00.000
1
0
0
0
python,math,matrix,permutation,itertools
14,535,721
2
false
0
0
Just pull the placed numbers out of the permutation set. Then insert them into their proper position in the generated permutations. For your example you'd take out 1, 16, 4, 13. Permute on (2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15), for each permutation, insert 1, 16, 4, 13 where you have pre-selected to place them.
1
0
1
So far I have been using python to generate permutations of matrices for finding magic squares. So what I have been doing so far (for 3x3 matrices) is that I find all the possible permutations of the set {1,2,3,4,5,6,7,8,9} using itertools.permutations, store them as a list and do my calculations and print my results....
How would I go about finding all possible permutations of a 4x4 matrix with static corner elements?
0.099668
0
0
2,502
14,535,730
2013-01-26T09:48:00.000
-2
0
1
0
python
58,688,573
9
false
0
0
For creating a hashing table from scratch, all the values has to set to "None" and modified once a requirement arises. Hashable objects refers to the modifiable datatypes(Dictionary,lists etc). Sets on the other hand cannot be reinitialized once assigned, so sets are non hashable. Whereas, The variant of set() -- froze...
3
294
0
I tried searching internet but could not find the meaning of hashable. When they say objects are hashable or hashable objects what does it mean?
What does "hashable" mean in Python?
-0.044415
0
0
205,414
14,535,730
2013-01-26T09:48:00.000
12
0
1
0
python
62,076,580
9
false
0
0
In Python, any immutable object (such as an integer, boolean, string, tuple) is hashable, meaning its value does not change during its lifetime. This allows Python to create a unique hash value to identify it, which can be used by dictionaries to track unique keys and sets to track unique values. This is why Python req...
3
294
0
I tried searching internet but could not find the meaning of hashable. When they say objects are hashable or hashable objects what does it mean?
What does "hashable" mean in Python?
1
0
0
205,414
14,535,730
2013-01-26T09:48:00.000
3
0
1
0
python
18,806,135
9
false
0
0
In python it means that the object can be members of sets in order to return a index. That is, they have unique identity/ id. for example, in python 3.3: the data structure Lists are not hashable but the data structure Tuples are hashable.
3
294
0
I tried searching internet but could not find the meaning of hashable. When they say objects are hashable or hashable objects what does it mean?
What does "hashable" mean in Python?
0.066568
0
0
205,414
14,538,468
2013-01-26T15:40:00.000
0
0
0
0
python,macos,svn,mercurial
14,686,539
4
false
0
0
You could try to use hgsubversion with subvertpy instead of hg convert.
2
5
0
I am looking for a solution, preferably clean and simple, to enable hg convert to work on OS X 10.8 with SVN repositories. Currently, if you try to convert a SVN repository you will get a could not load Subversion python bindings error. Note: Alex Martelli recommended in another answer to install CollabNet subversion d...
How to install python subversion bindings needed by hg convert on Mac OS X 10.8?
0
0
0
3,226
14,538,468
2013-01-26T15:40:00.000
1
0
0
0
python,macos,svn,mercurial
17,334,633
4
false
0
0
Using the hg from MacPorts, I needed sudo port install subversion-python27bindings.
2
5
0
I am looking for a solution, preferably clean and simple, to enable hg convert to work on OS X 10.8 with SVN repositories. Currently, if you try to convert a SVN repository you will get a could not load Subversion python bindings error. Note: Alex Martelli recommended in another answer to install CollabNet subversion d...
How to install python subversion bindings needed by hg convert on Mac OS X 10.8?
0.049958
0
0
3,226
14,539,992
2013-01-26T18:15:00.000
3
0
0
0
python,pandas
17,913,278
3
false
0
0
You can also do: rng = pd.date_range('1/1/2000', periods=24, freq='H') ts = pd.Series(pd.np.random.randn(len(rng)), index=rng) ts.ix[datetime.time(10):datetime.time(14)] Out[4]: 2000-01-01 10:00:00 -0.363420 2000-01-01 11:00:00 -0.979251 2000-01-01 12:00:00 -0.896648 2000-01-01 13:00:00 -0.051159 2000-01-01 ...
1
17
1
I am trying to go through every row in a DataFrame index and remove all rows that are not between a certain time. I have been looking for solutions but none of them separate the Date from the Time, and all I want to do is drop the rows that are outside of a Time range.
Pandas Drop Rows Outside of Time Range
0.197375
0
0
19,605
14,540,143
2013-01-26T18:31:00.000
53
0
1
0
python,python-3.x,floating-point
19,671,847
5
false
0
0
The simple way to do this is by using the round buit-in. round(2.6463636263,2) would be displayed as 2.65.
1
50
0
I am reading a text file with floating point numbers, all with either 1 or 2 decimal points. I am using float() to convert a line into a float, and raising a ValueError if that fails. I am storing all floats in a list. When printing it out, I'd like to print it out as a 2 decimal places floating point. Assume I have a ...
Python 3 Float Decimal Points/Precision
1
0
0
180,567
14,541,869
2013-01-26T21:42:00.000
1
0
1
0
python,sqlite,virtualenv
17,417,792
3
false
0
0
I was stuck in the same problem once. This solved it for me: Download and untar the python version required mkdir local untar sqlite after downloading its package ./configure --prefix=/home/aanuj/local make make install ./configure --prefix=/home/anauj/local LDFLAGS='-L/home/aaanuj/local/lib' CPPFLAGS='-I/home/aanuj/l...
2
4
0
There is a sqlite3 library that comes with python 2.7.3, but it is hardly the latest version. I would like to upgrade it within a virtualenv environment. In other words, the upgrade only applies to the version of python installed within this virtualenv. What is the correct way to do so?
How to upgrade sqlite3 in python 2.7.3 inside a virtualenv?
0.066568
1
0
9,594
14,541,869
2013-01-26T21:42:00.000
4
0
1
0
python,sqlite,virtualenv
14,550,136
3
true
0
0
The below works for me, but please comment if there is any room for improvement: Activate the virtualenv to which you are going to install the latest sqlite3 Get the latest source of pysqlite package from google code: wget http://pysqlite.googlecode.com/files/pysqlite-2.6.3.tar.gz Compile pysqlite from source and toge...
2
4
0
There is a sqlite3 library that comes with python 2.7.3, but it is hardly the latest version. I would like to upgrade it within a virtualenv environment. In other words, the upgrade only applies to the version of python installed within this virtualenv. What is the correct way to do so?
How to upgrade sqlite3 in python 2.7.3 inside a virtualenv?
1.2
1
0
9,594
14,544,225
2013-01-27T03:48:00.000
1
0
0
0
python,session,cookies,flask
14,571,069
1
true
1
0
After much testing and many permutations of SESSION_COOKIE_DOMAIN and SERVER_NAME, I concluded that the problem was with Heroku. Something about the way Heroku currently routes/hooks up to custom domains breaks domain cookies. I verified this by moving to EC2...now everything works.
1
1
0
I have a Flask application hosted on Heroku, and the Heroku instance (say, "helloworld.herokuapp.com") has a custom domain name, say "www.helloworld.com". When I access the app at the native heroku URL, sessions work perfectly fine. When I access it at www.helloworld.com, they don't work. I assume that this is because ...
Flask: Heroku with custom domain name breaks sessions?
1.2
0
0
768
14,544,627
2013-01-27T05:09:00.000
1
1
1
0
python,ruby,text-to-speech
14,544,779
1
true
0
0
Here is an idea that should work : Use a cunning, "linguist"-grade phoneticizer. Use a standard, small table of phonetic to English syllable ( in the English accent of your choosing ), mappings. Run the resulting "phonetically spelled" words through a standard, OTS TTS product . So, for example, you can have : Fish ...
1
1
0
I would like to take snippets of text and convert them, programmatically, to be more phonetic than traditional English spellings. The purpose of this is for converting a bunch of text I'm working with to a version that can be read by common TTS tools in a more natural way for a scientific application. Many of the te...
Programmatically convert text to phonetic TTS readable text?
1.2
0
0
894
14,544,838
2013-01-27T05:55:00.000
4
0
1
0
python,scipy,root,solver
14,544,871
1
false
0
0
This is easy if you change your definition of f(x). e.g. if you want f(x) = 5, define your function: g(x) = f(x) - 5 = 0
1
0
1
I know how I can solve for a root in python using scipy.optimize.fsolve. I have a function defined f = lambda : -1*numpy.exp(-x**2) and I want to solve for x setting the function to a certain nonzero. For instance, I want to solve for x using f(x) = 5. Is there a way to do this with fsolve or would I need to use ano...
find a value other than a root with fsolve in python's scipy
0.664037
0
0
380
14,545,001
2013-01-27T06:23:00.000
1
0
1
0
python
16,391,653
4
false
0
0
There's also -m compatible packages on the Cheeseshop. Try "e" or "oo" :-)
1
42
0
I'm currently aware of two tools: base64 encoder/decoder: python -m base64 -e <input python -m base64 -d <input json validator and pretty printer python -m json.tool <input where input can be stdin or file. I'm curious if there are other tools exposed by SPL that work in similar fashion?
What "tools" are available in Python standard library
0.049958
0
0
5,582
14,545,128
2013-01-27T06:49:00.000
0
0
1
0
python,python-2.7
14,545,808
2
false
0
0
Rule of thumb in users' created python modules, never give your modules the same python's standard modules names; instant conflict will occur. eg. If you name your socket app "socket.py", and started your application, similar problem to what you showed will appear.
1
0
0
I can't import socket module into my program. When I import it said, "AttributeError: 'module' object has no attribute "AF_INET'. I think there is a problem with my python virtual machine.
Issue with socket module?
0
0
1
117
14,545,602
2013-01-27T08:11:00.000
4
0
0
0
python,performance,numpy
14,545,631
3
true
0
0
In general, it probably matters most (efficiency-wise) to avoid conversions between the two. If you're mostly using non-numpy functions on data, then they'll be internally operating using standard Python data types, and thus using numpy arrays would be inefficient due to the need to convert back and forth. Similarly, i...
2
3
1
For a lot of functions, it is possible to use either native Python or numpy to proceed. This is the case for math functions, that are available with Python native import math, but also with numpy methods. This is also the case when it comes to arrays, with narray from numpy and pythons list comprehensions, or tuples. ...
numpy vs native Python - most efficient way
1.2
0
0
1,039
14,545,602
2013-01-27T08:11:00.000
1
0
0
0
python,performance,numpy
14,545,646
3
false
0
0
When there's a choice between working with NumPy array and numeric lists, the former are typically faster. I don't quite understand the second question, so won't try to address it.
2
3
1
For a lot of functions, it is possible to use either native Python or numpy to proceed. This is the case for math functions, that are available with Python native import math, but also with numpy methods. This is also the case when it comes to arrays, with narray from numpy and pythons list comprehensions, or tuples. ...
numpy vs native Python - most efficient way
0.066568
0
0
1,039
14,546,610
2013-01-27T10:50:00.000
6
1
1
0
python,assembly,python-extensions
14,546,652
3
false
0
0
In theory - it is possible. In practice - it is highly impractical to do so. There are very very few cases where there is justified usage of Assembly over C, and even if you face such a situation, it is highly unlikely you will be working with Python in that case. Also note, that the compiler can optimize the C code t...
2
1
0
I have medium amateur skills in Python and I'm beginner in asm and haven't any knowledge of C-language. I know that python C-extensions must follow specific interface to work fine. Is this possible to write python extension in pure Assembly with the right interface and full functionality? The second question is would i...
How to write python extensions in pure asm and would it be efficient?
1
0
0
1,492
14,546,610
2013-01-27T10:50:00.000
2
1
1
0
python,assembly,python-extensions
14,546,657
3
false
0
0
You could write your asm as inline asm inside your c extention, as for efficiency... Teapot. Efficiency isn't measured by the choice of language, its measured by how well its implemented and how well its designed.
2
1
0
I have medium amateur skills in Python and I'm beginner in asm and haven't any knowledge of C-language. I know that python C-extensions must follow specific interface to work fine. Is this possible to write python extension in pure Assembly with the right interface and full functionality? The second question is would i...
How to write python extensions in pure asm and would it be efficient?
0.132549
0
0
1,492
14,547,237
2013-01-27T12:20:00.000
3
0
1
0
python,exception
14,547,972
1
false
0
0
Python is a higher-level language than C and C++. Anything can involve code execution behind the scenes, and no name is exempt from looking up its current, possibly overridden value. It might be possible to identify some operations that are guaranteed never to raise an exception, but I suspect that set of operations ...
1
1
0
In C++, in order for code to be robust in the presence of exceptions, it is often necessary to rely on the fact that a few simple operations are guaranteed never to fail (and hence never to throw an exception). Examples of these operations include assignment of integers and swapping of standard containers. Are there an...
Are there any operations in Python which are guaranteed never to fail?
0.53705
0
0
136
14,549,405
2013-01-27T16:23:00.000
2
1
1
0
python,object,instance
55,782,792
12
false
0
0
Yes. Accordingly, you can use hasattr(obj, '__dict__') or obj is not callable(obj).
2
116
0
Is there any way to check if object is an instance of a class? Not an instance of a concrete class, but an instance of any class. I can check that an object is not a class, not a module, not a traceback etc., but I am interested in a simple solution.
Python check instances of classes
0.033321
0
0
140,863
14,549,405
2013-01-27T16:23:00.000
2
1
1
0
python,object,instance
14,549,914
12
false
0
0
It's a bit hard to tell what you want, but perhaps inspect.isclass(val) is what you are looking for?
2
116
0
Is there any way to check if object is an instance of a class? Not an instance of a concrete class, but an instance of any class. I can check that an object is not a class, not a module, not a traceback etc., but I am interested in a simple solution.
Python check instances of classes
0.033321
0
0
140,863
14,549,545
2013-01-27T16:39:00.000
1
0
0
0
python,user-interface,text,python-3.x,tkinter
14,549,709
1
false
0
1
Use a text widget in disabled state. There is no insertion cursor in this state, but the text may still be selected and copied (but not modified).
1
0
0
I am new to designing GUIs in python and have a query: Is there a way to have a label or any other widget with copyable text. I want to provide help section within GUI which will contain a sample xml to be given as input, I want user to be able to copy that xml. I don't want that information to go away if user cuts tha...
Python tkinter GUI: which widget to use for having copyable text
0.197375
0
0
254
14,551,472
2013-01-27T19:48:00.000
3
1
1
0
python,r
14,552,819
3
false
0
0
When I need to do R calculations, I usually write R scripts, and run them from Python using the subprocess module. The reason I chose to do this was because the version of R I had installed (2.16 I think) wasn't compatible with RPy at the time (which wanted 2.14). So if you already have your R installation "just the wa...
1
13
1
I need to make computations in a python program, and I would prefer to make some of them in R. Is it possible to embed R code in python ?
Embed R code in python
0.197375
0
0
13,823
14,552,088
2013-01-27T20:47:00.000
3
0
0
0
python,curl,python-requests
14,552,426
3
true
0
0
Since you want to parallelize the requests, you should use requests with grequests (if you're using gevent, or erequests if you're using eventlet). You may have to throttle how quickly you hit the website though since they may do some ratelimiting and be refusing you for requesting too much in too short a period of tim...
3
4
0
When doing a scrape of a site, which would be preferable: using curl, or using Python's requests library? I originally planned to use requests and explicitly specify a user agent. However, when I use this I often get an "HTTP 429 too many requests" error, whereas with curl, it seems to avoid that. I need to update meta...
Using curl vs Python requests
1.2
0
1
2,673
14,552,088
2013-01-27T20:47:00.000
0
0
0
0
python,curl,python-requests
14,552,220
3
false
0
0
I'd go for the in-language version over an external program any day, because it's less hassle. Only if it turns out unworkable would I fall back to this. Always consider that people's time is infinitely more valuable than machine time. Any "performance gains" in such an application will probably be swamped by network d...
3
4
0
When doing a scrape of a site, which would be preferable: using curl, or using Python's requests library? I originally planned to use requests and explicitly specify a user agent. However, when I use this I often get an "HTTP 429 too many requests" error, whereas with curl, it seems to avoid that. I need to update meta...
Using curl vs Python requests
0
0
1
2,673
14,552,088
2013-01-27T20:47:00.000
2
0
0
0
python,curl,python-requests
14,552,201
3
false
0
0
Using requests would allow you to do it programmatically, which should result in a cleaner product. If you use curl, you're doing os.system calls which are slower.
3
4
0
When doing a scrape of a site, which would be preferable: using curl, or using Python's requests library? I originally planned to use requests and explicitly specify a user agent. However, when I use this I often get an "HTTP 429 too many requests" error, whereas with curl, it seems to avoid that. I need to update meta...
Using curl vs Python requests
0.132549
0
1
2,673
14,552,117
2013-01-27T20:50:00.000
0
0
1
0
python,packages
14,552,389
2
false
0
0
That's really 3 different questions: I wanted to know if you can use the import statement in python from a directory that is not your local directory if that directory is not a package Yes, you can. Also, do all the directories on your system path have to be packages? No, they don't. If you add a relative path to ...
1
0
0
I wanted to know if you can use the import statement in python from a directory that is not your local directory if that directory is not a package? Also, do all the directories on your system path have to be packages? If you add a relative path to your system path, what is it relative to?
Python packages and imports
0
0
0
128
14,552,348
2013-01-27T21:10:00.000
-1
1
1
0
visual-c++,python-2.7,visual-studio-2005,manifest,boost-python
45,562,941
13
false
0
0
Adding this answer for who is still looking for a solution. ESRI released a patch for this error. Just download the patch from their website (no login required), install it and it will solve the problem. I downloaded the patch for 10.4.1 but there are maybe patches for other versions also.
5
41
0
I am working on an application which uses Boost.Python to embed the Python interpreter. This is used to run user-generated "scripts" which interact with the main program. Unfortunately, one user is reporting runtime error R6034 when he tries to run a script. The main program starts up fine, but I think the problem may ...
Runtime error R6034 in embedded Python application
-0.015383
0
0
52,195
14,552,348
2013-01-27T21:10:00.000
0
1
1
0
visual-c++,python-2.7,visual-studio-2005,manifest,boost-python
33,030,097
13
false
0
0
The discussion on this page involves doing things way far advanced above me. (I don't code.) Nevertheless, I ran Process Explorer as the recommended diagnostic. I found that another program uses and needs msvcr90.dll in it's program folder. Not understanding anything else being discussed here, as a wild guess I tempora...
5
41
0
I am working on an application which uses Boost.Python to embed the Python interpreter. This is used to run user-generated "scripts" which interact with the main program. Unfortunately, one user is reporting runtime error R6034 when he tries to run a script. The main program starts up fine, but I think the problem may ...
Runtime error R6034 in embedded Python application
0
0
0
52,195
14,552,348
2013-01-27T21:10:00.000
4
1
1
0
visual-c++,python-2.7,visual-studio-2005,manifest,boost-python
31,012,118
13
false
0
0
(This might be better as a comment than a full answer, but my dusty SO acct. doesn't yet have enough rep for that.) Like the OP I was also using an embedded Python 2.7 and some other native assemblies. Complicating this nicely was the fact that my application was a med-large .Net solution running on top of 64-Bit II...
5
41
0
I am working on an application which uses Boost.Python to embed the Python interpreter. This is used to run user-generated "scripts" which interact with the main program. Unfortunately, one user is reporting runtime error R6034 when he tries to run a script. The main program starts up fine, but I think the problem may ...
Runtime error R6034 in embedded Python application
0.061461
0
0
52,195
14,552,348
2013-01-27T21:10:00.000
0
1
1
0
visual-c++,python-2.7,visual-studio-2005,manifest,boost-python
28,445,016
13
false
0
0
In my case the rebuilding of linked libraries and the main project with similar "Runtime execution libraries" project setting helped. Hope that will be usefull for anybody.
5
41
0
I am working on an application which uses Boost.Python to embed the Python interpreter. This is used to run user-generated "scripts" which interact with the main program. Unfortunately, one user is reporting runtime error R6034 when he tries to run a script. The main program starts up fine, but I think the problem may ...
Runtime error R6034 in embedded Python application
0
0
0
52,195