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
21,867,972
2014-02-18T23:43:00.000
1
0
0
0
python,url,web,web2py
21,868,611
1
false
1
0
Well I guess you're going to have a build the worlds most remarkable single page application :) Security through obscurity is never a good design pattern. There is absolutely no security "reason" for hiding a URL if your system is designed in a such a way that the use of the URLs is meaningless unless the access contro...
1
0
0
I am building a website using web2py. For security reasons I would like to hide the url after the domain to the visitors. For example, when a person clicks a link to "domain.com/abc", it will go to that page and the address bar shows "domain.com". I have played with the routes_in and routes_out, but it only seems to ma...
How to hide url after domain in web2py?
0.197375
0
0
493
21,868,709
2014-02-19T00:47:00.000
1
0
0
0
python,api,flask
25,578,832
1
false
1
0
Tornado would do the trick. Flask is not designed for asynchronization. A Flask instance processes one request at a time in one thread. Therefore, when you hold the connection, it will not proceed to next request.
1
0
0
I have an HTTP API using Flask and in one particular operation clients use it to retrieve information obtained from a 3rd party API. The retrieval is done with a celery task. Usually, my approach would be to accept the client request for that information and return a 303 See Other response with an URI that can be polle...
Flask request waiting for asynchronous background job
0.197375
0
1
2,430
21,871,636
2014-02-19T05:13:00.000
0
0
1
0
python,parsing,query-string
21,872,039
1
false
1
0
It depends on the website itself. If it has other values of field1 or field2, you can only know that by looking into the code or documentation(if available). That's the only accurate way of knowing it. Otherwise, you can try brute forcing (trying all possible alphanumeric values Ever), but that doesn't guaranty anythin...
1
0
0
I'm trying to figure out how to parse a website that doesn't have documentation available to explain the query string. I am wondering if there is a way to get all possible valid values for different fields in a query string using Python. For example, let's say I have the current URL that I wish to parse: http://www.web...
Find all possible query string values with python
0
0
1
299
21,871,784
2014-02-19T05:24:00.000
0
0
0
0
python,namespaces
21,871,871
1
true
0
0
Currently, I'm using a stupid and violent solution. I create dict for each connection, and exec code in dict accordingly. exec code in connection_dict[connection]. Any smart solution ? Such as python CAPI ? Thanks again!
1
0
0
I want to write a simple python C/S exec code model, which will send all codes written in client to execute in server. Simply, you can think that I'm using exec(code, globals()) to run remote code. And I meet a problem about namespace : If I import something in a connection, another connection can also use this module...
How to set local namespace for specified connection?
1.2
0
1
23
21,871,997
2014-02-19T05:38:00.000
5
0
0
0
python,openerp,importerror,openerp-7
21,872,185
1
true
1
0
Getting this error because psutil is not installed. you have to install psutil using this command. sudo apt-get install python-psutil in terminal. after this restart server. This will solve your error.
1
2
0
I download trunk version of OpenERP from lauchpad. When i start server it's gives following error Traceback (most recent call last): File "./openerp-server", line 2, in import openerp File "/home/jack/trunk/trunk-server/openerp/init.py", line 72, in import http File "/home/jack/trunk/trunk-server/opener...
OpenERP trunk server gives import Error psutil
1.2
0
0
3,312
21,872,179
2014-02-19T05:50:00.000
2
0
1
0
python,json,scrapy
21,873,566
2
false
1
0
I think you should use scrapy crawl yourspider -o output.json -t json where -o output filename and -t output format.
1
1
0
I'm able to run a scrapy spider from a script. But I want to store the output in a specific file(say output.json) in json format. I did a lot of research & also tried to override FEED_URI & FEED_FORMAT from settings. I also tried to use JsonItemExporter function but all in vain. Any help will be appreciated. Thanks!
Setting/Configuring the output file after running scrapy spider
0.197375
0
0
487
21,872,515
2014-02-19T06:12:00.000
1
0
0
0
python,url
21,872,656
1
true
0
0
You cannot do it platform independent way. You need to use pywin32 for Windows platform (or any other suitable module which provides access to platform API, for example pywm) to access window (you can get it by window name). After that you should analyse all child to get to window which represents URL string. Finally y...
1
0
0
I searched the net but couldn't get anything that works. I am trying to write a python script which will trigger a timer if a particular url is opened in the current browser. How do i obtain the url from the browser.
Python: Getting current URL
1.2
0
1
477
21,877,935
2014-02-19T10:37:00.000
0
0
1
0
python,notepad
21,878,937
3
false
0
0
First check how to open notepad through command then use this command in subprocess or os.system. or use open() in os module which allow to open file.
1
0
0
I am doing automation task in which I have to open notepad, write some contents and save that file. I know how to open and do keyboard simulation. Is there any way through which I can save that opened Notepad file through script
Opening Notepad and saving using python
0
0
0
3,320
21,878,696
2014-02-19T11:07:00.000
0
1
0
0
python,unit-testing
21,879,161
1
true
0
0
The purpose of a unit test is to verify the implementation of a requirement. As any other piece of software, you have to distinguish what the unit test does, how it tests the requirement (roughly speaking its design), and how it is implemented. Unless the requirement itself is changed, the design of the unit test shoul...
1
0
0
I'm not sure if the language I'm using makes a difference or not, but for the record it's python (2.7.3). I recently tried to add functionality to a project I forked on GitHub. Specifically, I changed the underlying http request library from httplib2 to requests, so that I could easily add proxies to requests. The resu...
Changing unit tests based on added functionality
1.2
0
1
29
21,884,127
2014-02-19T14:56:00.000
3
0
1
0
python,editor,keyboard-shortcuts,pycharm
21,885,102
1
false
0
0
The shortcuts: Next Tab = 'Alt'+'Right' Previous Tab = 'Alt' + 'Left' While the cursor is in the Terminal. You can see all the shortcuts in the menu (and add more, or change, or delete): File -> Setting... -> [IDE Settings] Keymap
1
2
0
I am recently started to use pycharm. Its embedded terminal is really cool. We can create multiple sessions of terminal using 'ctr+shift+t'. Also we can close sessions using 'ctrl+sht+w'. But how to toggle between these sessions? Is there any keyboard shortcut? Also where should I get list of all shortcuts? Thanks in a...
keyboard shortcut for toggling sessions of terminals in pycharm
0.53705
0
0
410
21,884,271
2014-02-19T15:00:00.000
1
0
0
0
python,python-3.x,matplotlib
71,455,335
7
false
0
0
matplotlib by default keeps a reference of all the figures created through pyplot. If a single variable used for storing matplotlib figure (e.g "fig") is modified and rewritten without clearing the figure, all the plots are retained in RAM memory. Its important to use plt.cla() and plt.clf() instead of modifying and re...
1
233
1
In a script where I create many figures with fix, ax = plt.subplots(...), I get the warning RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. However, I don't understand wh...
warning about too many open figures
0.028564
0
0
164,804
21,885,365
2014-02-19T15:42:00.000
0
0
0
0
python,flask,blueprint
21,885,753
2
false
1
0
am I right your logic should be in models and service classes? and blueprints (aka views) only a thin middleware between template and these modules?
1
1
0
I'm a bit confused about separation for my flask app. Users can login, post adverts and these are available to the public. The URL structure would be something like this: User Home - www.domain.com/user User login - www.domain.com/user/login User advert List - www.domain.com/user/advert User advert add - www.domain.co...
Flask python blueprint logic code separation
0
0
0
344
21,885,856
2014-02-19T16:03:00.000
1
0
0
0
python,jinja2,python-sphinx
21,909,382
2
true
1
0
I've found a good way to do this. Sphinx's configuration parameter template_bridge allows to control over TemplateBribge object - which is responsible for themes rendering. Standard sphinx.jinja2glue.TemplateBridge constructs environment attribute in init method (it's not a constructor, unfortunate name for method) - w...
1
0
0
I'd like to implement custom navigation to my sphinx docs. I use my custom theme based on basic sphinx theme. But I don't know how to create new tag for template system or use my custom sphinx plugin's directive in html templates. Any ideas where I can plug in? Update As I can see in sphinx sources, jinja2 environment ...
Custom jinja2 tag in sphinx template
1.2
0
0
737
21,890,973
2014-02-19T19:54:00.000
3
1
0
1
python,openshift
21,893,287
2
true
0
0
You are looking for the add-on cartridge that is called cron. However, by default the cron cartridge only supports jobs that run every minute or every hour. You would have to write a job that runs minutely to determine if its a 10 minute interval and then execute your script. Make sense? rhc cartridge add cron -a you...
1
1
0
How to create shedule on OpenShift hosting to run python script that parses RSS feeds and will send filtered information to my email? It feature is available? Please help, who works with free version of this hosting. I have script that works fine. But i dont know how to run it every 10 min to catch freelance jobs. Or a...
OpenShift, Python Application run script every 10 min
1.2
0
0
1,892
21,892,302
2014-02-19T20:58:00.000
1
0
0
0
python,amazon-web-services,cron,queue,boto
21,899,718
1
false
1
0
Question: (1) How to use boto to pass the variable/argument to another AWS instance and start a script to work on those variable Use shared datasource, such as DynamoDB or messaging framework such as SQS and .. use boto to retrieve the result back to the master box. Again, shared datasource, or messaging. (2) W...
1
0
0
I have 200,000 URLs that I need to scrape from a website. This website has a very strict scraping policy and you will get blocked if the scraping frequency is 10+ /min. So I need to control my pace. And I am thinking about start a few AWS instances (say 3) to run in parallel. In this way, the estimated time to collect...
BOTO distribute scraping tasks among AWS
0.197375
0
1
262
21,893,973
2014-02-19T22:28:00.000
0
0
0
0
python,algorithm,graph,scipy,mathematical-optimization
21,894,459
2
false
0
0
The prohibition against self-flows makes some instances of this problem infeasible (e.g., one node that has in- and out-flows of 1). Otherwise, a reasonably sparse solution with at most one self-flow always can be found as follows. Initialize two queues, one for the nodes with positive out-flow from lowest ID to highes...
1
0
1
I'm looking for a solution to the following graph problem in order to perform graph analysis in Python. Basically, I have a directed graph of N nodes where I know the following: The sum of the weights of the out-edges for each node The sum of the weights of the in-edges for each node Following from the above, the sum...
SciPy - Constrained Minimization derived from a Directed Graph
0
0
0
200
21,895,657
2014-02-20T00:30:00.000
0
0
0
0
python,pygame
21,896,365
2
false
0
1
This one is pretty easy, its seems you forgot to add a event callback. state 1 while (sate != 0): for event in pygame.event.get():
1
5
0
I just recently learned Python and Pygame library. I noticed that the rendering and main loop is automatically paused when I click and hold on the window menu bar (the bar with the title/icon). For example, in a snake game, the snake will be moving every frame. When I click and hold (or drag) the window menu, the snak...
Pygame built-in automatic pause?
0
0
0
430
21,896,030
2014-02-20T01:06:00.000
5
0
0
0
python,numpy,copy-on-write
21,900,644
2
true
0
0
Copy-on-write is a nice concept, but explicit copying seems to be "the NumPy philosophy". So personally I would keep the "readonly" solution if it isn't too clumsy. But I admit having written my own copy-on-write wrapper class. I don't try to detect write access to the array. Instead the class has a method "get_array(r...
1
4
1
I have a class that returns large NumPy arrays. These arrays are cached within the class. I would like the returned arrays to be copy-on-write arrays. If the caller ends up just reading from the array, no copy is ever made. This will case no extra memory will be used. However, the array is "modifiable", but does not mo...
NumPy Array Copy-On-Write
1.2
0
0
2,415
21,896,157
2014-02-20T01:19:00.000
1
0
0
0
python,image,flask,memcached
21,925,544
1
true
1
0
Yes, you can do it. Create a controller or serlvet called for example www.yoursite.com/getImage/ID When you execute this URL, your program shoud connect to the memcached and return the image object that you have previously stored in it. Finally when in your html you add: src="www.yoursite.com/getImage/ID" the browser...
1
0
0
Im writing simple blogging platform in Flask microframework, and I'd like to allow users to change image on the front page but without actually writing it into filesystem. Is it possible to point src attribute in img tag to an object stored in memory?
Using memcached to host images
1.2
0
0
112
21,897,254
2014-02-20T03:03:00.000
0
0
1
0
python,windows,python-2.7
35,723,227
1
false
0
0
You have typed Python. You need a lower case: python. (obviously, make sure you have it installed first, unlike mac os x, it does not come with most default installations).
1
0
0
I have opened and Powershell and when I type Python I get the message, The term 'Python' is not recognized as the name of a cmdlet, function, scriptfile, or operable program, I did like the book said and typed in the [Enviroment]::SetEnviromentVariable etc. Still not working. What do I try next. I'm running Windows 7.
Learning Python the Hardway
0
0
0
95
21,899,681
2014-02-20T06:14:00.000
1
0
0
0
python-2.7,pyqt4,mouseover,qlineedit
21,900,144
2
false
0
1
You can use enterEvent, leaveEvent, enterEvent is triggered when mouse enters the widget and leave event is triggered when the mouse leaves the widget. These events are in the QWidget class, QLineEdit inherits QWidget, so you can use these events in QLineEdit. I you don't see these events in QLineEdit's documentation, ...
1
2
0
I have a QLineEdit, and I need to know if there is a signal which can track mouse hover over that QLineEdit, and once mouse is over that QLineEdit it emits a signal. I have seen the documents, and found we have the following signals: cursorPositionChanged ( int old, int new ) editingFinished () returnPressed () ...
QLineEdit hover-over Signal - when mouse is over the QlineEdit
0.099668
0
0
1,894
21,902,861
2014-02-20T09:02:00.000
0
0
0
0
python,openerp,record,crud,access-rights
21,903,368
1
true
1
0
It seems this one works: Needed to create two rules (applies r,w,c): ['&', ('user_id','=',user.id),('state','=','stage1')] And second rule (applies r): [('stage','=','stage2')]
1
0
0
I need to apply different record rules on same object to give different access rights depending on state that record is. For example there are three stages: stage1, stage2, stage3. On first stage user with specific access rights group can do this: Read, Write, Create his own records. When he presses button to go to sta...
Record rules on same object with different CRUD options?
1.2
0
0
78
21,903,246
2014-02-20T09:18:00.000
1
0
1
1
python,vim
21,903,485
2
true
0
0
Vim's Python integration (i.e. the :python[3] commands that most plugins use) does not depend on the python interpreter binary (from PATH); instead, Vim must have been compiled with the Python library(-ies), which you can check in the :version output (look for +python, and the -DDYNAMIC_PYTHON_DLL=...). To be able to u...
1
1
0
I'm using Vim and lots of Vim plugins, on a Windows machine. Some of these plugins use Python 2, and some use Python 3. I can use only one in the system %PATH% environment variable, how can I overcome this limitation?
Using both Python 2 and 3 in Vim (on Windows)
1.2
0
0
1,174
21,905,084
2014-02-20T10:33:00.000
1
0
1
0
python,vim,spf13vim
21,905,085
1
true
0
0
When folding (or anything) goes awry in VIM, whether you have spf13vim or any other elaborate .vimrc mod, begin with this... rm ~/.vimviews/* ...and restart vim. It cleared this problem up with magic. I hope this helps someone stay young.
1
0
0
I had folding just stop working in my Python sources... without a rhyme or reason. The fix was't immediately obvious and I did not find an answer on SO... I'm using spf13vim and I have tried set foldmethod=indent six ways to Sunday and no dice... I have nothing else futzing with folding in my .vimrc.local and I have ...
What to do when vim syntax folding fails altogether?
1.2
0
0
55
21,905,560
2014-02-20T10:54:00.000
0
0
0
0
python,flask
21,905,637
1
true
1
0
You need to set your router to forward the relevant port to your laptop.
1
0
0
I have flask running on my Macbook (10.9.1 if it makes a difference). I have no problem accessing what I have hosted there over my local network, but I'm trying to see if I can access it publicly. For example load a webpage on my iPhone over it's 3G connection. It doesn't appear to be as simple as /index. With my limit...
Connect to flask over public connection
1.2
0
1
115
21,907,349
2014-02-20T12:07:00.000
0
0
0
0
python,django,amazon-web-services,django-south
21,927,635
2
false
1
0
Turns out the problem was that the git fetch on one of the front servers didnt take, which is what was causing the problem..it had nothing to do with running migrations in parallel (though I shouldnt have done that anyway)
1
0
0
I ran a code update that points at two front end servers (Amazon Web Service Instances). A south migration was included as part of the update.Since the migration the live site appears to flit between the current code revision , and the previous revision, at will. Since discovering this, A previous developer (who has l...
Parrallel south migration in django causes errors
0
0
0
87
21,908,068
2014-02-20T12:38:00.000
3
0
1
0
python,json,django,postgresql
21,909,779
1
false
1
0
Storing data as json (whether in text-typed fields, or PostgreSQL's native jsontype) is a form of denormalization. Like most denormalization, it can be an appropriate choice when working with very difficult to model data, or where there are serious performance challenges with storing data fully normalized into entities...
1
1
0
I'm sometimes using a TextField to store data with a structure that may change often (or very complex data) into model instances, instead of modelling everything with the relational paradigm. I could mostly achieve the same kind of things using more models, foreignkeys and such, but it sometimes feels more straightforw...
Django & postgres - drawbacks of storing data as json in model fields
0.53705
1
0
1,302
21,909,346
2014-02-20T13:31:00.000
1
0
1
1
python,django,elasticsearch,django-haystack
21,909,665
2
true
0
0
I used haystack in my last project. I checked my virtualenv and I have only 'pyelasticsearch==0.5'. Keep in my mind that documentation can be outdated.
1
2
0
How can I install official elasticsearch binding for python instead of pyelasticsearch? Haystack documentation says: You’ll also need an Elasticsearch binding: elasticsearch-py (NOT pyes). Place elasticsearch somewhere on your PYTHONPATH (usually python setup.py install or pip install elasticsearch). But when I i...
Install "elasticsearch" instead of "pyelasticsearch"
1.2
0
0
2,082
21,912,670
2014-02-20T15:44:00.000
1
0
1
0
python,matplotlib,operating-system
21,912,823
2
false
0
0
I would say, ensure that you're using the same backend, fonts, etc. by having identical .matplotlibrc files, and specify the dpi of your plots in your code.
2
1
0
It is easily verified that depending of the version/operating system, the plots done with Python differ meaningly in its appearance/resolution: how to solve that?
Ambiguity at the time of plotting
0.099668
0
0
35
21,912,670
2014-02-20T15:44:00.000
0
0
1
0
python,matplotlib,operating-system
21,914,524
2
false
0
0
Beyond different .matplotlibrc files, there are two likely reasons for this. 1) Different fonts. For example, Arial is likely to be the default san serif on Windows, but it usually isn't available on Linux. This is the main reason why you'd see different results. The resolution shouldn't change, however. 2) The i...
2
1
0
It is easily verified that depending of the version/operating system, the plots done with Python differ meaningly in its appearance/resolution: how to solve that?
Ambiguity at the time of plotting
0
0
0
35
21,912,993
2014-02-20T15:57:00.000
0
0
0
0
python,django,sqlite,rest,orm
21,914,906
1
false
1
0
It depends on what your application is doing. If your REST application reads a piece of data from SQLITE using the Django ORM and then the other app does a write you can run into some interesting race situations. To prevent that it might make sense to have both these applications as django-app in a single Django proj...
1
0
0
I have a django app which provides a rest api using Django-rest-framework. The API is used by clients as expected, but I also have another process(on the same node) that uses Django ORM to read the app's database, which is sqlite3. Is it better architecture for the process to use the rest api to interact(only reads) wi...
SOA versus Django ORM with multiple processes
0
1
0
138
21,914,998
2014-02-20T17:17:00.000
3
0
1
0
python,list,recursion
21,915,140
2
false
0
0
Well, first, you couldn't have infinite list comprehensions, because list comprehensions actually construct real lists. Fitting the Fibonacci sequence into RAM would be tricky. You might instead ask for a recursive generator expression, because it wouldn't use infinite memory. But we already have generator functions fo...
2
4
0
I think list comprehension is one of the most useful features of Python. I think it would be even more useful if Python allows the recursion inside list comprehension, for something like generation of Fibonacci numbers or prime numbers. I know that Python used to have locals()['_[1]'] for referencing the list that's be...
Is there any reason why recursive list comprehension is prohibited (or not recommended) in Python?
0.291313
0
0
524
21,914,998
2014-02-20T17:17:00.000
3
0
1
0
python,list,recursion
21,915,387
2
false
0
0
I believe this is related to the general guideline that list comprehensions and generator expressions should only be used when they are more simple, clear and clean than the equivalent explicit loop, and this to the point that nested comprehensions, although supported, are generally discouraged from a stylistic point o...
2
4
0
I think list comprehension is one of the most useful features of Python. I think it would be even more useful if Python allows the recursion inside list comprehension, for something like generation of Fibonacci numbers or prime numbers. I know that Python used to have locals()['_[1]'] for referencing the list that's be...
Is there any reason why recursive list comprehension is prohibited (or not recommended) in Python?
0.291313
0
0
524
21,915,864
2014-02-20T17:58:00.000
0
0
1
0
python
21,916,124
3
false
0
0
StringIO has moved in Python 3. Try from io import StringIO. You also need to decide whether you want a StringIO or a BytesIO. However, it sounds as though you're trying to monkey-patch over sys.stdout in (something like) a unit test. I wouldn't recommend doing this in your tests unless you're sure you need to; it'll m...
1
2
0
I'm calling a function and trying to capture the output it prints out, but in 3.3 I don't have access to StringIO. Is there another method around this?
Capture what a Python function prints out in 3.3?
0
0
0
84
21,918,718
2014-02-20T20:23:00.000
1
0
1
0
python,matplotlib,plot,weather
21,919,317
3
false
0
0
Matplotlib xticks are your friend. Will allow you to set where the ticks appear. As for date formatting, make sure you're using dateutil objects, and you'll be able to handle the formatting.
2
0
1
I want to plot weather data over the span of several days every half hour, but I only want to label the days at the start as a string in the format 'mm/dd/yy'. I want to leave the rest unmarked. I would also want to control where such markings are placed along the x axis, and control the range of the axis. I also want ...
How to label certain x values
0.066568
0
0
2,934
21,918,718
2014-02-20T20:23:00.000
2
0
1
0
python,matplotlib,plot,weather
21,919,748
3
false
0
0
You can use a DayLocator as in: plt.gca().xaxis.set_major_locator(dt.DayLocator()) And DateFormatter as in: plt.gca().xaxis.set_major_formatter(dt.DateFormatter("%d/%m/%Y")) Note: import matplotlib.dates as dt
2
0
1
I want to plot weather data over the span of several days every half hour, but I only want to label the days at the start as a string in the format 'mm/dd/yy'. I want to leave the rest unmarked. I would also want to control where such markings are placed along the x axis, and control the range of the axis. I also want ...
How to label certain x values
0.132549
0
0
2,934
21,921,509
2014-02-20T22:56:00.000
1
0
0
0
python,sockets,network-programming
22,111,178
2
false
0
0
Firewall may be the explanation behind this unexpected response. Rather than supposing the remote firewall accepts connection, using timeout is the best option. Since, making a connection is a swift process and within a network, it won't take longer time. So, give a proper timeout so that you can tell that the host is ...
2
1
0
I'm learning to use sockets in python and something weird is happening. I call socket.connect in a try block, and typically it either completes and I have a new socket connection, or it raises the exception. Sometimes, however, it just hangs. I don't understand why sometimes it returns (even without connecting!) and ...
Python socket.connect hangs sometimes
0.099668
0
1
2,733
21,921,509
2014-02-20T22:56:00.000
3
0
0
0
python,sockets,network-programming
21,921,616
2
true
0
0
When connect() hangs it is usually because you connect to an address that is behind a firewall and the firewall just drops your packets with no response. It keeps trying to connect for around 2 minutes on Linux and then times out and return an error.
2
1
0
I'm learning to use sockets in python and something weird is happening. I call socket.connect in a try block, and typically it either completes and I have a new socket connection, or it raises the exception. Sometimes, however, it just hangs. I don't understand why sometimes it returns (even without connecting!) and ...
Python socket.connect hangs sometimes
1.2
0
1
2,733
21,923,046
2014-02-21T00:56:00.000
0
1
0
1
python
21,923,164
4
false
0
0
If you can put your own programs or scripts on the remote machine there are a couple of things you can do: Write a script on the remote machine that outputs just what you want, and execute that over ssh. Use ssh to tunnel a port on the other machine and communicate with a server on the remote machine which will respon...
1
1
0
I would like to be able to gather the values for number of CPUs on a server and stuff like storage space etc and assign them to local variables in a python script. I have paramiko set up, so I can SSH to remote Linux nodes and run arbitrary commands on them, and then have the output returned to the script. However, man...
Reading values over ssh in python
0
0
0
1,205
21,923,479
2014-02-21T01:37:00.000
1
0
1
1
python,macos,python-2.7,python-3.x
21,923,496
1
true
0
0
In general, no, you can't do that easily. Just bite the bullet and install new copies of the modules you need for your Python 3 installation. Remember to first install a new copy of pip (or, if you must, easy_install) using your Python 3.3 and use it to install the modules you need for Python 3. One of the reasons yo...
1
0
0
I would like to use installed Python 2 modules in Python 3. One step would be to add to the PythonPath3 the directories where the Python2 modules are installed. Of course this would work only if the modules are coded for Python3 compatibility. Is there a way that I can import modules in Python3 and have them automatica...
Use python 2 module in python 3 in mac OS
1.2
0
0
333
21,929,329
2014-02-21T08:40:00.000
0
0
0
1
python-3.x,operating-system,zip
21,941,266
1
false
0
0
You could check using the zipfile module. It will check for everything that is needed to run. If the OS version of zip is missing the import of the module will either fail (because it's missing) or the module works without the OS version (which should be fine too). I can't think of any other easy, portable approach. On...
1
0
0
I try to work through Byte of Python3 and there is an example script for backing up folders and creating a zip file. I would like the script to check if zip is available within the os (Windows, Linux, Mac). Is there a way you can do this? Thanks, Mark
Checking with Python3 if ZIP is installed on OS (Terminal)
0
0
0
34
21,933,555
2014-02-21T11:43:00.000
0
1
1
0
python,import
21,934,129
3
false
0
0
Firstly, it's a violation of PEP8 using imports inside functions. Calling import it's an expensive call EVEN if the module is already loaded, so if your function is gonna being called many times this will not compensate the performance gain. Also when you call "import test" python do this: dataFile = __ import__('test'...
1
0
0
I am writing a python module and I am using many imports of other different modules. I am bit confused that whether I should import all the necessary dependent modules in the opening of the file or shall I do it when necessary. I also wanted to know the implications of both. I come from C++ back ground so I am really...
import module_name Vs __import__('module_name')
0
0
0
2,473
21,933,610
2014-02-21T11:46:00.000
0
0
1
0
python,rdf,owl,ontology,rdflib
28,051,822
1
false
0
0
If I have a rdflib.Uriref that point to a resource that I do not need any more. How can i remove it safely using rdflib. An RDF graph is just a collection of triples. It doesn't contain any resources or nodes independent of those triples. If for example I just remove all the triples that refer to it may be a c...
1
0
0
If I have a rdflib.Uriref that point to a resource that I do not need any more. How can i remove it safely using rdflib. If for example I just remove all the triples that refer to it may be a could broke something like a Bnode that is a list.
Remove Safely Reference in rdflib
0
0
0
281
21,936,158
2014-02-21T13:45:00.000
4
0
1
0
python,version-control,virtualenv,ignore,pyc
21,936,238
1
true
1
0
That is fine, just remove them! Python auto-generates them from the corresponding .py file any time it wants to, so you needn't worry about simply deleting them all from your repository. A couple of related tips - if you don't want them generated at all on your local dev machine, set the environment variable PYTHONDON...
1
2
0
I've created a virtualenv for my project and checked it into source control. I've installed a few projects into the virtualenv with pip: django, south, and pymysql. After the fact I realized that I had not set up source control for ignoring .pyc files. Could there be any subtle problems in simply removing all .py...
clean up .pyc files in virtualenv stored in souce repository after the fact?
1.2
0
0
1,403
21,937,072
2014-02-21T14:25:00.000
0
1
0
0
python,html,django
21,937,650
3
false
1
0
Why you do not do simple form on index page when user is not authenticated?
1
3
0
Here is the deal, how do I put the simplest password protection on an entire site. I simply want to open the site to beta testing but don't really care about elegance - just a dirty way of giving test users a username and password without recourse to anything complex and ideally i'd like to not to have to install any c...
Whats the smartest way to password protect an entire Django site for testing purposes
0
0
0
4,949
21,941,030
2014-02-21T17:23:00.000
0
0
0
1
python,google-app-engine,mapreduce,task-queue
21,962,823
2
false
1
0
First, writes to the datastore take milliseconds. By the time your user hits the refresh button (or whatever you offer), the data will be as "real-time" as it gets. Typically, developers become concerned with real-time when there is a synchronization/congestion issue, i.e. each user can update something (e.g. bid on an...
1
1
0
I am trying to design an app that uses Google AppEngine to store/process/query data that is then served up to mobile devices via Cloud Endpoints API in as real time as possible. It is straight forward enough solution, however I am struggling to get the right balance between, performance, cost and latency on AppEngine. ...
AppEngine real time querying - cost, performance, latency balancing act and quotas
0
1
0
173
21,941,503
2014-02-21T17:45:00.000
2
0
0
0
python,django,django-admin
21,943,591
5
false
1
0
You can use signals. Than use os.remove() to clean up related files on delete. This way your file system always reflects you db. No need for hitting some button.
1
37
0
I have a django project in which the admins are able to upload media. As items sell, they are deleted from the site, thus removing their entry in the MySQL database. The images associated with the item, however, remain on the file system. This isn't neccessarily bad behavior - I don't mind keeping files around in case ...
Django delete unused media files
0.07983
0
0
19,573
21,942,110
2014-02-21T18:15:00.000
1
0
0
0
python,linux,django,heroku
21,942,195
1
true
1
0
You create it in the project root.
1
0
0
I am sorry if this is too basic of a question but I spent the whole morning unsuccessfully figuring it out. I want to use the Heroku Scheduler for a Django app, and as per their documentary, I am supposed to put the python file I wan't to be executed by the Scheduler in the bin/ folder on Heroku. Now on my local copy...
Heroku: Putting a file in the bin folder
1.2
0
0
301
21,944,428
2014-02-21T20:23:00.000
1
0
1
1
python,pylint
21,945,800
1
false
0
0
set PATH=%PATH%;C:\python27\scripts is apparently what i needed to make it work... thanks for the path direction.
1
3
0
I've just installed all the dependencies (asteroid and logilab-commons) and pylint, ran the tests for pylint and they all passed, but i just cant get pylint to work... i keep getting 'pylint' is not recognized as an internal or external command, operable program or batch file. while running in the command prompt. i...
Not being able to run pylint using windows (7) command prompt
0.197375
0
0
4,751
21,947,487
2014-02-21T23:49:00.000
-1
0
1
0
python,string,pandas,extract
21,947,575
2
false
0
0
This will grab the number 10 and put it in a variable called yards. x = "(12:25) (No Huddle Shotgun) P.Manning pass short left to W.Welker pushed ob at DEN 34 for 10 yards (C.Graham)." yards = (x.split("for ")[-1]).split(" yards")[0]
1
4
1
I have an NFL dataset with a 'description' column with details about the play. Each successful pass and run play has a string that's structured like: "(12:25) (No Huddle Shotgun) P.Manning pass short left to W.Welker pushed ob at DEN 34 for 10 yards (C.Graham)." How do I locate/extract the number after "for" in the str...
Extract a certain part of a string after a key phrase using pandas?
-0.099668
0
0
4,497
21,947,723
2014-02-22T00:11:00.000
-1
0
0
0
python,session,flask,flask-login
21,947,739
4
false
1
0
Nope. That's literally impossible over pure HTTP. HTTP is a stateless protocol, which means that in order to preserve state, the client has to be able to identify itself on every request. What you might be able to do is HTTP Basic Authentication over HTTPS, then access that Authentication on the server side.
2
4
0
I'm working on a Flask app to be used by a medical client. Their IT dept is so up tight about security that they disable cookies and scripting network-wide. Luckly, wtf-forms was able to address one of these issues with server-side validation of form input. However, I'm getting hung up on the login system. I've imple...
Possible to make flask login system which doesn't use client-side session/cookie?
-0.049958
0
0
1,749
21,947,723
2014-02-22T00:11:00.000
1
0
0
0
python,session,flask,flask-login
21,947,780
4
false
1
0
With such restrictions as not having zero client side data, you could pass a session token in the GET parameters of every link rendered in the html page. Or you could create only POST views with a hidden token input (may be more secure indeed).
2
4
0
I'm working on a Flask app to be used by a medical client. Their IT dept is so up tight about security that they disable cookies and scripting network-wide. Luckly, wtf-forms was able to address one of these issues with server-side validation of form input. However, I'm getting hung up on the login system. I've imple...
Possible to make flask login system which doesn't use client-side session/cookie?
0.049958
0
0
1,749
21,950,193
2014-02-22T05:32:00.000
1
0
0
1
python,macos,postgresql,openerp,openerp-7
22,423,411
2
true
0
0
Install PostgreSQL Create a user for OpenERP Install all dependencies for Python, using brew or MacPorts Download OpenERP and extract it Run the following command: cd openerp; python openerp-server
1
2
0
I want to install OpenERP v7 on Mac OS X. How can I install it? I tried to install it brew install postgresql I succeed to install postgresql but when I create the user with following command createuser openerpI got the error like createuser:command not found I also got an error when I type psql.
How to install OpenERP on Mac OS X Mavericks?
1.2
0
0
7,748
21,951,190
2014-02-22T07:22:00.000
3
1
1
0
python
21,951,214
1
true
0
0
The best way would be to create something called a settings.py file, that houses are your shared variables of importance. This approach is followed by the django team for their web framework called django, whcih creates a settings.py file to house all the data that needs to be shared, for example database logins, and s...
1
1
0
In php, people often call a bootstrap file to set variables used throughout a program. I have a python program that calls methods from different modules. I want those methods from different modules to share some variables. Can I set these variables up in something like a boostrap.py? Or is this not very "pythonic" beca...
Is there an equivalent of a bootstrap.php for python?
1.2
0
0
113
21,952,650
2014-02-22T09:56:00.000
0
1
0
1
python,printing,background,raspberry-pi
21,953,931
1
false
0
0
1) You should never run a script with sudo. You could potentially destroy your system. 2) Once your SSH session is closed all processes go with it. That is unless you use nohup or screen as you have found.
1
0
0
I have learned online that there are several ways of running a python program in the background: sudo python scriptfile.py& sudo python scriptfile.py, then Control+Z, then bg Using nohup Using screen However, I would like to know if when doing any of the first two options, after I close and reopen SSH again, I can re...
Raspberry Pi (python) Run in background and reopen print output
0
0
0
655
21,957,966
2014-02-22T17:45:00.000
0
0
1
0
python,multithreading
21,958,016
3
false
0
0
You could have the thread function set a boolean flag on startup, and then check that flag.
1
5
0
How to determine if a python thread has been started? There is a method is_alive() but this is true before and while a thread is running.
Determine if thread has been started
0
0
0
4,522
21,962,475
2014-02-23T00:15:00.000
0
0
0
1
python,django,.htaccess,subdomain,virtualenv
21,969,799
2
true
1
0
The issue was solved by contacting the support service and asking them to open the port 8000 for me.
1
0
0
I just installed Django and create a project and an app following the basic tutorial part 1, I created a virtualenv since centOS default python version is 2.4.3, I also created a subdomain to work on this for the development phase. when I try to access like dev.domain.com/admin/ or dev.domain.com/ I get a 404 error, it...
Error 404 when trying to access a Django app installed in a subdomain
1.2
0
0
718
21,963,270
2014-02-23T02:09:00.000
0
1
0
1
python,output
49,316,597
8
false
0
0
You could also do this by going to the path of the folder you have the python script saved at with cmd, then do the name.py > filename.txt It worked for me on windows 10
2
13
0
I'm executing a .py file, which spits out a give string. This command works fine execfile ('file.py') But I want the output (in addition to it being shown in the shell) written into a text file. I tried this, but it's not working :( execfile ('file.py') > ('output.txt') All I get is this: tugsjs6555 False I guess "Fals...
How to execute a python script and write output to txt file?
0
0
0
92,210
21,963,270
2014-02-23T02:09:00.000
2
1
0
1
python,output
33,993,200
8
false
0
0
The simplest way to run a script and get the output to a text file is by typing the below in the terminal: PCname:~/Path/WorkFolderName$ python scriptname.py>output.txt *Make sure you have created output.txt in the work folder before executing the command.
2
13
0
I'm executing a .py file, which spits out a give string. This command works fine execfile ('file.py') But I want the output (in addition to it being shown in the shell) written into a text file. I tried this, but it's not working :( execfile ('file.py') > ('output.txt') All I get is this: tugsjs6555 False I guess "Fals...
How to execute a python script and write output to txt file?
0.049958
0
0
92,210
21,967,398
2014-02-23T11:08:00.000
27
0
0
1
python,celery,luigi
25,704,688
2
true
1
0
Update: As Erik pointed, Celery is better choice for this case. Celery: What is Celery? Celery is a simple, flexible and reliable distributed system to process vast amounts of messages, while providing operations with the tools required to maintain such a system. Why use Celery? It is simple to use & has lots of featu...
2
37
0
I am using django as a web framework. I need a workflow engine that can do synchronous as well as asynchronous(batch tasks) chain of tasks. I found celery and luigi as batch processing workflow. My first question is what is the difference between these two modules. Luigi allows us to rerun failed chain of task and onl...
Python based asynchronous workflow modules : What is difference between celery workflow and luigi workflow?
1.2
0
0
8,450
21,967,398
2014-02-23T11:08:00.000
45
0
0
1
python,celery,luigi
34,112,320
2
false
1
0
(I'm the author of Luigi) Luigi is not meant for synchronous low-latency framework. It's meant for large batch processes that run for hours or days. So I think for your use case, Celery might actually be slightly better
2
37
0
I am using django as a web framework. I need a workflow engine that can do synchronous as well as asynchronous(batch tasks) chain of tasks. I found celery and luigi as batch processing workflow. My first question is what is the difference between these two modules. Luigi allows us to rerun failed chain of task and onl...
Python based asynchronous workflow modules : What is difference between celery workflow and luigi workflow?
1
0
0
8,450
21,967,466
2014-02-23T11:14:00.000
0
0
1
0
python,dsl,xtext
22,065,084
1
false
0
0
Well, I think the answer is quite simple: I can generate the code in a XML or pyconf format and read from python :) thank you anyway
1
0
0
I am new to DSL area and I am developing a DSL language. I will need to provide an editor to write the in that language what makes Xtext a very good option. However, some of my libraries are in Python and I need to "run" the DSL in python. Any idea how to integrate them? the perfect scenario would be: Xtext -> Pass the...
Xtext integration with Python
0
0
0
780
21,969,258
2014-02-23T14:08:00.000
1
0
1
0
python,matlab,ipython
21,969,604
3
false
0
0
I guess you'll have to reimport your module on every code change. And you could use from my_module import * to avoid module name before every function call, though this construction works slowly.
1
4
0
If you are familiar to Matlab you know that you are able to use any defined function from its definition file, if it is in the workspace path, you do not need to call or import. Is there any mechanism in ipython mimics that behaviour of matlab. My current work flow is to write the code in the Sublime text and paste it ...
How can I use python code file as you type in ipython console?
0.066568
0
0
291
21,970,771
2014-02-23T16:12:00.000
2
0
1
0
python,django,python-2.7,ide,pycharm
27,070,676
2
false
1
0
Another option would be to place libraries into separate project (or go even further and place each library in its own project) and then open this project/these projects side-by-side with the main project. This way you have clear separation between the main project and libraries used. This comes handy when you work on ...
1
13
0
I have an issue where I am developing a Django project which includes other libraries we are also developing. My current structure is as follows: Main Project App1 App2 Libraries Library 1 Library 2 All libraries have their own setup scripts and are in separate git repositories, and we are adding them in P...
PyCharm include and modify External library in project
0.197375
0
0
15,029
21,973,249
2014-02-23T19:19:00.000
0
1
0
0
python,matplotlib,gnuplot,swig
21,977,146
2
false
0
0
You should start by reading the first few chapters of swig manual, and making some of its example projects for python, the distrib has many that illustrate many different capabilities of swig and the make files are already built so one less thing to learn.
1
0
0
I want to access some functions from a large C-project from Python. It seems to me that SWIG is the way to go. I'm not very used to programming i C and my experience with "make" is mostly from downloading source tars. The functions I want to access resides in a large C-project (Gnuplot) and I have no idea who to use SW...
Using SWIG to interface large C-project with Python
0
0
0
728
21,974,997
2014-02-23T21:45:00.000
4
0
1
0
python,python-2.7,python-3.x,pip
22,714,674
2
true
0
0
Try these two solutions: 1)Remove python3.3 from the path variable and try installing library using pip now. so that pip from python27 can install things. 2)if this doesn't work then use C:\python27\Scripts\pip.exe install
1
0
0
I am using pip to pull down libraries but didnt realize the key one is only for 2.7. So now I am working in the 2.7 directory but pip is still installing libs in 3.3. So pyCharm keeps saying the lib is missing. I have the PATH var set (this is gasp fn windows 8) so that Python 2.7 comes first but i think the python e...
Is it practical to have both Python 2.7 and 3.3 installed at the same time?
1.2
0
0
739
21,976,383
2014-02-23T23:49:00.000
11
0
0
0
python,django,shell,sqlite
23,184,956
4
true
1
0
I meet the same problem today and fix it I think you miss some command in tutorial 1 just do follow: ./python manage.py makemigrations polls python manage.py sql polls ./python manage.py syncdb then fix it and gain the table polls and you can see the table created you should read the "manage.py makemigrations" command
1
5
0
Going through Django tutorial 1 using Python 2.7 and can't seem to resolve this error: OperationalError: no such table: polls_poll This happens the moment I enter Poll.objects.all() into the shell. Things I've already tried based on research through the net: 1) Ensured that 'polls' is listed under INSTALLED_APPS in set...
Django Error: OperationalError: no such table: polls_poll
1.2
1
0
13,012
21,977,987
2014-02-24T02:41:00.000
2
0
1
1
python
21,978,072
2
true
0
0
There are plenty of ways someone can get your program, even if you remove the USB drive. They can install a program that triggers when a USB stick is inserted, search the stick for .py files, and copies them to disk. If the Python installation you're using is on the disk instead of the USB drive, they can replace the ...
2
0
0
When I run a program from a USB memory, and remove the USB memory the program still goes on running (I mean with out really copying the program into the Windows PC). However, does the program make its copy inside the Windows in any hidden location or temporary folder while running by the python IDLE. From where the pyt...
Running a Python Program Hiding the Source
1.2
0
0
121
21,977,987
2014-02-24T02:41:00.000
0
0
1
1
python
21,978,357
2
false
0
0
It sounds like you are doing something you probably shouldn't be doing. Depending on how much people want your code they could go as far as physically freezing the ram and doing a forensic IT analysis. In short, you can't prevent code cloning on a machine you don't administer.
2
0
0
When I run a program from a USB memory, and remove the USB memory the program still goes on running (I mean with out really copying the program into the Windows PC). However, does the program make its copy inside the Windows in any hidden location or temporary folder while running by the python IDLE. From where the pyt...
Running a Python Program Hiding the Source
0
0
0
121
21,979,038
2014-02-24T04:43:00.000
0
0
0
1
python,google-app-engine,cron,leaderboard
21,979,231
3
false
1
0
Whether this is simpler or not is debatable. I have assumed that ranking is not just a matter of ordering an accumulation of points, in which case thats just a simple query. I ranking involves other factors rather than just current score. I would consider writing out an Event record for each update of points for a ...
2
3
0
I want to build a backend for a mobile game that includes a "real-time" global leaderboard for all players, for events that last a certain number of days, using Google App Engine (Python). A typical usage would be as follows: - User starts and finishes a combat, acquiring points (2-5 mins for a combat) - Points are acc...
Global leaderboard in Google App Engine
0
0
0
930
21,979,038
2014-02-24T04:43:00.000
2
0
0
1
python,google-app-engine,cron,leaderboard
21,980,623
3
true
1
0
You don't need 50,000 reads or 50,000 writes. The solution is to set a sorting order on your points property. Every time you update it, the datastore will update its order automatically, which means that you don't need a rank property in addition to the points property. And you don't need a cron job, accordingly. Then,...
2
3
0
I want to build a backend for a mobile game that includes a "real-time" global leaderboard for all players, for events that last a certain number of days, using Google App Engine (Python). A typical usage would be as follows: - User starts and finishes a combat, acquiring points (2-5 mins for a combat) - Points are acc...
Global leaderboard in Google App Engine
1.2
0
0
930
21,979,134
2014-02-24T04:52:00.000
6
0
1
0
python,python-3.x
21,979,218
2
true
0
0
They are bitwise shift operators. For example, 2 has the binary equivalent 00000010, so 2 << 1 is 00000010 shifted left 1 time. This yields 00000100, which is 4. 1 >> 2 is 00000001 shifted right 2 times which is 00000000 (the 1 falls off the end after the first shift though, so 1>>1 is also 0), obviously that is 0.
2
1
0
If I do print(1 >> 2) I get 0. If I do print(2 << 1) I get 4. If I do print(9 << 3) I get 72 If I do print(3 >> 9) I get 0 What do >> and << do in python?
What do >> and << do in python
1.2
0
0
88
21,979,134
2014-02-24T04:52:00.000
3
0
1
0
python,python-3.x
21,979,149
2
false
0
0
Bitwise shift left and bitwise shift right. They're roughly equivalent to doubling (<<) or halving (>>) just like decimal shift left is roughly equivalent to multiplying by 10 and decimal shift right is roughly equivalent to dividing by 10.
2
1
0
If I do print(1 >> 2) I get 0. If I do print(2 << 1) I get 4. If I do print(9 << 3) I get 72 If I do print(3 >> 9) I get 0 What do >> and << do in python?
What do >> and << do in python
0.291313
0
0
88
21,981,387
2014-02-24T07:25:00.000
0
0
0
1
python,google-app-engine,task
21,981,710
2
false
1
0
It seems impossible to guarantee that B will be next.
2
1
0
On taskqueue in gae. For example, I have task A, B. How to ensure that task B starts right after task A finishes. There could be other tasks, like C, to fix this problem. Also, 'right after' could be loose to 'after'. How about a dedicate queue with max_current_requests set to 1?
How to make a task start right after another one finish in google app engine?
0
0
0
159
21,981,387
2014-02-24T07:25:00.000
2
0
0
1
python,google-app-engine,task
21,982,975
2
false
1
0
If you only have two tasks, you can start task B at the end of task A. For example, a task that updates user scores can start a task to send emails after it finished updating scores. In this case, you are guaranteed that task B is executed after task A, but there is no guarantee that there is no task C in between them ...
2
1
0
On taskqueue in gae. For example, I have task A, B. How to ensure that task B starts right after task A finishes. There could be other tasks, like C, to fix this problem. Also, 'right after' could be loose to 'after'. How about a dedicate queue with max_current_requests set to 1?
How to make a task start right after another one finish in google app engine?
0.197375
0
0
159
21,983,713
2014-02-24T09:33:00.000
1
0
1
0
python,twisted,pyinstaller,zope.interface
21,988,632
2
false
0
0
finally problem solved. Problem is zope.interface is not getting added in PYTHONPATH. Actually I have tried different setups (like pip & exe), though it was not getting added. Exact reason I don't know. But after installing zope.interface using 'easy_install ', it is added in PYTHONPATH & I am able to create executable...
1
0
0
I am trying to create standalone exe of twisted application using PyInstaller. Everything is ok, even executable file is getting build, but its not working. I mean if try to execute it gives error 'Import error: Twisted requires zope.interface 3.6.0 or later: no module named zope.interface." I already have installed zo...
Pyinstaller import error: zope.interface not found
0.099668
0
0
1,987
21,986,203
2014-02-24T11:17:00.000
3
0
0
0
python,openerp,openerp-7
21,987,900
1
true
1
0
you can write a stored functional integer field on hr.employee with a function returning the month as integer. then you can use this field for filters.
1
0
0
In HR module, in Employee form, I want to create a filter which gives me list of all employees whose birthday's appear in current month. Currently I am trying with static month, as below - but gives me error. [('birthday.month','=','02')] Error: File "/usr/lib/pymodules/python2.7/openerp/osv/expression.py", line 107...
How to create a filter which compares only month in date type in OpenERP?
1.2
0
0
670
21,986,356
2014-02-24T11:24:00.000
2
0
0
0
python,opencv,image-processing
21,987,220
3
false
0
0
If you think that there will not be any change in the shape (i mean arc won't become line or something like this) then you can have a look a Generalized Hough Transform (GHT) which can detect any shape you want. Cons: There is no directly function in openCV library for GHT but you can get several source code at intern...
2
1
1
I am trying to detect arcs inside an image. The information that I have for certain with me is the radius of the arc. I can try and maybe get the centre of the circle whose arc I want to identify. Is there any algorithm in Open CV which can tell us that the detected contour ( or edge from canny edge is an arc or an app...
Detect an arc from an image contour or edge
0.132549
0
0
5,077
21,986,356
2014-02-24T11:24:00.000
1
0
0
0
python,opencv,image-processing
22,008,350
3
false
0
0
You can do it this way: Convert the image to edges using canny filter. Make the image binary using threshold function there is an option for regular threshold, otsu or adaptive. Find contours with sufficient length (findContours function) Iterate all the contours and try to fit ellipse (fitEllipse function) Validate f...
2
1
1
I am trying to detect arcs inside an image. The information that I have for certain with me is the radius of the arc. I can try and maybe get the centre of the circle whose arc I want to identify. Is there any algorithm in Open CV which can tell us that the detected contour ( or edge from canny edge is an arc or an app...
Detect an arc from an image contour or edge
0.066568
0
0
5,077
21,986,588
2014-02-24T11:35:00.000
1
0
1
0
python,python-multithreading
21,986,753
2
false
0
0
Use a Queue from the multithreading module to store the tasks you want to execute. The main loop periodically checks for entries in the queue and executes them one by one when it finds something. You GPIO monitoring threads put their tasks into the queue (only one is required to collect from many threads). You can mode...
1
0
0
I am using Python with the Rasbian OS (based on Linux) on the Raspberry Pi board. My Python script uses GPIOs (hardware inputs). I have noticed when a GPIO activates, its callback will interrupt the current thread. This has forced me to use locks to prevent issues when the threads access common resources. However it is...
Force Python to run in a single thread
0.099668
0
0
2,967
21,988,618
2014-02-24T13:02:00.000
0
0
0
0
python,google-glass
22,016,838
1
false
1
0
A couple of things that are standard debugging practices, and you may want to update the original question to clarify: Did OAuth actually fail? What information do you have that it failed? Can you verify from web server logs that the callback URL was hit and that it contained non-error return values? Can you check you...
1
0
0
I went through the instructions on for the Google Glass Python Quick Start. I deployed the app and the app supposedly finished deploying successfully. I then went to the main URL for the app and attempted to open the page. The page asked me which Google Account I wanted to use to access the app, and I chose one. It wen...
OAuth fails after deploying google glass application
0
0
1
48
21,988,970
2014-02-24T13:18:00.000
3
0
1
0
python,pyobjc
22,010,598
2
true
0
1
The easiest way to ensure problem free usage of the bridge is to ensure that the delegate methods that you use don't use C arrays as arguments or return values and don't use variadic signatures ("..."). Futhermore ensure that all pass-by-reference arguments (such as the commonly used "NSError**" argument) are marked up...
1
1
0
I'm embedding Python in an Objective C application using PyObjC, setting the Python environment up by hand on the ObjC side (i.e. not using py2app). I'm starting the Python in a separate thread (on the ObjC side) with a call to PyRun_File(), and then one to PyObject_CallFunction() to start it doing something (specific...
How do I pass an Objective C instance into a PyObjC Python function when using PyRun_File()/PyObject_CallFunction()?
1.2
0
0
853
21,993,460
2014-02-24T16:33:00.000
2
0
0
0
python,pyramid,chameleon,deform,bokeh
22,392,624
2
false
0
0
You want to use plot.create_html_snippet. This function returns the code that you want to appear in the HTML, the function also writes out an embed file. This is what an embed snippet looks like <script src="http://localhost:5006/static/dc0c7cfd-e657-4c79-8150-6a66be4dccb8.embed.js" bokeh_plottype="embeddata" bokeh...
1
3
0
I have a project with many scripts using Matplotlib. I'd like to build a web interface for this project. How do you place a Bokeh chart within a Chameleon template? I'm using Pyramid and the Deform bootstrap if that matters. Does anyone have a good example out there?
How do you place a Bokeh chart within a Chameleon template?
0.197375
0
0
608
21,995,068
2014-02-24T17:46:00.000
0
0
0
0
python,linux
21,995,095
2
false
0
0
it's not open() it is choking on. It is the with syntax. Context managers did not exist in Python 2.4. you must explicitly close the file also.
1
0
0
When I use open() in python 2.4.3, i get the following error File "/tmp/chgjdbcconfig.py", line 16 with open("text.new", "wt") as fout: ^ SyntaxError: invalid syntax I checked the python version and this is my output Python 2.4.3 I was looking for advice on what could be the alternative. I am...
What is the alternative for open in python 2.4.3
0
0
0
5,875
21,997,897
2014-02-24T20:07:00.000
18
0
0
0
python,matplotlib
21,998,600
2
true
0
0
To get the whiskers to appear at the min and max of the data, set the whis parameter to an arbitrarily large number. In other words: boxplots = ax.boxplot(myData, whis=np.inf). The whis kwarg is a scaling factor of the interquartile range. Whiskers are drawn to the outermost data points within whis * IQR away from the ...
1
11
1
I understand that the ends of whiskers in matplotlib's box plot function extend to max value below 75% + 1.5 IQR and minimum value above 25% - 1.5 IQR. I would like to change it to represent max and minimum values of the data or the 5th and 95th quartile of the data. Is is possible to do this?
Changing what the ends of whiskers represent in matplotlib's boxplot function
1.2
0
0
8,736
21,998,474
2014-02-24T20:37:00.000
0
0
1
0
python,python-2.7,scrapy
22,020,164
1
false
1
0
The only application I see for running at the same time multiple instances of a spider is when each instance will have it's own part of start_urls. But each instance should be run on a different network interface, otherwise you cannot control effectively crawling intensity for the same domain.
1
1
0
I am using scrapy 0.20 with python 2.7 I want to ask, what is the cons and pros of running the same spider twice in the same time? Please know that I am using a pipeline in order to write the results to a json file. Thanks
Running the same spider simultaniously
0
0
0
79
21,999,501
2014-02-24T21:34:00.000
2
0
1
0
python,fixed-point
22,003,552
2
true
0
0
I am assuming that you have (starting from the left end) one sign bit, the assumed binary point, and then seven bits that represent a fractional value. If that's the case then you can just take the signed integer value of the fixed-point number and divide by 128. You'll need to do this division using floating-point val...
1
4
0
I would like to read an 8 bit number that comes in a 2's complement fix8_7 (8 bit number and the binary point is in the 7 bit). How can I do this in Python?
How to read fixed point numbers in python
1.2
0
0
1,245
21,999,711
2014-02-24T21:46:00.000
6
0
0
0
python,matplotlib
22,573,142
2
false
0
0
The FuncAnimation is a subclass of TimedAnimation. It takes frames as an input for update functionm, which could be a number or a generator. It takes repeat as an argument, which is inherited from TimedAnimation, by setting reapeat to False you could stop the animation to repeat itself. PS: Matplotlib documentation is ...
1
4
0
Does anyone know the preferred method for stopping FuncAnimation? I am using it to record data from a oscilloscope and would like to be able to pause and restart the data on demand. Is there any way I can send a button click event to it? Thanks, Derek
Python - Stop FuncAnimation
1
0
0
6,236
22,000,918
2014-02-24T22:55:00.000
1
0
0
0
python,web-services,api,rest,amazon-web-services
22,004,122
2
false
1
0
A bit broad really especially the Python part. Yes this can be considered a API. Think of SOAP and REST services as an API available via the network. This question is opinion based and not suited for discussion here. A guideline is that if it works for you it is good. Yes you should use the REST services for the webs...
1
0
0
I just decided to start working on a mobile application for fun, but it will require a back-end. So I created an EC2 instance on Amazon Web Services, with an Amazon Linux AMI installed. I also have set up an database instance as well, and inserted some dummy data in there. Now, the next step I want to take is to wri...
A Few questions on writing a RESTful web service
0.099668
0
1
81
22,001,176
2014-02-24T23:12:00.000
1
0
0
0
python,csv,pandas
22,001,369
1
false
0
0
Just do str(int(float('2.09228E+14'))) which should give you '209228000000000'
1
0
1
I'm trying to read a csv with pandas using the read_csv command. However, one of my columns is a 15 digit number which is read in as a float and then truncated to exponential notation. So the entries in this column become 2.09228E+14 instead of the 15 digit number I want. I've tried reading it as a string, but I get...
Pandas read csv data type
0.197375
0
0
1,866
22,001,578
2014-02-24T23:42:00.000
0
0
0
1
python,google-app-engine,google-cloud-datastore,app-engine-ndb
22,031,727
1
false
1
0
You need to take a look at the google spreadsheets api, google it, try it, come back when something specific doesnt work. Also consider using google forms instead which already do what you want (save responses to a spreadsheet)
1
0
0
I am making a survay website on google app engine using Python. For saving the survey form data i am using NDB Datastore. After the survey I have to import it as spreadsheet or CSV. How can i do that. Thanks.
backing up data from app engine datastore as spreadsheet or csv
0
0
0
163
22,004,118
2014-02-25T03:43:00.000
0
0
1
0
python,python-2.7,python-3.x
22,004,184
2
false
0
0
print is a keyword, and print() is a function. For almost all purposes that I have encountered, print(x) (python 3.x) will work just like print x (python 2.x). However, you cannot use the comma to avoid going to a new line any more. Instead, you must use print(x, end=k), where k is a string that whatever you will print...
1
0
0
I've had to follow an example recently that encouraged me to use the new style python print() function, which I can only access after from __future__ import print_function. What are the major differences between the two? What was the old print, if not a function?
Why is the new python "print(x)" function better than the old "print x" approach?
0
0
0
229
22,004,386
2014-02-25T04:09:00.000
0
0
1
1
ipython,anaconda
22,021,547
5
false
0
0
Recent versions of iTerm send notifications to notification center when there is output in a non-visible tab. They fold into notification center by default, but you can change them to stay on the screen in the Notifications preferences in System Preferences.
1
21
0
How do I get IPython to notify me when a command has been executed? Can I get it to use the bell/alert, or by pop-up? I'm running Anaconda on iTerm on OS X 10.8.5.
notify when execution/command is completed
0
0
0
8,943
22,004,427
2014-02-25T04:13:00.000
0
1
1
0
javascript,python,language-agnostic,dynamic-typing,static-typing
22,004,578
1
true
0
0
I'm a C++/C# dev by training, and I found that I got better with JS after I started writing it. Try going all in on JS and write something in it. Maybe Node.js. Maybe learn to use it with a frontend framework like Angular or Knockout. Maybe both together. If you want to improve from there, check out Douglas Crockford's...
1
2
0
I have a strong background in Java, which obviously is statically-typed, and type-safe language. I find it that I am able to read through large amounts of code very quickly and easily assuming that the programmer who had written it followed basic conventions and best practices. I am also able to write code pretty quick...
Strategies to be more effective at programming in dynamic languages
1.2
0
0
93
22,004,809
2014-02-25T04:44:00.000
0
0
0
0
python,csv,sqlite
22,005,726
2
false
0
0
make headers of the columns in csv as the same column names in sqlite3 table. Then directly read and check the type by using type() before inserting into DB.
1
2
0
I have a csv file with about 280 columns, which are possibly changing from time to time. Is there a way to import a csv file to sqlite3 and have it 'guess' the column types? I am using a python script to import this.
csv import sqlite3 without specifying column types
0
1
0
1,025
22,008,273
2014-02-25T08:16:00.000
26
0
1
0
python,buffer,block,chunks,sector
22,009,516
1
true
0
0
Chunk is used for any (typically rather large) amount of data which still is only a part of any size of a whole, e. g. the first 1000 bytes of a file. The next 3000 bytes could be the next chunk. Block is used for a fixed amount of data (typically technically determined) which typically is only part of a whole, e. g. ...
1
11
0
I have seen some of the scripts which are either dealing with archive or binary data or copy files (not using python default functions) use chunk or block or offset or buffer or sector. I have created a Python application and few of the requirements have been met by external libraries (archival / extracting data) or bi...
What do "chunk", "block", "offset", "buffer", and "sector" mean?
1.2
0
0
12,224
22,013,532
2014-02-25T11:59:00.000
0
0
0
0
javascript,jquery,python,api
25,426,295
1
false
1
0
It all depends on what you're authenticating. If you're authenticating each user that uses your API, you have to do something like the following: Your site has to somehow drop a cookie in that user's browser, Your API needs to support CORS (we use easyXDM.js), somehow upon logging in to their site, their site needs t...
1
1
0
I have a javascript placed on third party site and this js makes API calls to my server. JS is publicly available and third party cannot save credentials in JS. I want to authenticate API calls before sharing JSON and also want to rate limit. Any one has ideas on how can i authenticate API?
how to do authentication of rest api from javascript, if javascript is on third party site?
0
0
1
117
22,017,118
2014-02-25T14:28:00.000
3
0
1
0
python,multiprocessing,pool
33,544,728
2
false
0
0
You can use as many workers as you have memory for. That being said, if you set up a pool without any process flag, you'll get workers equal to the machine CPUs: From Pool docs: processes is the number of worker processes to use. If processes is None then the number returned by os.cpu_count() is used. If you're doing...
1
6
0
I am making use of Python's multiprocessor library and wondering what would be the maximum of worker processes I can call? E.g. I have defined async.pool = Pool(100) which would allow me to have max 100 async processes running at the same time, but I have no clue what would be the real maximum value for this? Does anyo...
Python multiprocessing: max. number of Pool worker processes?
0.291313
0
0
6,331
22,017,835
2014-02-25T14:55:00.000
2
0
0
0
python,tcp,udp,recv,recvfrom
22,018,452
1
false
0
0
Why does TCP socket.recvfrom() not return the sender address as it does with UDP? Because once a TCP connection is established that address does not change. That is the address that was passed to connect or received from accept calls. You can also find out the peer's address (if you lost it somehow) with getpeername. ...
1
0
0
Why does TCP socket.recvfrom() not return the sender address as it does with UDP? When does TCP socket.recv() an empty string? Thanks!
recv() and recvfrom() methods for TCP
0.379949
0
1
2,605
22,018,798
2014-02-25T15:30:00.000
2
0
0
1
python,django,rabbitmq
32,414,239
1
false
1
0
If anyone else bumps into this problem: The solution is using a RabbitMQ consumer from a different process (But in the same Django codebase) then Django (Not the running through wsgi, etc. you have to start it by it self) The consumer, connects to the appropriate rabbitmq queues and writes the data into the Django mode...
1
2
0
I need to implement a quite simple Django server that server some http requests and listens to a rabbitmq message queue that streams information into the Django app (that should be written to the db). the data must be written to the db in a synchronized order , So I can't use the obvious celery/rabbit configuration. I...
Django - listening to rabbitmq, in a synchronized way. without celery. in the same process of the web bound django
0.379949
0
0
1,008