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
20,406,998
2013-12-05T17:44:00.000
2
1
0
0
php,python,ruby
20,409,383
1
true
1
0
Language is irrelevant. Just put "short" operation in function (object, if it is complex) and use it from 2 places: web-code which needs "preview" will call it once and get its piece of data long-running background process will call it iteratively as much as needed and will store result of function in DB instead of re...
1
0
0
I have a web frontend which uses data from a task that must be run frequently in bulk (which takes more time than I'd like to use PHP for). The data can be stored in a database so I was planning on writing a Java application to run the task and use the database as a middleman to get the results of this task accessible ...
PHP / Python / Ruby - Long running tasks with short previews
1.2
0
0
81
20,411,315
2013-12-05T21:38:00.000
0
0
0
0
python,qt,pyqt4
20,411,550
1
false
0
1
In the handler of the button-click in the first window, instantiate the second window and invoke its show-method, and then close (emit the close-signal to) the first window.
1
0
0
I have two pyqt files that I made in qt4 designer. I put them both in a directory and created a file outside the directory, which I imported them with. The first file is a window with a button, that when clicked, should close the first window, and open the second window. I can import them, and launch them both at the...
How to tie two windows together in pyqt4
0
0
0
150
20,411,647
2013-12-05T21:57:00.000
0
0
0
0
python,file,module,tree,wxpython
20,411,707
1
true
0
1
treeCtrl.Unbind(wx.EVT_KEY_DOWN) I think would work :P
1
0
0
I am currently using CustomTreeCtrl instead of the regular TreeCtrl because it allows me to have checkbox / radio button with the tree nodes. However, I realize the control itself catches event EVT_KEY_DOWN (whenever any key is pressed) to look for any matching tree nodes. I need the event EVT_KEY_DOWN for other purpos...
wxPython: CustomTreeCtrl disable checking for event EVT_KEY_DOWN
1.2
0
0
230
20,415,414
2013-12-06T03:29:00.000
5
0
0
0
python,pandas,dataframe
20,415,698
5
false
0
0
What have you tried? You could sort with s.sort() and then call s.head(3).index and s.tail(3).index.
1
4
1
How can I find the index of the 3 smallest and 3 largest values in a column in my pandas dataframe? I saw ways to find max and min, but none to get the 3.
python pandas 3 smallest & 3 largest values
0.197375
0
0
7,247
20,420,020
2013-12-06T09:10:00.000
5
0
1
0
python,linux
20,420,190
3
true
0
0
There is no easy way to determine if someone else has made a link to a given "hard" directory. You can only check if a given directory is a symlink to another directory. This means that you need to traverse your entire directory structure, look for symlinks, and then check if they point to the directory in question. A ...
1
2
0
I am trying to remove a set of directories, excluding those that are in used and symlinked to elsewhere. What is the most effective way to determine if a given directory is symlinked to? I've tried os.stat(dir).mt_nlink, but it returns 3 even for directories I want to remove. EDIT: By symlinked to I mean this directory...
How can I determine if a given directory is `symlink`ed to in Python?
1.2
0
0
1,730
20,421,001
2013-12-06T09:59:00.000
1
0
0
0
python,cherrypy
20,422,180
2
false
1
0
Try <img src="/page_first/my_image.png"/>
2
2
0
I do a simple web application written in Python using cherrypy and Mako. So, my question is also simple. I have one page with URL http://1.2.3.4/a/page_first. Also there is an image that available on URL http://1.2.3.4/a/page_first/my_image.png. And I want to locate my_image.png on the page_first. I added a tag <img ...
Using relative URL's
0.099668
0
1
195
20,421,001
2013-12-06T09:59:00.000
2
0
0
0
python,cherrypy
20,422,773
2
true
1
0
The page address needs to be http://1.2.3.4/a/page_first/ (with trailing slash). ADDED: You don't seem to understand relative URLs, so let me explain. When you reference an image like this <img src="my_image.png"/>, the image URL in the tag doesn't have any host/path info, so path is taken from the address of the HTML ...
2
2
0
I do a simple web application written in Python using cherrypy and Mako. So, my question is also simple. I have one page with URL http://1.2.3.4/a/page_first. Also there is an image that available on URL http://1.2.3.4/a/page_first/my_image.png. And I want to locate my_image.png on the page_first. I added a tag <img ...
Using relative URL's
1.2
0
1
195
20,421,648
2013-12-06T10:30:00.000
0
0
0
0
wxpython,wxwidgets
20,425,632
1
false
0
1
The problem with Alt-N not having any effect seems to be a wxWidgets bug, so I don't think you can work around it in wxPython. Perhaps you could try to catch EVT_CHAR for them in the wizard itself and see if you get the event there. As for disabling some keys when some specific control has focus, you definitely should ...
1
1
0
The wizard in wxpython automatically responds to keyboard accelerators for the buttons on the page (for example "Alt-N" to activate the next button). I want this but ... It only does this if there is at least one interactive widget on the visible wizard page. If the page only has static text then accelerator keystrokes...
How to make wx wizard respond to keyboard accelerators like a normal Microsoft Windows application
0
0
0
117
20,421,825
2013-12-06T10:38:00.000
3
0
1
1
python,py2exe
20,421,890
1
true
0
0
Yes, trivially. Py2exe just creates a zip of the .pyc files with an executable wrapper, and those files are easily uncompilable with eg uncompyle. The way to sell commercial software in Python is not to worry about whether people can see the code, but to license it appropriately.
1
1
0
I would like to distribute a .exe program that I made with Python and py2exe. My program may be commercial (not sure). If so, I don't want people to recover easily the sourcecode. (Of course reverse engineering or complex decompiling can always be done, but...) So : is it possible to recover the original sourecode from...
Can human-readable source code be recovered from a py2exe executable?
1.2
0
0
598
20,421,965
2013-12-06T10:47:00.000
0
0
0
1
python,google-app-engine,blob,google-cloud-datastore
20,424,484
1
false
1
0
Datastore has a limit on the size of objects stored there, thats why all examples and documentation say to use the blobstore or cloud storage. Do that.
1
0
0
Just wondering how to store files in the google app engine datastore. There are lots of examples on the internet, but they are using blobstore I have tried importing db.BlobProperty, but when i put() the data it shows up as a <Blob> i think. It appears like there is no data Similar to None for a string Are there any ex...
How do I store files in googleappengine datastore
0
1
0
71
20,423,546
2013-12-06T12:08:00.000
21
0
1
0
ipython,background-color,spyder
20,436,610
1
true
0
0
(Spyder dev here) You need to update Spyder to 2.3.0beta1, which has this option under: Tools > Preferences > IPython console > Background color > Dark background
1
12
0
I'm new to Spyder(version 2.3.0dev6) and I want to change the background color of my IPython console(version 1.1.0). I can change the background color of console but not the IPython console. I also tried in the "Run configuration", "general settings", "command line options": --color=linux, but nothing happened.
Spyder IPython background color
1.2
0
0
25,229
20,426,690
2013-12-06T14:43:00.000
0
0
1
0
python,numpy,windows64,pyfits
20,436,137
2
true
0
0
This is a problem importing numpy, not pyfits. You can tell because the traceback ended upon trying to import the numpy multiarray module. This error suggests that the numpy you have installed was not built for the same architecture as your Python installation.
1
0
1
I am using windows 7 home basic 64 bit. I wanted to work with FITS file in python 3.3 so downloaded pyfits and numpy for 64 bit. When I import pyfits I get the following error: Traceback (most recent call last): File "", line 1, in import pyfits as py File "C:\Python33\lib\site-packages\pyfits__init__.py"...
pyfits not working for windows 64 bit
1.2
0
0
718
20,427,217
2013-12-06T15:09:00.000
1
1
0
0
python,web2py
20,437,241
1
true
1
0
Look at section 4.17.1 of the web2py manual (or Google "web2py cron"). You can run a script on startup of web2py by registering it in the crontab file as: "@reboot web2py *scripts/myscript.py" web2py should be the username that it will run as, which should be the same as what web2py runs as. In my setup I have a user n...
1
0
0
I need a launch script which has access to "db" and other web2py modules. This script must be running constantly. I know that Web2py has launch parameters from which you can run python files in the web2py enviroment, but i don't know how that works. Can this parameter solve my problem and if so, how do I go about it? T...
Web2py launch script
1.2
0
0
1,158
20,428,414
2013-12-06T16:06:00.000
0
1
0
0
php,python,sockets
20,429,263
5
false
0
0
If the same machine, you can use file with command. Create a file cmd.txt , python will read it in loop every sec, Php script will write a command in file cmd.txt , python will do the job and erase the command from cmd.txt
1
2
0
Here is my problem, I have a Python script that will be running indefinitely in a while(1) loop. I want some PHP script to somehow interact with the Python script, and when it does, the script needs to perform a function with the data submitted to the script. Any ideas would be appreciated!
Sending data to Python Script from PHP
0
0
0
4,830
20,428,732
2013-12-06T16:22:00.000
5
0
0
0
python,selenium
59,528,985
4
false
0
0
You can try: pip list conda list or for example on MAC: brew list And then check if and what version is in your installed package list. For conda you might have different environments. Change it by conda activate myenv where myenv is the name of your second or more test environments.
2
16
0
The title says it all, I want to programmatically get the version of Selenium I have installed on my Python environment.
How do I retrieve the version of Selenium currently installed, from Python
0.244919
0
1
48,042
20,428,732
2013-12-06T16:22:00.000
3
0
0
0
python,selenium
66,284,498
4
false
0
0
Try using pip show selenium, that worked for me
2
16
0
The title says it all, I want to programmatically get the version of Selenium I have installed on my Python environment.
How do I retrieve the version of Selenium currently installed, from Python
0.148885
0
1
48,042
20,433,712
2013-12-06T21:16:00.000
0
0
0
1
python,development-environment,vagrant
21,195,137
1
false
0
0
In most IDE you can add "library" path which are outside the project so that your code completion etc works. About the traceback, I'm unfamiliar with python but this sounds like issue that are resolved by "mapping" paths between servers and dev machine. This is generally the reason why #2 is often the way to go (Except...
1
5
0
I'm investigating ways to add vagrant to my development environment. I do most of my web development in python, and I'm interested in python-related specifics, however the question is more general. I like the idea of having all development-related stuff isolated in virtual machine, but I haven't yet discovered an effe...
Using vagrant as part of development environment
0
0
0
1,504
20,437,735
2013-12-07T04:49:00.000
5
1
0
0
python,performance,serial-port,baud-rate
20,437,926
1
true
1
0
You're going to give up some time when the direction of communication is reversed. So there's some "dead time" between when one side receives the last stop bit and when it loads the first response byte into the UART transmitter and starts driving the first start bit. I'm calculating that this dead time is 5 ms (almost ...
1
3
0
I am developing an application in Python that communicates to a device over RS-485 two wire, half-duplex. I have enough of the application working that I can perform some performance tests. I am using a laptop with a USB to 485 converter. The communications is setup as 9600,N,8,1. For my speed test I send a message wi...
RS-485 Serial Port Baud Rate Performance Efficiency
1.2
0
0
1,777
20,439,604
2013-12-07T09:06:00.000
3
0
1
0
python
20,439,634
2
false
0
0
Rather than leaving in the syntax errors, explicitly raise NotImplementedError from your unfinished function. Or move the constants to a separate module.
1
0
0
I have a module A.py, that holds some constants, and a class. The class is not ready yet, so meny of it's functions implementations are NOT IMPLEMENTED YET - that is, I want if anyone calls this function, python to fail with syntactic error. However, now I am doing from A import constants and python is failing with the...
From a module with errors, import valid entities
0.291313
0
0
36
20,440,320
2013-12-07T10:36:00.000
3
1
0
0
python,linux,disk
20,441,124
1
false
0
0
Get libatasmart which is a C library, and invoke it from Python via ctypes or cffi.
1
0
0
Is there a way to do this without using smartmontools? I'd like to try to see how far I get with just Python if possible. A google search does not seem to yield too much.
Accessing SMART attributes in Linux with only Python?
0.53705
0
0
167
20,440,581
2013-12-07T11:07:00.000
0
1
0
0
javascript,php,python,vbscript,cloud9-ide
20,442,855
1
false
1
0
You could possibly make a temporary file in your system, and in an iframe, open the file. Important Note This could be insecure as they could get the URL and execute code to delete ../../../ or something, which could harm your files.
1
0
0
I am using ACE to allow people to code freely on my website. How would I run this code. I would like a run button in the bottom left corner (I can do that in css), but how would I run it, as it is python. I have added extra tags, as you can write these languages in the ace editor. When I mean, a run button, I mean li...
How do I try and run code that I have written in ACE Cloud 9?
0
0
0
530
20,441,270
2013-12-07T12:17:00.000
0
0
0
0
python,csv,python-3.x,urllib
20,441,410
4
false
0
0
You are probably not going to be able to top that speed without either a) a faster internet connection both for you and the provider or b) getting the provider to provide a zip or tar.gz format of the files that you need. The other possibility would be to use a cloud service such as Amazon to get the files to your cl...
2
8
0
I need to download a thousand csv files size: 20KB - 350KB. Here is my code so far: Im using urllib.request.urlretrieve. And with it i download thousand files with size of all of them together: 250MB, for over an hour. So my question is: How can I download thousand csv files faster then one hour? Thank you!
Fastest way to download thousand files using python?
0
0
1
5,698
20,441,270
2013-12-07T12:17:00.000
1
0
0
0
python,csv,python-3.x,urllib
20,441,497
4
false
0
0
The issue is very unlikely to be bandwidth (connection speed) because any network connection can maintain that bandwidth. The issue is latency - the time it takes to establish a connection and set up your transfers. I know nothing about Python, but would suggest you split your list and run the queries in parallel if po...
2
8
0
I need to download a thousand csv files size: 20KB - 350KB. Here is my code so far: Im using urllib.request.urlretrieve. And with it i download thousand files with size of all of them together: 250MB, for over an hour. So my question is: How can I download thousand csv files faster then one hour? Thank you!
Fastest way to download thousand files using python?
0.049958
0
1
5,698
20,442,022
2013-12-07T13:41:00.000
1
0
0
0
python,pygame
20,443,462
1
false
0
1
An event can be made with the command pygame.event.Event(type, dict). The type will be what you want it to return when the event.type() command is used on it. The dict will include every other attribute. An example: pygame.event.Event(pygame.MOUSEBUTTONDOWN, {'button':1}) would return a MOUSEBUTTONDOWN event with an ...
1
0
0
Is it possible to define an event object in pygame? What I am trying to do is loop through all the keyboard events in a method, I then want to call that method with an event as a parameter, but I first need to define it. Is this possible? Im using Pygame 3.3 and python 3.
Pygame event object
0.197375
0
0
198
20,446,892
2013-12-07T21:28:00.000
2
0
1
0
python
20,446,961
1
true
0
0
First you would have to define the meaning of the hash of three bits. The hashes in hashlib (and standard hashes in general) are defined with an input which is a sequence of bytes, so if you have less than one byte there's no standard definition. For example, you might define that the hash of '001' should be equal to t...
1
0
0
Is there a way to send a raw bitstring like '001' and hash that using Python's hashlib? Using the literal string '001' hashes the binary representation of the string which is 24 bits in length.
Use Python's hashlib to find the hash of something that isn't a complete byte
1.2
0
0
77
20,447,826
2013-12-07T23:08:00.000
0
0
0
0
python,sockets,python-3.x,port
20,447,877
1
false
0
0
Use a firewall for example? On linux there is the iptables. It's easy to use and powerful.
1
0
0
For example, if I have my minecraft server running on port 25565, I want to have a python script close the port so that all connections will be dropped and no further connections will be made without having to shutdown the service. I have tried binding a new socket to the same port number and then closing the socket, ...
How do I force close a port being used by an independent service?
0
0
1
148
20,449,398
2013-12-08T03:03:00.000
21
0
1
0
python,generics
20,449,414
2
false
0
0
No. Python is not a statically typed language, so there is no need for them. Java generics only provide compile time type safety; they don't do anything at runtime. Python doesn't have any compile time type safety, so it wouldn't make sense to add generics to beef up the compile time type checks Python doesn't have. A ...
1
9
0
Does python have generic methods like Java? If so could you refer to a site that explains it.
Does python have generic methods?
1
0
0
13,573
20,452,189
2013-12-08T10:11:00.000
2
0
1
0
python,python-3.x,floating-point,int
20,452,362
4
false
0
0
There are four reasons which I can currently think of (and I'm sure there are more): Memory. Choosing wisely data types can dramatically affect the memory requirements (large databases, for example). Speed. Hardware implementation of integer arithmetic is much faster (and simpler) than floating point arithmetic. Progr...
3
7
0
I'm preparing for a class lesson (I'm teaching) and I'm trying to predict any possible questions from the students and I ran into one that I can't answer: If we have floats, why do we ever use ints at all? What's the point? I know (or at least I think) that floats take more memory because they have more accuracy, but s...
Why should I use ints instead of floats?
0.099668
0
0
9,918
20,452,189
2013-12-08T10:11:00.000
9
0
1
0
python,python-3.x,floating-point,int
20,452,910
4
false
0
0
There are various historical reasons that apply to most languages: A philosophy of "don't use what you don't need". A lot of programs have no need for non-integer values but use integer values a lot, so an integer type reflects the problem domain. Floating point arithmetic used to be far more expensive than integer. I...
3
7
0
I'm preparing for a class lesson (I'm teaching) and I'm trying to predict any possible questions from the students and I ran into one that I can't answer: If we have floats, why do we ever use ints at all? What's the point? I know (or at least I think) that floats take more memory because they have more accuracy, but s...
Why should I use ints instead of floats?
1
0
0
9,918
20,452,189
2013-12-08T10:11:00.000
9
0
1
0
python,python-3.x,floating-point,int
20,452,305
4
false
0
0
It's important to use data types that are the best fit for the task they are used for. A data type may not fit in different ways. For instance, a single byte is a bad fit for a population count because you cannot count more than 255 individuals. On the other hand a float is a bad fit because many possible floating poin...
3
7
0
I'm preparing for a class lesson (I'm teaching) and I'm trying to predict any possible questions from the students and I ran into one that I can't answer: If we have floats, why do we ever use ints at all? What's the point? I know (or at least I think) that floats take more memory because they have more accuracy, but s...
Why should I use ints instead of floats?
1
0
0
9,918
20,452,796
2013-12-08T11:17:00.000
2
0
0
0
python,mysql
20,452,854
1
true
0
0
Your design is poorly suited for a relational database such as MySQL. The best way to go about it is to either redesign your storage layout to a form that a relational database works well with (eg. make each row a (hashtag, hour) pair), or use something other than a relational database to store it.
1
0
0
I'm using a python script to run hourly scrapes of a website that publishes the most popular hashtags for a social media platform. They're to be stored in a database (MYSQL), with each row being a hashtag and then a column for each hour that it appears in the top 20, where the number of uses within that past hour is li...
Best way to handle a database with lots of dynamically added columns?
1.2
1
0
48
20,455,129
2013-12-08T15:29:00.000
1
0
0
0
python,mysql,latitude-longitude
20,455,724
1
true
0
0
Load B into a python list and for each calculate maxlat, minlat, maxlong, minlong that everything outside of the box is definitely outside of your radius, if your radius is in nautical miles and lat/long in degrees. You can then raise an SQL query for points meeting criteria of minlat < lat < maxlat and minlong < long...
1
0
0
Problem I have a list of ~5000 locations with latitude and longitude coordinates called A, and a separate subset of this list called B. I want to find all locations from A that are within n miles of any of the locations in B. Structure All of this data is stored in a mysql database, and requested via a python script. A...
Finding Locations with n Miles of Existing Locations
1.2
1
0
71
20,456,893
2013-12-08T18:00:00.000
0
0
0
1
python,sockets,networking,io,network-programming
20,457,117
1
true
0
0
From the python select documentation: This module provides access to the select() and poll() functions available in most operating systems, epoll() available on Linux 2.5+ and kqueue() available on most BSD. Note that on Windows, it only works for sockets; on other operating systems, it also works for other fi...
1
0
0
I was trying to use the poll() function on Windows when I realized that only the select() function is supported on windows, and I believe poll() is supported on Linux. Could anyone help me out as to what functions of the select module are supported on what operating systems? Thanks
On what operating systems are the different functions of the select module in Python, like select(), poll(), epoll() available?
1.2
0
0
57
20,456,992
2013-12-08T18:09:00.000
2
0
1
0
python
20,457,050
3
false
0
0
From the error, it seems that r is assigned to a function by mistake. I'm guessing you're calling your function with something like this: generateNumber(float). Or the argument is one of your own functions, but you forgot to add parentheses: generateNumber(myOwnFunction) instead of the correct generateNumber(myOwnFunct...
1
0
0
I am trying to calculate the value of 10^r in python. I started with pow(10, r), but I was told that I had a TypeError and needed a float. I tried using (10**r) and pow(10, float(r)), but nothing is working. In the first, I got a "TypeError - unsupported operand type(s) for ** or pow(): 'int' and 'builtin_function_o...
Python math.pow function needs float()
0.132549
0
0
1,536
20,458,011
2013-12-08T19:35:00.000
5
0
1
0
python,python-2.7,python-3.3,python-2to3
47,106,899
9
false
0
0
To convert all python 2 files in a directory to 3, you simply could run $ C:\Program Files\Python\Tools\Scripts\2to3.py -w -n. inside the directory that you want to translate. It would skip all the non .py files anyway, and convert the rest. note: remove the -n flag, if you want the backup file too.
3
69
0
I have some code in python 2.7 and I want to convert it all into python 3.3 code. I know 2to3 can be used but I am not sure exactly how to use it.
How to use 2to3 properly for python?
0.110656
0
0
73,248
20,458,011
2013-12-08T19:35:00.000
1
0
1
0
python,python-2.7,python-3.3,python-2to3
65,057,406
9
false
0
0
Running it is very simple! I am going to consider you already have it installed and explain step-by-step how to proceed after that: Open terminal (or cmd for win users) inside the main folder containing the files you want to convert e.g. C:\Users\{your_username}\Desktop\python2folder Type python {your_2to3.py_insta...
3
69
0
I have some code in python 2.7 and I want to convert it all into python 3.3 code. I know 2to3 can be used but I am not sure exactly how to use it.
How to use 2to3 properly for python?
0.022219
0
0
73,248
20,458,011
2013-12-08T19:35:00.000
-2
0
1
0
python,python-2.7,python-3.3,python-2to3
48,277,515
9
false
0
0
The python 2to3.py file is mostly found in the directory C:/Program Files/Python/Tools/scripts if you already have python installed. I have python 3.6 and 2to3 is in the directory C:/Program Files/Python36/Tools/scripts. To convert a certain python 2 code to python 3, go to your command promt, change the directory to C...
3
69
0
I have some code in python 2.7 and I want to convert it all into python 3.3 code. I know 2to3 can be used but I am not sure exactly how to use it.
How to use 2to3 properly for python?
-0.044415
0
0
73,248
20,458,503
2013-12-08T20:16:00.000
1
1
1
0
python,unicode,python-3.3
20,459,315
1
false
0
0
As @Jongware and @SimeonVisser pointed out, "Unicode is basically just a big lookup table," so there's secret sauce along the lines of what I was looking for. Marking as answered--hopefully the directness here will help someone with a similar question in the future.
1
1
0
I'm working on string manipulation in Python (v3.3), and I'm wondering if there's a predictable way to detect the addition of diacritical markings on a given character. So for instance is there some relationship between 'α' # ord('α') = 945) (Greek unmarked alpha) and 'ᾶ' # ord('ᾶ') = 8118 (Greek alpha with a circumfle...
Unicode and (Greek) Diacritics in Python
0.197375
0
0
581
20,460,867
2013-12-09T00:00:00.000
14
0
0
0
python,kivy
20,470,745
1
true
0
1
A widget keeps a reference to its parent in self.parent. So you can just so self.parent.size or self.parent.pos or whatever. Depending on what you're doing, it may be necessary or useful to make sure you check if self.parent is None first, so that your code doesn't fail for widgets with no parent.
1
11
0
Im learning Kivy and would like to center an object inside of a parent object. I know I can access an object's own properties with the self keyword in the kv language, but is there a shortcut for accessing a parent widget's, say, size and position properties? Both root.size and parent.size are failing for me.
Accessing the parent object's size parameters in kivy widgets
1.2
0
0
5,845
20,461,790
2013-12-09T01:53:00.000
5
1
0
0
python,installation,xlrd
20,462,021
4
false
0
0
If windows this should work. Browser to "folder with python"\scripts Open cmd here (shift + right click and and it should be an option in the context menu.) type inn: easy_install.exe xlrd It should download and install if for you.
2
8
0
Can someone give me a guide for morons? I am somewhat out of my depth here. So far I have downloaded xlrd 0.9.2 and tried to follow the readme, but neither I nor ctrl-f can find the installer mentioned.
I'm having a lot of trouble installing xlrd 0.9.2 for python
0.244919
0
0
43,595
20,461,790
2013-12-09T01:53:00.000
1
1
0
0
python,installation,xlrd
52,548,713
4
false
0
0
If you have installed pip which is available with python installation file; then just do the following steps: Open Command Line Type "pip install xlrd" Hope it will work
2
8
0
Can someone give me a guide for morons? I am somewhat out of my depth here. So far I have downloaded xlrd 0.9.2 and tried to follow the readme, but neither I nor ctrl-f can find the installer mentioned.
I'm having a lot of trouble installing xlrd 0.9.2 for python
0.049958
0
0
43,595
20,463,104
2013-12-09T04:21:00.000
0
0
0
0
android,python,mobile
20,463,265
1
false
0
1
From what I can tell, neither of the projects you mention is meant for building native Android apps. If you were really knowledgeable in Jython and Android, maybe you could finagle Jython to make native apps, but since you mention that you've never used Java, that's unlikely. Unfortunately, the only project that attemp...
1
4
0
I primarily program in Python and have always tried to steer clear of Java (no particular reason, really). Now I find myself in a position where I have to build an app for Android. My question is, is there any inherent difference in terms of speed, resource-consumption, access to hardware features etc if I build the a...
Building apps for Android using Python
0
0
0
6,207
20,464,887
2013-12-09T06:57:00.000
0
0
1
0
python,excel,xlrd
21,302,801
3
false
0
0
Excel dates are represented as pywintypes.Time type objects. So in order to e.g. assign the current timestamp to a cell you do: workbook.Worksheets(1).Cells(1,1).Value = pywintypes.Time(datetime.datetime.now())
1
2
0
I can convert date read from excel to a proper date using xldate_as_tuple function. Is there any function which can do the reverse i.e. convert proper date to float which is stored as date in excel ?
How to convert current date to float which is stored in excel as date?
0
1
0
1,405
20,465,269
2013-12-09T07:23:00.000
4
1
0
0
python,twitter,twython
20,511,726
2
true
0
0
What I ended up doing was .show_user(user_id=twitter_id) which returns (among other things) the followers count via ['followers_count']
1
0
0
Is there an easy way to get the number of followers an account has without having to loop through cursors? I'm looking for a simple function call which will return to me just the number of followers the use with a given Twitter ID has. Just looking for the physical number not access to anything else
Twython get followers count
1.2
0
1
907
20,466,573
2013-12-09T08:51:00.000
1
0
0
0
python,sockets,networking,select,network-programming
20,466,700
2
false
0
0
Note that select with a timeout of 0 is basically the same as a poll but the biggest problem for cross system programming is that the support for both select and poll is mixed and inconsistent - personally I tend to opt for a blocking listener in a separate thread that once a complete frame, message, etc., has been rec...
1
0
0
I am writing an application in Python that involves socket programming. I have understood that it's better to use the non-blocking sockets, and thus write an event-driven server. I am not sure as to why and how I should prefer one of these two methods that I want to use: select() and poll() for checking activity in any...
How can I choose between select.select() and select.poll() methods in the select module in Python?
0.099668
0
1
805
20,467,107
2013-12-09T09:23:00.000
1
0
1
0
python,urllib2,urllib,urllib3
20,467,364
3
false
0
0
Personally I avoid to use third-party library when possible, so I can reduce the dependencies' list and improve portability. urllib and urllib2 are not mutually exclusive and are often mixed in the same project.
2
9
0
as we know, python has two built-in url lib: urllib urllib2 and a third-party lib: urllib3 if my requirement is only to request a API by GET method, assume it return a JSON string. which lib I should use? do they have some duplicated functions? if the urllib can implement my require, but after if my requirem...
Which urllib I should choose?
0.066568
0
1
22,979
20,467,107
2013-12-09T09:23:00.000
10
0
1
0
python,urllib2,urllib,urllib3
20,467,287
3
true
0
0
As Alexander says in the comments, use requests. That's all you need.
2
9
0
as we know, python has two built-in url lib: urllib urllib2 and a third-party lib: urllib3 if my requirement is only to request a API by GET method, assume it return a JSON string. which lib I should use? do they have some duplicated functions? if the urllib can implement my require, but after if my requirem...
Which urllib I should choose?
1.2
0
1
22,979
20,468,670
2013-12-09T10:49:00.000
13
1
1
0
python,pycharm
20,634,928
5
false
0
0
PyCharm sorts imports only according to groups specified in PEP-8, not alphabetically.
1
29
0
I am enjoying PyCharm's optimizing of Python imports - as well as removing unused imports, following PEP8 gives them a sensible layout and makes them easier to read. Is there any way to get PyCharm to additionally alphabetize them (which would make scanning them faster, for me at least)?
Can PyCharm's optimize imports also alphabetize them?
1
0
0
10,848
20,470,493
2013-12-09T12:17:00.000
3
0
1
0
python,performance,int
20,471,640
6
false
0
0
Although Martijn Pieters answered your question of what is faster and how to test it I feel like speed isn't that important for such a small operation. I would use int() for readability as Inbar Rose said. Typically when dealing with something this small readability is far more important; although, a common equation ca...
1
15
0
I've been using n = int(n) to convert a float into an int. Recently, I came across another way to do the same thing : n = n // 1 Which is the most efficient way, and why?
Which is the efficient way to convert a float into an int in python?
0.099668
0
0
2,877
20,471,228
2013-12-09T12:56:00.000
2
0
0
0
python,image-processing,gimp
20,483,571
2
true
0
0
pdb.gimp_image_select_contiguous_color is the programatic way - in a Python plug-in - of doing the magic wand. The drawback is that you have to issue suitable starting coordinates for it to work well. Maye repeating the process in 3 distant points of the image, and if the selection does not diverge by much in two of th...
1
1
1
I need to automate the analyses of many similar images which are basic lots of small blackish blobs on a somewhat homogeneous brown background. I have tried the find_blobs method from simpleCV but it is not accurate enough. However with gimps contiguous selection tool, also known as Magic wand, I was able to achieve m...
Programmatic equivalent of Gimp's Contiguous selection tool
1.2
0
0
1,258
20,471,702
2013-12-09T13:21:00.000
0
0
0
1
python,windows,batch-file,cmd
20,471,771
5
false
0
0
Those wildcards are expanded at "shell (i.e. bash) level" before running your python script. So the problem doesn't reside in python, but in the "shell" that you are using on Windows. Probably you cloud try PowerShell for Windows or bash via CygWin.
1
2
0
I am trying to run python script from windows cmd. When I run it under linux I put python myscript.py filename??.txt it goes through files with numbers from filename01.txt to filename18.txt and it works. I tried to run it from cmd like python myscript.py filename*.txt or python myscript.py filename**.txt but it ...
running python script for multiple files from windows cmd
0
0
0
2,906
20,471,968
2013-12-09T13:35:00.000
2
0
1
0
pydev,ipython
20,476,909
1
true
0
0
Actually, that's correct, the PyDev console is not able to show images such as you'd have on IPython notebook (which is an HTML viewer in the end), so, you need to show the plot widget to see the results (note that the plot should be interactive and shouldn't halt the console in the latest version). It should be possib...
1
2
0
Just installed pyDev and eclipse. I see that the console is an IPython console, but when Im trying to plot, I need to use the show() command instead of the plots just appearing inline like a regular IPython console. I've tried to use %pylab inline but there is no such magic. The console loads IPython 1.1.0. What do I ...
Plotting Inline with IPython Console in PyDev
1.2
0
0
1,039
20,473,837
2013-12-09T15:06:00.000
6
0
0
0
python,django,django-apps
20,473,908
1
true
1
0
Divide et impera. This is one of the basic rule of programming. Divide your problem in smaller pieces and on the long run you will be happy: Code re-usability Maintenance Elegance? Also if you are working on an opensource project your main goal would be to find someone else who is interested in it and that could hel...
1
2
0
In django,What is the difference between creating multiple applications and using the same application and using all models and views in the same application? Will the latter create any problems?
Disadvantages of using multiple apps django
1.2
0
0
373
20,476,969
2013-12-09T17:37:00.000
0
0
1
0
python,list,python-3.x
20,477,231
8
false
0
0
Even numbers are divisible by 2. Odd numbers are not. len(X) will get the length of X If the length of X is divisible by 2, then it is an Even number If the length of X is not divisible by 2 then it is an Odd Number len(X)%2 returns the "remainder" of a division problem for example 5%2 will return 1 which is NOT zero, ...
1
2
0
How can I find out if there is even, or odd, number of elements in an arbitrary list. I tried list.index() to get all of the indices... but I still don't know how I can tell the program what is an even and what is an odd number.
How to know if a list has an even or odd number of elements
0
0
0
14,621
20,478,949
2013-12-09T19:25:00.000
3
0
0
0
python,optimization,numpy,scipy,gaussian
61,375,377
4
false
0
0
I realize this is an old question but I haven't been able to find many discussion of similar topics. I am facing a similar issue with scipy.optimize.least_squares. I found that xtol did not do me much good. It did not seem to change the step size at all. What made a big difference was diff_step. This sets the step size...
1
13
1
I have a function compare_images(k, a, b) that compares two 2d-arrays a and b Inside the funcion, I apply a gaussian_filter with sigma=k to a My idea is to estimate how much I must to smooth image a in order for it to be similar to image b The problem is my function compare_images will only return different values if k...
How to force larger steps on scipy.optimize functions?
0.148885
0
0
4,444
20,479,696
2013-12-09T20:07:00.000
111
0
1
0
python,pycharm
20,479,761
8
true
0
0
The key is to mark your source directory as a source root. Try the following: In the Project view, right-click on the Python source directory In the dialog menu select Mark Directory As > Source Root The folder should now appear blue instead of beige, to indicate it is a Python source folder. You can also configure t...
7
56
0
Intro I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux) The problem On one of the computers we are getting "Unresolved reference" all over the code on almost every impor...
Pycharm: "unresolved reference" error on the IDE when opening a working project
1.2
0
0
70,388
20,479,696
2013-12-09T20:07:00.000
3
0
1
0
python,pycharm
36,310,088
8
false
0
0
I did all the stuff above from einnocent and myildirim but still had to do the following: close pycharm and manually delete the .idea folder, this deletes everything pycharm knows about the code. open pycharm, reimport the project the combination of setting the correct source root, restarting python with invaliding cac...
7
56
0
Intro I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux) The problem On one of the computers we are getting "Unresolved reference" all over the code on almost every impor...
Pycharm: "unresolved reference" error on the IDE when opening a working project
0.07486
0
0
70,388
20,479,696
2013-12-09T20:07:00.000
0
0
1
0
python,pycharm
42,169,671
8
false
0
0
The other reason may be project interpreter. For example, if you are using Python3.x, but the interpreter is for Python2.x You can check here: File | Settings | Project: 'projectname' | Project Interpreter
7
56
0
Intro I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux) The problem On one of the computers we are getting "Unresolved reference" all over the code on almost every impor...
Pycharm: "unresolved reference" error on the IDE when opening a working project
0
0
0
70,388
20,479,696
2013-12-09T20:07:00.000
0
0
1
0
python,pycharm
44,300,088
8
false
0
0
PyCharm - Alt-F(ile); Settings; Project Structure; click +Add content root; point your folder containing the package in contention: /home/joker/anaconda3/envs/conda_py27/lib/python2.7/site-packages. I additionally marked as resources (not sure if this is mandatory). Click ok and the reindexing happens. This solved th...
7
56
0
Intro I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux) The problem On one of the computers we are getting "Unresolved reference" all over the code on almost every impor...
Pycharm: "unresolved reference" error on the IDE when opening a working project
0
0
0
70,388
20,479,696
2013-12-09T20:07:00.000
1
0
1
0
python,pycharm
57,056,944
8
false
0
0
My ten-penneth - If you're working with virtual environments (have a venv directory) make sure it is marked as excluded. Plagiarised from above: In the Project view, right-click on the venv directory In the dialog menu select Mark Directory As > Excluded The directory should turn orange... This sometimes happens if...
7
56
0
Intro I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux) The problem On one of the computers we are getting "Unresolved reference" all over the code on almost every impor...
Pycharm: "unresolved reference" error on the IDE when opening a working project
0.024995
0
0
70,388
20,479,696
2013-12-09T20:07:00.000
0
0
1
0
python,pycharm
65,142,294
8
false
0
0
PyCharm > select "File" menu > select "Invalidate Caches / Restart" menu option
7
56
0
Intro I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux) The problem On one of the computers we are getting "Unresolved reference" all over the code on almost every impor...
Pycharm: "unresolved reference" error on the IDE when opening a working project
0
0
0
70,388
20,479,696
2013-12-09T20:07:00.000
5
0
1
0
python,pycharm
25,261,083
8
false
0
0
I also had the problem, and it took me few hours to find the exact solution. You need to confirm the following things. 'django.contrib.staticfiles', is added to INSTALLED_APPS in the settings.py file of your application. The directory with the static contents (for example, images), named static, resides under the ap...
7
56
0
Intro I have a Python project on a git repository. Everything works ok for most of the team members, we can sync the code and edit it without any problem with Pycharm on different platforms (Windows, Linux) The problem On one of the computers we are getting "Unresolved reference" all over the code on almost every impor...
Pycharm: "unresolved reference" error on the IDE when opening a working project
0.124353
0
0
70,388
20,480,808
2013-12-09T21:07:00.000
3
0
1
0
python
20,480,834
5
false
0
0
I usually use the Python interpreter inside of cmd. You can get to this by running your python executable in cmd I find its a little better than the standalone interpreter, but its just a matter of opinion
2
0
0
I want to learn how to program in Python and I've got plenty of tutorials/resources to do that however I don't have a solution as to where I'd test out my code and see the result. For example: When I was learning Javascript I was using the Firefox Web Console and that would show me the result of my code. I'd like to...
What's the best solution for a Python programming environment?
0.119427
0
0
138
20,480,808
2013-12-09T21:07:00.000
0
0
1
0
python
20,481,086
5
false
0
0
PyScripter is an awesome Python IDE on Windows 7. Amongst other features, it allows you to run your Python code right within the IDE, just like on the cmd. Last (but not least), who can forget IDLE. It is installed by default with any Python installation. Check your start menu; you should have it there. It has an int...
2
0
0
I want to learn how to program in Python and I've got plenty of tutorials/resources to do that however I don't have a solution as to where I'd test out my code and see the result. For example: When I was learning Javascript I was using the Firefox Web Console and that would show me the result of my code. I'd like to...
What's the best solution for a Python programming environment?
0
0
0
138
20,485,787
2013-12-10T03:59:00.000
4
0
1
0
python,import,module,spyder
20,485,970
2
false
0
0
This is what you need to do: Open a terminal and run python or ipython. In there execute these two commands: import sys sys.executable Copy the output of the last command Open Spyder and go to Spyder > Preferences > Console > Advanced settings > Python Executable Select the option Use the following Python interpreter ...
1
0
0
I am trying to import cv2 module in Spyder.app but somehow it does not import. By the way I am able to import it in a terminal. Can anyone of you guys please help me?
Spyder Module Import
0.379949
0
0
10,814
20,485,792
2013-12-10T03:59:00.000
10
0
0
0
python,colors,reportlab
20,485,864
2
true
0
0
From what I can tell, using the 256 color space won't work. The manual states that using 1 is 'all lights on full'. So, to create 256,256,256 is actually done by using (1,1,1). Thus, to get something in between, you'll have to use decimals. For me, I wanted the RGB: (75,116,156) so I had to write: setFillColorRGB(0.292...
1
6
0
I'm using reportlabs library of python to generate PDF reports. I need to understand which format of color code is needed to be passed. When I pass RGB code for light green (178,255,102), to the_canvas.setFillColorRGB(178,255,102) it gives me white. And if I provide universal RGB color code for any color, it still give...
color codes in reportlabs-python
1.2
0
0
7,458
20,489,514
2013-12-10T08:32:00.000
2
1
1
0
python,integration-testing,setup.py
20,489,835
2
false
0
0
If you really want isolation instead just doing python setup.py install in virtualenv. Then use virtualbox and install some free linux os in it. Take a snapshot of the machine after the install so you can revert easily with one click to the starting point at any time and try python setup.py install there.
1
8
0
I have a pretty big Python package I've written, about 3500 statements, with a robust unit and acceptance test suite. I feel quite confident about the quality of the code itself, but I'm uneasy about the install process going smoothly for users of the package as I don't know how to reliably test the install in an appro...
How do I test the setup.py for my package?
0.197375
0
0
1,343
20,490,415
2013-12-10T09:20:00.000
2
0
0
0
python,xml,xml-rpc
20,534,267
1
true
0
0
Found out the way for <struct> data type for xmlrpc. data type is like a dict type. For my case, it's actually SearchInfo({'id' : 12345}). Good luck to whoever needing this information (:
1
1
0
I'm having problem with data type in python. I run system.methodSignature('SearchInfo'), it returns [['array', 'struct']]. What should I put as the argument in SearchInfo()? And what is struct data type in xml-rpc? Please help.
Python XML-RPC data type
1.2
0
1
617
20,492,587
2013-12-10T10:57:00.000
0
0
0
0
python-2.7,turbogears2
20,525,832
1
true
0
0
tgext.datahelpers uploads files on disk inside the public/attachments directory (this can be change with tg.config['attachments_path']). So your file is already stored on disk, only the file metadata, like the URL, filename, thumbnail_url and so on are stored on database in JSON format
1
1
0
how to do file uploading in turbogears 2.3.1? I am using CrudRestController and tgext.datahelpers and it is uploading the file in the sqlite3 database but in an unknown format. I want to make a copy of the uploaded file in the hard drive. My query is how to ensure that when user uploads a file, it is loaded both in the...
file upload turbogears 2.3.1
1.2
1
0
226
20,492,683
2013-12-10T11:02:00.000
3
0
0
0
python,django,verbose
20,495,156
2
true
1
0
you just need to go to. /admin/templates/admin/includes/fieldset.html template. Here you can see source code like. {% if field.is_checkbox %} {{ field.field }} {{ field.label_tag }} Just change code to : {% if field.is_checkbox %} {{ field.label_t...
1
1
0
I have inserted a verbose name for a field in my models (Boolean Field) and when displaying in the admin, the checkbox is shown before the verbose name. How can I do so that the checkbox shows after the verbose name in the admin console?! Or is there another way of assigning a specific label to a field other than the...
How to add verbose name after a field in Admin - Django
1.2
0
0
597
20,494,017
2013-12-10T12:03:00.000
0
0
0
1
python,celery,celerybeat
20,506,294
1
false
0
0
I figured out the problem and it turns out to be a really stupid one, rather shows that I was doing a bad practice. I was using Gevent for measuring performance difference on the server and the way I was spawning Celery workers was not the right way to handle Gevent code. Not that I did not know that Celery needs a fla...
1
0
0
I have been working on a project which uses Celery beat for scheduling tasks. Locally, I have been using RabbitMQ as the broker and everything was working fine. When I pushed my project to the remote server, I changed the broker to Redis. The celery beat process seams to work fine as I can see in the console that it is...
Unable to get celery worker to work
0
0
0
450
20,498,752
2013-12-10T15:42:00.000
0
0
0
0
python,optimization,parameters,scipy
20,499,162
3
false
0
0
The order in which function parameters are passed is only ever not known when the function is defined with **kwargs (unnamed keyword arguments -- the function then has a dict called kwargs that contains them, obviously unordered). When the function is defined with named parameters, though, the f(a=b, c=d) syntax does n...
1
2
1
I want to model a data with gaussian with parameters (mu=1, sig=2, height=1) and pass initial parameters x0 = (0.8, 0.8, 0.9). I am wondering how does the optimizer knows the order of parameters. I could have taken the parameters as (mu,height,sig) or in any other order. Edit: Gaussian model (mu=1,sig=1.5,height=0.8)...
How scipy.optimize.leastsq knows the order of parameters passed to it?
0
0
0
160
20,500,675
2013-12-10T17:03:00.000
2
0
0
1
c++,python,c,mpi,distributed-computing
20,500,867
1
false
0
0
You can use MPI_ANY_SOURCE and MPI_ANY_TAG for receiving from anywhere. After receiving you can read the Information (source and tag) out of the MPI_Status structure that has to passed to the MPI_Recv call. If you use this you do not neccessary need any asynchronous communication, since the master 'listens' to everybod...
1
1
1
I would like to write a MPI program where the master thread continuously submits new job to the workers (i.e. not just at the start, like in the MapReduce pattern). Initially, lets say, I submit 100 jobs onto 100 workers. Then, I would like to be notified when a worker is finished with a job. I would send the next job ...
MPI distributed, unordered work
0.379949
0
0
182
20,500,717
2013-12-10T17:05:00.000
3
0
1
0
python
20,500,806
1
true
0
0
Context managers all have __enter__() and __exit__() methods, so checking to see if those attributes exist and that they have __call__ attributes will work almost all the time. But yeah, read the code and/or documentation for the class first.
1
4
0
The only time I ever use the with keyword is when reading and writing files, mostly because that's the only case I actually know that I can use it. I can imagine there are numerous instances where I preferably could have used with, but didn't know a class or method accepted it. So, how do I detect instances where the ...
How can I easily find out if a Python class accepts the with keyword?
1.2
0
0
44
20,502,766
2013-12-10T18:45:00.000
-3
0
0
0
python,angle,turtle-graphics
49,330,538
2
false
0
1
turtle.right(90) this will turn the turtle 90
1
6
0
I'm creating a function that will cause a giraffe to move in a certain direction and distance (don't ask). If the user types "west" in the parameters, the turtle should move west however the direction is. But the turtle's angle changes every time, I can't fix a value for my turtle to turn to go a certain direction. I ...
Setting the angle of a turtle in Python
-0.291313
0
0
18,276
20,505,011
2013-12-10T20:55:00.000
1
0
1
0
python,django,virtualenv,vagrant
20,828,364
1
false
0
0
Using virtualenv with Vagrant in the gswd tutorial is slightly more tricky than normal virtual env work because of where the virutal environment is stored. Here is an example where I create 1 virutalenv on vagrant, deactivate it and create a 2nd virtual env: vagrant@precise64:/vagrant/projects$ virtualenv ~/blog-venv1 ...
1
0
0
I am following the getting started with Django tutorial and managed to finish the 1st project but when I re-entered Vagrant SSH all packages i installed on my vagrant shared folder and my virtual environment were gone. Whats is best practice for setting up a development environment once in Vagrant SSH? Currently i have...
Recommended workflow/best practice for setting up Virtual env within Vagrant
0.197375
0
0
1,381
20,505,085
2013-12-10T20:59:00.000
2
0
1
1
python,macos,updates,automator
33,398,907
1
true
0
0
I couldn't specify explicitly which python for it to use. So, I ran it in bash environment with following command: $ your/python/path /path/to/your/python/script.py And make sure first line of your python program contains the path to the python environment you wish to use. Eg: #! /usr/local/bin/python
1
2
0
In my terminal and in CodeRunner my Python is updated to 2.7.6 but when I ran a shell script in the OSX Automator I found that it is running 2.7.2 How can I update the Automator Python to 2.7.6 like the rest of my compilers ?
Specify which version of Python runs in Automator?
1.2
0
0
952
20,507,380
2013-12-10T23:15:00.000
0
0
1
0
python,string,compression
20,510,394
2
false
0
0
There is a much simpler encoding scheme than base 62 or modifications of base 64 for limiting the output to 62 values. Take your input as a stream of bits (which in fact it is), and then encode either five or six bits as each output character. If the five bits are 00000 or 00001, then encode it as your first two char...
1
1
0
I have a long string and I would like to compress it to a new string with the restriction that the output alphabet only contains [a-z] [A-Z] and [0-9] characters. How can I do this, specifically in Python?
String Compression: Output Alphabet Restricted to Alphanumeric Characters
0
0
0
1,443
20,507,907
2013-12-11T00:00:00.000
4
0
1
1
python,windows,shell,startup
20,508,067
2
true
0
0
Create a batch file with the line start C:\python27\python.exe D:your_program_location\your_program.py' Drag the batch file from desktop to "Start - All Programs - Startup". That should do the trick.
2
0
0
I have made a program that takes infrared values serially, transmits them them to another program(the one im having trouble with), and uses the win32 python api to react to a matched value. It all works, but I need this program to run on the startup of my computer. It uses the IDLE python shell to run, and I need to op...
how to Start python shell program on windows 7 startup?
1.2
0
0
6,240
20,507,907
2013-12-11T00:00:00.000
0
0
1
1
python,windows,shell,startup
20,508,698
2
false
0
0
It sounds like your actual problem is just that you didn't put the right extension on the file. Just rename it to, e.g., script.py, or script.pyw, and, unless you've changed the settings from the default, that should open the file with the command-line or windowed Python launcher, which will just run it. If you've chan...
2
0
0
I have made a program that takes infrared values serially, transmits them them to another program(the one im having trouble with), and uses the win32 python api to react to a matched value. It all works, but I need this program to run on the startup of my computer. It uses the IDLE python shell to run, and I need to op...
how to Start python shell program on windows 7 startup?
0
0
0
6,240
20,509,103
2013-12-11T01:54:00.000
1
0
0
0
python,random
20,509,223
2
false
0
0
To generate retrieve the path of a random image in a folder img_folder, it's not too difficult. You can use img_path_array = os.listdir('.../img_folder'). Randomly generate an integer between 0 and len(img_path_array) using random_index = randrange(len(img_path_array)) (import random to use this function), and gain acc...
1
1
1
I really appreciate any responses. I am thoroughly confused and never knew this experiment design/builder software was so complicated! I am a fast learner, but still a newbie so please be patient. Yes I have googled the answers for my question but no answers to similar questions seem to work. I have an experiment, ther...
how to randomise the image shown in a sketchpad
0.099668
0
0
65
20,512,397
2013-12-11T06:48:00.000
5
0
0
0
java,python,performance,neo4j
20,512,703
1
false
1
0
In general, the fastest way to do traversals in neo4j is with the Java API. You might consider testing to see if it is fast enough before potentially prematurely optimizing. Try one of the python libraries w/ Cypher to see how it performs. If you do have to resort to the Java API, you can usually get away with writin...
1
0
0
I have to do traversals on neo4j graph in real time. The graph contains around 200,000 nodes and 300,000 relationships. My main concern is that results should be super fast. Should I write the traversal algorithms in Java? Does Using python (py2neo or bulbflow) for the same has significant performance issues? My perso...
Which platform to use for fastest neo4j graph traversal?
0.761594
0
0
208
20,516,490
2013-12-11T10:22:00.000
0
1
0
1
python,logging,streaming
21,938,560
2
false
0
0
I'm doing something like that. I have a server running on my raspberry pi + client that parse the output of the server and sends it to another server on the web. What I'm doing is that the local server program write it's data in chunks. Every time it writes the data (by the way, also on tmpfs) it writes it on a diffe...
1
0
0
I made a program which is saving sensor data in a log file (server site). This file is stored in a temporary directory (Ram-Disk). Each line contains a timestamp and a JSON string. The update rate is dependent on the sensor data, but the fastest is every 0.5s. What I want to do is, to stream every update in this file ...
Streaming of a log text file with constant updates
0
0
0
189
20,519,669
2013-12-11T12:52:00.000
1
0
0
0
python,grid,wxpython,sum,auto-update
20,523,503
1
true
0
1
You will need to catch a cell related events. I would recommend EVT_GRID_EDITOR_HIDDEN as that event fires after you have left a cell where you had double-clicked it to start an edit. You could also use EVT_GRID_CELL_CHANGE, although just because you changed cells doesn't mean you did an edit. Either way, in the event...
1
0
0
I have a wx.grid with size 1*3 (1 row, 3 columns). Cell 1*1 has value 3, cell 1*2 has value 5 and I want cell 1*3 to display sum of the other cells (3 + 5 = 8). And I want cell 1*3 to autoupdate its value as cell 1*1 and cell 1*2 changes. How to do this wit wxpython grid?
How to display sum of 2 cell values in another cell and autorefresh it as cell values change in wxpython grid?
1.2
0
0
163
20,521,456
2013-12-11T14:14:00.000
1
0
0
1
python
36,706,017
4
false
0
0
I was having the same issue. The code works in the IDLE but not on double click. I ran the script through the command prompt and it gave me an error that the IDLE didn't find. Windows didn't like the ascii characters I was printing. I removed them and the script started to work on double click again.
1
5
0
I always ran my scripts on windows by double-clicking them. However after I reinstalled my python versions this is not happenning. My python installations are on C:\Python27 and C:\Python33. PATH has C:\Python27\ in it. If I try to run a script from cmd, it works ok. But when I double-click any .py file nothing happens...
Python scripts stopped running on double-click in Windows
0.049958
0
0
7,440
20,522,465
2013-12-11T15:00:00.000
0
1
0
0
python,python-3.3,distutils
20,535,929
1
false
0
0
No distutils version supports test integration: it’s a setuptools add-on. unittest in 2.7 and 3.2 gained support for auto-discovering tests, so even if you can’t run python setup.py test there’s still python -m unittest.
1
0
0
Is there a way to run unittests for a module with setup.py using distutils? python3.3 distutils doesn't seem to support the 'test_suite' option: In setup.py I have the following code: test_suite = 'test.run_tests',
How to run unittest with distutils in python3.3
0
0
0
175
20,524,025
2013-12-11T16:03:00.000
1
0
0
0
python,django
20,525,176
2
true
1
0
I do not recommend using Django if you are not interested in using a database. Having written that disclaimer, if you insist on still using it, you can just scan over the documentation and identify what is still available to you if you do not have a database: You can use Django's security features to help protect agai...
1
0
0
I recently got into Django out of curiosity after developing for quite a while w/ Ruby on Rails and Node.js, and found that it's splendid for working w/ databases. Django is primarily known for working with databases and every tutorial I've ever found on it has included databases. Django supports not requiring database...
What would be the more practical uses for a Django application w/out a database?
1.2
0
0
70
20,528,082
2013-12-11T19:19:00.000
1
0
0
0
python,validation,user-interface,checkbox,tkinter
20,528,169
2
false
0
1
Don't use checkboxes; use radoibuttons instead. The behavior of checkboxes and radiobuttons is well established -- checkboxes allow you to select N of N choices, radiobuttons are designed to allow you to select exactly 1 of N. Don't violate this design pattern or your users will be confused. To make radiobuttons work,...
1
0
0
I am trying to create a multiple choice quiz in Tkinter. Each question has between 2-4 different answers all displayed as checkboxes, how do I ensure the user can only tick one check box and not all of them? Thanks
Checkbox validation: how do i ensure user can only tick one box only?
0.099668
0
0
1,562
20,528,328
2013-12-11T19:33:00.000
9
0
0
0
python,arrays,numpy
41,922,008
9
false
0
0
Building on abarnert's answer for n-dimensional case: TL;DR: np.logical_or.reduce(np.array(list))
1
129
1
Numpy's logical_or function takes no more than two arrays to compare. How can I find the union of more than two arrays? (The same question could be asked with regard to Numpy's logical_and and obtaining the intersection of more than two arrays.)
Numpy `logical_or` for more than two arguments
1
0
0
64,891
20,528,456
2013-12-11T19:41:00.000
0
0
0
0
c++,python,opengl,blender,vtk
25,369,835
1
true
0
1
This was solved by requesting that Blender perform a triangulization of the mesh prior to the export operation. The mangling was due to Blender performing implicit triangulization of quads, resulting in faces which were stored as 4 non-coplanar points. By forcing explicit triangulation in advance, I was able to succe...
1
0
1
Using VTK version 5.1, I'm having some issues with some models not displaying correctly in OpenGL. The process for getting the models into VTK is a bit roundabout, but gets there and is fairly simple. Each model is a manifold mesh comprised of only quads and tris. Blender models->custom export format containing points,...
vtk Filters causing point doubling and mangling normal values
1.2
0
0
175
20,529,081
2013-12-11T20:16:00.000
1
0
1
0
python
20,529,123
1
false
0
0
Are you referring to the icons you see in the IDE (Integrated Development Environment)? If yes, then the spanner icon usually refers to Properties of the item / control / file in context. It could also mean Settings although the most common icon for Settings is the Gear icon.
1
3
0
This may sound like a dumb question, but I have searched everywhere and have come up with nothing. What does it mean to use a spanner or screwdriver when programming?
In programming, what is a spanner or screwdriver?
0.197375
0
0
160
20,529,878
2013-12-11T21:04:00.000
5
0
0
0
python,python-3.x,time-complexity
20,531,306
3
false
0
0
This is too long for a comment: in CPython, a yield passes its result to the immediate caller, not directly to the ultimate consumer of the result. So, if you have recursion going R levels deep, a chain of yields at each level delivering a result back up the call stack to the ultimate consumer takes O(R) time. It al...
2
3
0
I've to calculate the time-complexity of an algorithm, but in it I'm calling os.walk which I can't consider as a single operation but many. The sources of os.walk left me confused as the filetree may be ordered in many ways (1.000.000 files in a folder or a file per folder and 1.000.000 folders. I'm not an expert on t...
Time complexity of os.walk in Python
0.321513
0
0
2,735
20,529,878
2013-12-11T21:04:00.000
2
0
0
0
python,python-3.x,time-complexity
20,530,026
3
false
0
0
os.walk (unless you prune it, or have symlink issues) guarantees to list each directory in the subtree exactly once. So, if you assume that listing a directory is linear on the number of entries in the directory,* then if there are N total directory entries in your subtree, os.walk will take O(N) time. Or, if you want ...
2
3
0
I've to calculate the time-complexity of an algorithm, but in it I'm calling os.walk which I can't consider as a single operation but many. The sources of os.walk left me confused as the filetree may be ordered in many ways (1.000.000 files in a folder or a file per folder and 1.000.000 folders. I'm not an expert on t...
Time complexity of os.walk in Python
0.132549
0
0
2,735
20,532,581
2013-12-12T00:10:00.000
0
0
0
0
unicode,wxpython,wxwidgets,wxstyledtextctrl
20,545,016
1
true
0
1
Saving code uses wxConvCurrent, so you could try setting it to wxConvUTF8 to ensure that UTF-8 is used even when it's not the encoding of the current locale (which is never the case under Windows). Unfortunately I'm not sure if you can change wxConvCurrent from Python. If you can't, the simplest solution would probably...
1
1
0
I have a wxPython GUI with a wx.stc.StyledTextCtrl text editor. It is possible that its content contain some unicode characters such as Greek letters. I have noticed that StyledTextCtrl.SaveFile() method works only when the content has no unicode characters. Otherwise the saved file ends up being an empty file. I tried...
An issue with calling w.stc.StyledTextCtrl.SaveFile with a unicode content
1.2
0
0
255
20,532,621
2013-12-12T00:14:00.000
0
0
1
0
python,python-2.7,visual-studio-2012,pandas,ptvs
45,561,466
4
false
0
0
I faced the same issue, but just hitting 'Continue' will cause it to be ignored and the code execution will proceed in the usual way. Or you could uncheck the "Break when this exception type is user-handled" option that comes up in the dialog box displaying the error.
3
5
1
I am dealing with a very silly error, and wondering if any of you have the same problem. When I try to import pandas using import pandas as pd I get an error in copy.py. I debugged into the pamdas imports, and I found that the copy error is thrown when pandas tries to import this: from pandas.io.html import read_html ...
Pandas import error when debugging using PVTS
0
0
0
3,689
20,532,621
2013-12-12T00:14:00.000
0
0
1
0
python,python-2.7,visual-studio-2012,pandas,ptvs
37,602,619
4
false
0
0
I had a system crash while developing a PTVS app and then ran into this problem, re-running the Intellisense 'refresh DB' cleared it.
3
5
1
I am dealing with a very silly error, and wondering if any of you have the same problem. When I try to import pandas using import pandas as pd I get an error in copy.py. I debugged into the pamdas imports, and I found that the copy error is thrown when pandas tries to import this: from pandas.io.html import read_html ...
Pandas import error when debugging using PVTS
0
0
0
3,689
20,532,621
2013-12-12T00:14:00.000
0
0
1
0
python,python-2.7,visual-studio-2012,pandas,ptvs
36,753,326
4
false
0
0
I had the same problem for a while, disabling "Debug standard library" didn't help, then I downloaded the latest version of Python (3.4), pip installed the libs (for example NLTK), and it worked!
3
5
1
I am dealing with a very silly error, and wondering if any of you have the same problem. When I try to import pandas using import pandas as pd I get an error in copy.py. I debugged into the pamdas imports, and I found that the copy error is thrown when pandas tries to import this: from pandas.io.html import read_html ...
Pandas import error when debugging using PVTS
0
0
0
3,689
20,533,293
2013-12-12T01:22:00.000
0
0
1
0
python,pyinstaller
20,533,369
3
false
0
0
As Ms Turdy mentioned, you should run it in a command prompt or terminal first, if it will have the same behavior as the exe. You can execute a python script with python -m pdb script.py and it will enter into the debugger. You run it by pressing C for continue, then it will break when it raises the exception.
1
0
0
I have written a programme by python which is successfully tested under eclipse.Then I used pyinstaller to excute it as a .exe file. When the programme raise the exception ,the cmd window will quit immediately. I want to stay in this window to take a good look at this exception. How can I do it ? Thank you.
How to stay in the cmd window when the exception has been raised?
0
0
0
172
20,539,077
2013-12-12T09:03:00.000
0
0
0
0
wxpython
20,569,837
1
false
0
1
You may not be able to customize that particular control very well as it wraps the native widget (if it exists). Instead, I would recommend switching to BalloonTip or possibly better, the SuperToolTip. Both of these controls are generic, pure Python controls. That means that they usually have additional customization a...
1
0
0
Is it possible to create a custom tooltip with no border using wx.TipWindow. I can do this with PopupTransientWindow but I could not figure out the which event to use to dismiss the popup when the mouse is moved away from a given rectangle bound(not clicked but moved away).
Tooltip without border in wxpython
0
0
0
131
20,539,363
2013-12-12T09:18:00.000
0
0
1
0
ipython,usability,parentheses,tab-completion
20,542,483
1
true
0
0
On 1.1.0: In[0]:/SPACE my_exTAB -----> my_extremely_long_function_with_no_args() Entering SPACE after / will work on a release after 0.8.4. 0.13.0 has it fixed. I cannot pinpoint the exact version it was introduced. Still my expectation is not fulfilled (i.e. working without the SPACE in between)
1
1
0
In ipython (version 0.8.1 on Ubuntu 8.04, version 1.1.0 on Ubuntu 12.04) when forcing automatic parentheses by starting the function name with / will make useless the TAB completion. E.g. In[0]:/my_exTAB In[0]:/my_extremely_long_function_with_no_args -----> my_extremely_long_function_with_no_args() Is there a setting...
Forcing automatic parentheses in ipython loses tab completion
1.2
0
0
121