Q_Id
int64
337
49.3M
CreationDate
stringlengths
23
23
Users Score
int64
-42
1.15k
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
Tags
stringlengths
6
105
A_Id
int64
518
72.5M
AnswerCount
int64
1
64
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
6
11.6k
Available Count
int64
1
31
Q_Score
int64
0
6.79k
Data Science and Machine Learning
int64
0
1
Question
stringlengths
15
29k
Title
stringlengths
11
150
Score
float64
-1
1.2
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
8
6.81M
9,124,657
2012-02-03T06:36:00.000
5
0
0
0
python,process,cron
9,124,719
3
true
0
0
Rather than making your script loop many times, just write it to perform this task a single time. Then run the script multiple times, as often as you wish, as a cronjob. Edit your cron table to specify timings using the command crontab -e. You needn't worry about server restarts because cron will be started as a ser...
2
3
0
I need to write a python script that constantly checks a remote web service for updates. The faster it loops the better. How do I get a script to run on my server over and over again without me having to manually start it each time? And if the server crashes or something, how does this script automatically start up aga...
constantly running a script on my server
1.2
0
1
3,351
9,125,733
2012-02-03T08:31:00.000
1
1
0
0
php,python,id3
19,575,869
7
false
0
0
You can just use VLC player. Click on Tools->Media Information
3
3
0
I have a bunch of mp3 files that are pretty old and don't have any copy rights. Yet, the place I got them from has filled the copy right tags with its own website url. I was wondering if there's an easy way to remove these tags programmatically? There's a winamp add on that allows me to do this for each song, but that...
How can I remove the copyright tag from ID3 of mp3s in python or php?
0.028564
0
1
45,647
9,125,733
2012-02-03T08:31:00.000
-1
1
0
0
php,python,id3
39,645,756
7
false
0
0
No Need Of any PHP code Just Reproduce the mp3 file i.e.either burn & rip or cut the size &time making a new file where you can specify your own multitudes of options
3
3
0
I have a bunch of mp3 files that are pretty old and don't have any copy rights. Yet, the place I got them from has filled the copy right tags with its own website url. I was wondering if there's an easy way to remove these tags programmatically? There's a winamp add on that allows me to do this for each song, but that...
How can I remove the copyright tag from ID3 of mp3s in python or php?
-0.028564
0
1
45,647
9,125,733
2012-02-03T08:31:00.000
0
1
0
0
php,python,id3
26,053,995
7
false
0
0
Yes Yes This works! Just download the latest version of VLC media player. Open the mp3 file in it. Right click on file > choose 'information' > edit publisher & copyright information there > click 'Save Metadata' below. And u r done. :)
3
3
0
I have a bunch of mp3 files that are pretty old and don't have any copy rights. Yet, the place I got them from has filled the copy right tags with its own website url. I was wondering if there's an easy way to remove these tags programmatically? There's a winamp add on that allows me to do this for each song, but that...
How can I remove the copyright tag from ID3 of mp3s in python or php?
0
0
1
45,647
9,125,997
2012-02-03T08:56:00.000
9
0
1
0
python
9,126,238
5
false
0
0
The point behind a subclass is that it extends and alters the behaviour of the superclass. The superclass can't know how a subclass will extend it. Edit: But it is well possible that the superclass knows, that the subclass will extend it. Not sure, if this is good design, though.
1
14
0
I want to know how to call subclass methods in the superclass.
How to call subclass methods in a superclass in Python
1
0
0
32,346
9,133,704
2012-02-03T18:33:00.000
1
0
0
0
python,django
9,134,197
1
false
1
0
Have you tried CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True? Assuming whatever caching you're using utilizes Django's cache framework, that should do the trick.
1
1
0
I love django-staticgenerator. Unfortunately you can't use it in cases in which you have to display different content depending on the user, plus is not being actively developed. Is it possible to return the cached response only to non-logged in users? I saw an app that used nginx to do it, is it possible to do it with...
Caching the entire response (HTML, js, json, ecc) only for non-logged in users
0.197375
0
0
184
9,134,491
2012-02-03T19:38:00.000
-1
1
0
0
python,gmail,oauth-2.0,gmail-imap,imaplib
11,414,012
4
false
0
0
IMAP does not support accessing inbox without password -> so imaplib doesnt
1
12
0
I am using Google's Oauth 2.0 to get the user's access_token, but I dont know how to use it with imaplib to access inbox.
Access Gmail Imap with OAuth 2.0 Access token
-0.049958
0
1
6,657
9,134,717
2012-02-03T19:59:00.000
1
0
1
0
ironpython,setuptools
9,136,461
1
false
0
0
Distribute is a fork of setuptools that supports Python 3, among other things. ez_install is used to install setuptools/easy_install, and then easy_install can be used to install packages (although pip is better). Three years ago IronPython was missing a lot of the pieces needed, like zlib (2.7.0) and zipimport (upcomi...
1
0
1
Our company has developed Python libraries to open and display data from files using our proprietary file format. The library only depends on numpy which has been ported to IronPython. The setup.py for our internal distribution imports from setuptools but apparently this is not yet supported in IronPython. Searching th...
IronPython and setuptools/ez_install
0.197375
0
0
919
9,136,567
2012-02-03T22:48:00.000
1
0
0
0
python,wxpython,wxwidgets
9,137,127
2
false
0
1
Put your group of widgets organized in a sizer in the same parent container (p.e. a panel) and hide the parent. All the widgets disappear with the parent. Note that sometimes hiding (for example) buttons or checkboxes is not the best solution. Available functionality for the user can be also modulated using widget.Disa...
2
1
0
I have a bunch of widgets and right now I am using Hide() and Show() to each widget individually when I flip through different sections/pages of my program. Because I did this, You can see each widget leaving/showing one by one (which kinda sucks). Is there anyway to group all these widgets and then be able to Hide() a...
Assiociate Widgets into Groups, for Hide and Show, wxpython
0.099668
0
0
346
9,136,567
2012-02-03T22:48:00.000
3
0
0
0
python,wxpython,wxwidgets
9,143,928
2
true
0
1
Try using Freeze/Thaw/Layout when you are showing and hiding the widgets. This way they should all appear/disappear at the same time.
2
1
0
I have a bunch of widgets and right now I am using Hide() and Show() to each widget individually when I flip through different sections/pages of my program. Because I did this, You can see each widget leaving/showing one by one (which kinda sucks). Is there anyway to group all these widgets and then be able to Hide() a...
Assiociate Widgets into Groups, for Hide and Show, wxpython
1.2
0
0
346
9,139,826
2012-02-04T09:29:00.000
7
0
1
1
python,linux
9,140,731
2
false
0
0
You can also install python2.7 package. Then you can define python version with shebang (#!/usr/bin/env python2.7) or even use #update-alternatives --config python to make it default interpreter. But it can break a lot of system apps... update: sometimes, there's no alternative to python, so you'll need to create those...
1
6
0
I installed ubuntu 10.04 and it comes with python2.6. How can I upgrade it to 2.7?
How to update python 2.6 to python 2.7 in ubuntu
1
0
0
28,481
9,140,441
2012-02-04T11:13:00.000
1
0
0
0
python,django
9,178,073
3
true
1
0
I used django-chronograph for managing my scheduled jobs and django-peavy for logging. That provided everything I needed.
1
4
0
I have a few management commands for my Django poject that is run automatically by cron. Are there any django packages that allow me to monitor the status of my background jobs? Currently I have to trudge through my log files to find out if everything went okay or not and I'm confident that writing a simple job/task mo...
Background job/task monitor for Django
1.2
0
0
719
9,143,570
2012-02-04T19:00:00.000
5
1
1
0
python
42,944,983
2
false
0
0
You can add a __init__.py file without any content to the directory which yo want to import. The init.py files are required to make Python treat the directories as containing packages; this is done to prevent directories with a common name, such as string , from unintentionally hiding valid modules that occur later (de...
1
6
0
I have one testing module that I want to use for android testing. I have the files but there is no installation file for it, so I added the module to PATH variable, even then it doesn't work I try to import it. Any way to make it work. Do I have to paste them in Python folder only (and what it the Python file location)...
Python module not working (not able to import) even after including it in PATH variable
0.462117
0
0
14,142
9,145,880
2012-02-05T00:27:00.000
0
0
1
0
python,installation,ipython
9,160,426
1
true
0
0
Reposting as an answer: There should be a name like python2.7, so running python2.7 setup.py install will install it for Python 2.7. This is the same for all packages. If you want to use a tool like easy_install or pip, they also need to be installed for the relevant version of Python.
1
3
0
I am trying to install Ipython 0.12 on to python 2.7. Because I'm using a MacBook python 2.5 was already installed as standard on OSX, when i try installing ipython with python setup.py install I get a message saying ERROR: 'IPython requires Python Version 2.6 or above.' I believe it is trying to install ipython on ver...
trying to install Ipython on version 2.7 but it keeps trying to install on version 2.5
1.2
0
0
740
9,146,320
2012-02-05T02:06:00.000
1
0
0
0
python,mysql,ubuntu,installation
51,553,512
7
false
0
0
If you are planning to switch from MySQLDB then I recommend you to use MySQL connector Python Why ? it work with both Python 2 and 3 Because it is official Oracle driver for MySQL for working with Python. It is purely written in Python You can also use C extension to connect to MySQL. MySQL Connector/Python is implem...
1
9
0
i have Ubuntu and installed python3 since my script is written in it. Since I use MYSQL with MySQLdb, I installed apt-get install python-mysqldb however this installed MySQLdb to Python (which is 2.6 on Ubuntu) and not to Python3. How can I install MySQLdb for Python3 Should I use it at all or switch to PyMSQL Sorry...
install python MySQLdb to python3 not python
0.028564
1
0
14,751
9,147,639
2012-02-05T07:20:00.000
0
0
0
0
python,reportlab
9,150,377
1
false
0
0
Based on what I know of the way bullets are done, you'd probably be best off developing a custom flowable that replicates bullet list functionality but lets you choose the bullet to be an image. Admittedly, not a great solution, but it would get the job done. The way bullets are implemented depends somewhat heavily o...
1
0
0
I am trying to figure out a good way to do this. I see that there is a way to do bulleted lists in reportlab, the only problem is that this assumes that the bullets will be some sort of text character (like a "*" or "-"). What I am trying to figure out is what is the best way to use an image as the bullet in a flowab...
Reportlab graphics and bullets
0
0
0
259
9,148,782
2012-02-05T11:17:00.000
0
0
1
0
python,pyqt4,python-2.7
9,148,796
2
false
0
1
There's no way to do this automatically. You'll just have to give each B a reference to A when you create it, something like b_instance.parent = a_instance.
1
0
0
I have a question. There are two classes: A and B. A creates object of type B. So from A, it is easy to access methods of B, but how can I access methods of object A from object B? I am trying to use bidirectional signal-slot mechanism in Qt. A can easily have a slot for a signal in B, but B cannot see signals in A. I ...
How to reference creator object in Python?
0
0
0
298
9,152,827
2012-02-05T20:41:00.000
2
0
0
0
python,wxpython
9,161,998
2
true
0
1
The whole point of disabling a button is so that the EVT_BUTTON event is not fired. I'm sure you could create create an ugly hack using EVT_LEFT_DOWN and detecting where the mouse is in your app as a workaround, but why bother? This is intended behavior.
2
1
0
I have a disabled button, and it does not receive clicks when I use EVT_BUTTON on it. Is there a way to receive clicks even when it has been Disabled()?
How to get clicks on disabled buttons with wxpython?
1.2
0
0
97
9,152,827
2012-02-05T20:41:00.000
0
0
0
0
python,wxpython
9,160,600
2
false
0
1
Perhaps wxpython has a mechanism similar to pygtk. In pygtk you create a input-only (that is transparent) window over the widget you want to get clicks for and get your clicks there.
2
1
0
I have a disabled button, and it does not receive clicks when I use EVT_BUTTON on it. Is there a way to receive clicks even when it has been Disabled()?
How to get clicks on disabled buttons with wxpython?
0
0
0
97
9,155,618
2012-02-06T04:36:00.000
0
0
1
0
python,class
21,661,825
5
false
0
0
At first make sure you have high test coverage, this will boost your refactoring experience. If there are no or not enough unittests, create them. Then make reasonable small refactoring steps and keep the unittests working: As a rule of thumb try to keep the core functionality together in the big class. Try not to draw...
4
7
0
I have a class BigStructure that builds a complicated data structure from some input. It also includes methods that perform operations on that data structure. The class grew too large, so I'm trying to split it in two to help maintainability. I was thinking that it would be natural to move the operations into a new cla...
splitting a class that is too large
0
0
0
4,696
9,155,618
2012-02-06T04:36:00.000
0
0
1
0
python,class
9,157,192
5
false
0
0
For example, a typical operation may consist of traversing a big structure instance in a way that is only meaningful for a BigStructure object. Perhaps you could write some generators as methods of BigStructure that would do the grunt work of traversal. Then, OperationsOnBigStructure could just loop over an iterat...
4
7
0
I have a class BigStructure that builds a complicated data structure from some input. It also includes methods that perform operations on that data structure. The class grew too large, so I'm trying to split it in two to help maintainability. I was thinking that it would be natural to move the operations into a new cla...
splitting a class that is too large
0
0
0
4,696
9,155,618
2012-02-06T04:36:00.000
3
0
1
0
python,class
9,157,259
5
true
0
0
I was thinking that it would be natural to move the operations into a new class, say class OperationsOnBigStructure. I would say, that's quite the opposite of what Object Oriented Design is all about. The idea behind OOD is to keep data and methods together. Usually a (too) big class is a sign of too much responsibili...
4
7
0
I have a class BigStructure that builds a complicated data structure from some input. It also includes methods that perform operations on that data structure. The class grew too large, so I'm trying to split it in two to help maintainability. I was thinking that it would be natural to move the operations into a new cla...
splitting a class that is too large
1.2
0
0
4,696
9,155,618
2012-02-06T04:36:00.000
0
0
1
0
python,class
9,165,386
5
false
0
0
"""Now, I have two classes, but it feels like I haven't improved anything. In fact, I made things slightly more complicated, since I now need to pass the BigStructure object to the methods in OperationsOnBigStructure, and they need to store that object internally.""" I think a natural approach there would be to have "O...
4
7
0
I have a class BigStructure that builds a complicated data structure from some input. It also includes methods that perform operations on that data structure. The class grew too large, so I'm trying to split it in two to help maintainability. I was thinking that it would be natural to move the operations into a new cla...
splitting a class that is too large
0
0
0
4,696
9,156,981
2012-02-06T07:42:00.000
3
0
0
0
c#,python,openssl,bouncycastle,ssl
9,157,076
1
true
0
0
Absolutely. They only need to share the same protocol.
1
2
0
Can different crytographic library be use for server and client? I want to implement TLS. Server is currently written in Python; Client is written in C#. Example, using openssl with m2crypto for client and using Bouncy Castle for Server.
Using different crypto library for server and client
1.2
0
1
187
9,158,329
2012-02-06T09:54:00.000
2
1
0
0
java,python,google-api,protocol-buffers
9,158,407
2
true
0
0
Most APIs will indeed have some form of reader-based API that allows you to enumerate a raw protobuf stream. However, that by itself is not enough to fully understand the data, since without the schema the interpretation is ambiguous: a varint could be zig-zag encoded (sint32/sint64), or not (int32/int64/uint32/uint64...
1
2
0
Given a protobuf serialization is it possible to get a list of all tag numbers that are in the message? Generally is it possible to view the structure of the message without the defining .proto files?
Can all tag numbers be extracted from a given protobuf serialization?
1.2
0
1
428
9,158,578
2012-02-06T10:16:00.000
1
0
0
0
java,python,mysql,rest,jdbc
9,158,709
1
true
1
0
Of course they need to be thread safe. You should be writing your Java server as if it were single threaded, because a Java EE app server will assign a thread per incoming request. You also need to think about database isolation and table locking. Will you allow "dirty reads" or should your transactions be serializab...
1
0
0
I have a project in which i use JDBC with MySQL to store some user information, Java REST for the server and Python REST for the client. My question is: by default(i haven't changed anything in the configurations), are the http requests from the client serialized on the server's side? I ask this because i'd like to kno...
Serialization with JDBC with MySQL, JAVA REST and Python REST
1.2
1
0
253
9,158,845
2012-02-06T10:39:00.000
0
0
0
0
python,linux,curl,proxy,dns
9,160,090
1
true
0
0
I believe if you use http proxy, name resolution for a symbolic hostname will be done by the proxy as well. If you want to wrap it in python, use pycurl and setopt pycurl.HTTPPROXYTUNNEL.
1
1
0
I'm writing a small Python script which requires resolving hosts IPs or domain names. Normally I'd use gethostbyname or gethostbyaddr. However, whole traffic is sent via proxy. I'm able to retrieve data using curl with -x option. My question is how can I resolve hostname and IP with proxy on the way? In Python I can't ...
Hostname resolve using proxy
1.2
0
1
1,209
9,159,368
2012-02-06T11:23:00.000
0
0
0
0
wxpython,listctrl
9,162,017
1
false
0
1
If you use the UltimateListCtrl, then yes. The normal ListCtrl widget does not support that.
1
0
0
I want to know if it is possible to incorporate Buttons in a ListCtrl in report mode on each line in a column.
Buttons in a wx.ListCtrl in wxPython
0
0
0
142
9,160,294
2012-02-06T12:44:00.000
1
0
1
0
python,multithreading,ctypes
9,163,769
2
false
0
1
Are you properly anottating the malloc call so that ctypes know it should return pointers not integers? (Doubly so if you are working on a 64bit box?)
1
0
0
I'm using Python's CTypes to bind to a shared library; I have a callback registered with this library, which is called in the context of a thread that the library itself creates. I've found that if I call libc.malloc() (libc = cdll.LoadLibrary('libc.so.6')) from within my callback, that it returns bogus values. Not NUL...
Malloc failing when called via ctypes from a c thread
0.099668
0
0
811
9,160,411
2012-02-06T12:53:00.000
0
0
0
0
python,mysql,database,sqlalchemy
9,161,223
1
true
0
0
Test is meant to perform both the upgrade and the downgrade steps. You want to verify that the application is usable in both states. So the idea would be to upgrade, run tests, downgrade, run tests, and verify you don't break things. If the test run fails, it gives you a chance to clean it up, reset, and try again. Usu...
1
0
0
Why use py manage.py test ? What's the point? It creates the table anyway... if I wanted to test it, then I wouldn't want it to create the actual table!!!
In SQLAlchemy-migrate, what's the point of using "test"?
1.2
1
0
126
9,161,439
2012-02-06T14:15:00.000
2
0
1
0
python,file
9,161,630
7
false
0
0
As @kev suggests, the configparser module is the way to go. However in some scenarios (a bit ugly, I admit) but very simple and effective way to do to this is to rename myfile.txt to myfile.py and do a from myfile import * (after you fix the typo var 0 -> var0) However, this is very insecure, so if the file is from an ...
1
26
0
I am a newbie with Python and I search how to parse a .txt file. My .txt file is a namelist with computation informations like : myfile.txt var0 = 16 var1 = 1.12434E10 var2 = -1.923E-3 var3 = 920 How to read the values and put them in myvar0, myvar1, myvar2, myvar3 in python?
Parse key value pairs in a text file
0.057081
0
0
74,112
9,163,681
2012-02-06T16:41:00.000
3
0
0
1
python,rpm,httplib2,rhel5
9,248,837
1
true
0
0
Yes, it does matter. noarch marks a package as usable for every CPU architecture, usually when there are no compiled binaries in it. But the distribution matters in general. A noarch package from another distro may or may not work. It depends e.g. on package names, directories where to put the stuff, ... A package only...
1
1
0
I need httplib2 v0.7 RPM for RHEL 5.7, but can't find one. So, do you by chance know where can I get some? I see such RPMs but for other distros (e.g. Mandrake). Since it is python-only lib (noarch) does the distro matters? Can I get any and use it? Python 2.6
does the Linux distribution matters for noarch packages?
1.2
0
0
431
9,170,364
2012-02-07T02:50:00.000
0
0
1
0
python,linux,text,daemon
9,170,398
2
false
0
0
If you're going to take the trouble of storing a hash, you might as well store the whole line. It can't be that long. Or in any case, if it's long enough to be a problem, then these must be really huge files!! Anyway, you need data persistence of some kind. Pickle, JSON, SQLite are all options, but they all seem like o...
1
1
0
I'm designing a daemon that will continuously read lines from a single text file and process those lines. What is a good general purpose way to keep track of the last line processed, independent of the file name, in the event of lines being written to the text file while the daemon isn't running? Every so often, the fi...
Best way to keep track of the last line read in a text file
0
0
0
1,114
9,170,393
2012-02-07T02:54:00.000
5
0
1
0
c++,python,c,calling-convention
9,170,428
4
false
0
0
Calling between Python and C is a solved problem, so you generally won't have to worry about anything -- not least because Python is written in C. The problem described there is more an issue when multiple languages on a platform are all developed independently, individually bootstrapped from assembler. For example, t...
2
4
0
According to the wiki: Different programming languages use different calling conventions, and so can different platforms (CPU architecture + operating system). This can sometimes cause problems when combining modules written in multiple languages So am I supposed to be careful when I call C/C++ functions (expor...
different programming language and calling convention
0.244919
0
0
1,093
9,170,393
2012-02-07T02:54:00.000
0
0
1
0
c++,python,c,calling-convention
9,170,451
4
false
0
0
C and C++ have different calling conventions. C doesn't support calling C++ functions but C++ support calling C functions and supports the implementation of C functions in C++. That is, you can declare functions as extern "C" in C++. I don't know how the python bindings are calling C++ but you should be careful to call...
2
4
0
According to the wiki: Different programming languages use different calling conventions, and so can different platforms (CPU architecture + operating system). This can sometimes cause problems when combining modules written in multiple languages So am I supposed to be careful when I call C/C++ functions (expor...
different programming language and calling convention
0
0
0
1,093
9,171,080
2012-02-07T04:38:00.000
1
0
0
1
python,google-app-engine
9,171,764
1
true
1
0
Wouldn't it be easier to write a user model rather than access it with the Google accounts API? That way you could define user groups and access without having to rely on Google. The Google Accounts API in the example is really for low-level init debugging.
1
0
0
We are trying to develop a project in google app engine for a senior project, and its set up in such a way that only a subset of user at our college should be able to login to it. Our college uses google domains for email, so that is currently out login requirement (a college email though google that is), but how can ...
Only allow a subset of users to access a google app project
1.2
0
0
122
9,171,383
2012-02-07T05:22:00.000
0
0
0
0
python,udp,sendto
9,171,420
1
false
0
0
It might just be that other things are using your network card to send at the same time, and the system can only send 400ish from your application at a time before something else needs to use the NIC. It sounds more like an issue of network usage, than a problem with UDP or something.
1
1
0
once i run a .py to send 10000 UDP(lengh is: 110) using socket sendto(), a server receive about 400 msgs quickly, and later became very slow for more than 10s each msg. it is weird if i run the .py again, another 400 msgs received quickly. is there a limit of buffer or UDP problem, for this situation? yes i got it! UD...
UDP sendto() became very low, python
0
0
1
569
9,172,046
2012-02-07T06:43:00.000
5
1
0
1
python
9,173,292
1
false
0
0
If your script runs too long, cron will close its stdout/stderr that are normally redirected to a log file (through cron). Attempting to print after the timeout will give you broken pipe. A solution is to use logging or print only to your own log files and never to stdout. Also, cron has different envinronment, specifi...
1
1
0
I have made an extensive script that runs fine when started from the command line or IDLE. But when I try to run it with cron it keeps giving errors: IOError: [Errno 32] Broken pipe
Broken pipe" when running python with cron
0.761594
0
0
1,106
9,173,794
2012-02-07T09:28:00.000
3
0
1
0
python,modularity
9,180,449
3
false
0
0
Others have suggested studying other experienced programmers' code from open source projects, etc. and from tutorials and textbooks, which is sound advice. Sometimes a similar example is all you need to set you on the right path. I also suggest to use your own frustration and experience as feedback to help yourself im...
2
1
0
I've written a few little things in python, and I am ramping up to build something a little more challenging. The last project I made basically ingested some text files, did some regex over each file and structured the data in an useful way so I could investigate some data I have. I found it quite tough near the end ...
Python 'theory' - constructing a multifunction program - how to plan a basic flow
0.197375
0
0
953
9,173,794
2012-02-07T09:28:00.000
4
0
1
0
python,modularity
9,174,984
3
true
0
0
(1) It is possible to write a fine programme in a single .py file (2) In any style of programming, it is always (apart from special, hardware-driven cases) best to break your code up into short functions (or methods) that accomplish a discrete task. (3) Experienced programmers will frequent write their code one way, d...
2
1
0
I've written a few little things in python, and I am ramping up to build something a little more challenging. The last project I made basically ingested some text files, did some regex over each file and structured the data in an useful way so I could investigate some data I have. I found it quite tough near the end ...
Python 'theory' - constructing a multifunction program - how to plan a basic flow
1.2
0
0
953
9,174,799
2012-02-07T10:42:00.000
3
0
1
1
python,background,signals,command-line-interface
9,174,968
4
false
0
0
Roughly speaking the Ctrl+Z from a Unix/Linux terminal in cooked or canonical modes will cause the terminal driver to generate a "suspend" signal to the foreground application. So you have two different overall approaches. Change the terminal settings or ignore the signal. If you put the terminal into "raw" mode then ...
1
4
0
I want to prevent the user from going back to the shell prompt by pressing CTRL + Z from my python command line interpreter script. How can I do that?
How to prevent user stopping script by CTRL + Z?
0.148885
0
0
15,690
9,175,940
2012-02-07T12:03:00.000
1
0
1
0
python,c,multithreading,thread-safety,python-c-api
9,177,358
3
false
0
1
I suggest you investigate the multiprocessing module.
1
5
0
We are developing a small c server application. The server application does some data processing and responds back to the client. To keep the data processing part configurable and flexible we decided to go for scripting and based on the availability of various ready modules we decided to go for Python. We are using the...
Python-C api concurrency issue
0.066568
0
0
615
9,178,342
2012-02-07T14:50:00.000
0
0
0
0
wxpython,modal-dialog,toolbar
9,178,527
1
false
0
1
Well, if you have a "fileDialog" and a "dialog" object open, then you probably need to Destroy them both. If you set the toolbar buttons into a Disabled state, you'll want to Enable them after you dismiss the dialogs.
1
0
0
My application has a custom dialog box that enables the user to set options on creating a new document. The main window has a toolbar, and even after dismissing the dialog, the toolbar buttons don't return to an active state. I've seen if fileDialog.ShowModal() == wx.ID_OK: to get the return value, but is there somethi...
properly exiting custom modal dialog in wxpython
0
0
0
328
9,178,983
2012-02-07T15:30:00.000
2
0
1
0
python,math
9,179,029
10
false
0
0
1/4 rounds down (or floors) to 0 since 1 and 4 are integers. Therefore 1-0+6 = 7
6
1
0
I am doing some very basic excersizes in python. I'm using the hard way to learn python book, which in excersize 3 have a expression I should understand. 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6, is coming out as 7. For me, the answer is 6. 6 - 5 + 0 - 1 / 4 + 6 1 - 1 / 4 + 6 6. This is clearly wrong, but can anyone help me w...
Arithmetic in python, can't figure out simple basic operations
0.039979
0
0
2,069
9,178,983
2012-02-07T15:30:00.000
1
0
1
0
python,math
9,179,104
10
false
0
0
In Python3.x it'd be 6.75 b/c 1/4 = 0.25 (true division). However, in Python 2.x 1/4 = 0 (convert to the most generic type of the arguments used, that is int in given case). Therefore, if it'd be 1. / 4 or 1 / 4. then in Python2.x you'd get 0.25 and the result would be 6.75
6
1
0
I am doing some very basic excersizes in python. I'm using the hard way to learn python book, which in excersize 3 have a expression I should understand. 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6, is coming out as 7. For me, the answer is 6. 6 - 5 + 0 - 1 / 4 + 6 1 - 1 / 4 + 6 6. This is clearly wrong, but can anyone help me w...
Arithmetic in python, can't figure out simple basic operations
0.019997
0
0
2,069
9,178,983
2012-02-07T15:30:00.000
5
0
1
0
python,math
9,179,003
10
false
0
0
4 % 2 = 0 because the remainder of 4 / 2 is 0 1 / 4 is also 0 because it is doing integer division and .25 is floored to 0.
6
1
0
I am doing some very basic excersizes in python. I'm using the hard way to learn python book, which in excersize 3 have a expression I should understand. 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6, is coming out as 7. For me, the answer is 6. 6 - 5 + 0 - 1 / 4 + 6 1 - 1 / 4 + 6 6. This is clearly wrong, but can anyone help me w...
Arithmetic in python, can't figure out simple basic operations
0.099668
0
0
2,069
9,178,983
2012-02-07T15:30:00.000
1
0
1
0
python,math
9,179,035
10
false
0
0
You seem to think that python should evaluate everything to the left of a / operator before dividing by the first token to the right. That would be an odd evaluation order by any measure. As always with programming: if you have a complex expression with infix operators, use brackets to force the correct order.
6
1
0
I am doing some very basic excersizes in python. I'm using the hard way to learn python book, which in excersize 3 have a expression I should understand. 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6, is coming out as 7. For me, the answer is 6. 6 - 5 + 0 - 1 / 4 + 6 1 - 1 / 4 + 6 6. This is clearly wrong, but can anyone help me w...
Arithmetic in python, can't figure out simple basic operations
0.019997
0
0
2,069
9,178,983
2012-02-07T15:30:00.000
1
0
1
0
python,math
9,179,073
10
false
0
0
Priority is for division and multiplication, if you don't use brackets! In this way: 1-1/4+6=7 because 1/4, working with integer, is = 0
6
1
0
I am doing some very basic excersizes in python. I'm using the hard way to learn python book, which in excersize 3 have a expression I should understand. 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6, is coming out as 7. For me, the answer is 6. 6 - 5 + 0 - 1 / 4 + 6 1 - 1 / 4 + 6 6. This is clearly wrong, but can anyone help me w...
Arithmetic in python, can't figure out simple basic operations
0.019997
0
0
2,069
9,178,983
2012-02-07T15:30:00.000
0
0
1
0
python,math
9,179,031
10
false
0
0
operands are integer, so 1/4 integer dividing = 0
6
1
0
I am doing some very basic excersizes in python. I'm using the hard way to learn python book, which in excersize 3 have a expression I should understand. 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6, is coming out as 7. For me, the answer is 6. 6 - 5 + 0 - 1 / 4 + 6 1 - 1 / 4 + 6 6. This is clearly wrong, but can anyone help me w...
Arithmetic in python, can't figure out simple basic operations
0
0
0
2,069
9,180,803
2012-02-07T17:23:00.000
1
0
0
0
python,user-interface,wxpython,tkinter
9,183,516
4
false
0
1
Tkinter can handle transparent gifs. Your "container" requirements are a bit hard to understand, though. I don't understand what transparency has to do with the ability to drag it over different colored backgrounds. Certainly you can group objects (images, rounded retangles, ec) together on a canvas, and those objects ...
1
3
0
I am planning to write a card game in python, and now looking for a GUI (I'm new to Python). I have so far tried out two GUI's :TK(inter) and wxPython. Neither of them seem to be able , and correct me if I'm wrong, to do this : dragging a panel with an image of a Card in it And it's not even about the dragging. ...
Python GUI for cardgame
0.049958
0
0
8,471
9,182,936
2012-02-07T19:56:00.000
0
0
0
0
python,real-time
9,189,761
1
true
1
0
I would say, run the two on the same machien to start with, and see how the performance goes. Why spend money on a second machine if you don’t have to? As for “dealing with the ever growing amount of data”—do you need to keep old data around? If not, your second task can simply delete old data when it’s done with it. P...
1
2
0
I wanted your advice for the best design approach at the following Python project. I am building a web service system that is split into 2 parts: This part grabs realtime data from a 3rd party API and puts the data in a DB. This part exposes a json API to access data from the DB mentioned in 1). Some background...
Realtime data server architecture
1.2
1
0
319
9,184,873
2012-02-07T22:19:00.000
7
0
1
0
python,virtualenv,pip
9,184,903
1
true
1
0
Appears to be a bug in pip 1.0. Seems to work if I pip install --upgrade pip and then try it.
1
3
0
I can't seem to get pip to uninstall a package when using the environment flag. I've created a virtual environment: virtualenv --no-site-packages /path/to/testenv While not in the virtual environment, I issue: pip install --environment /path/to/testenv django Django is downloaded and installed. If I do the same command...
pip uninstall broken w/ --environment flag?
1.2
0
0
2,999
9,185,443
2012-02-07T23:09:00.000
-1
0
1
0
python,list
53,438,736
14
false
0
0
numbers = [] while True: try: num = int(input('Enter the number: ')) if num == 0: break else: numbers.append(num) except: print('Not a valid digit') odd = [i for i in numbers if i % 2 != 0] if odd: print('The largest odd number is: ', max(odd)) else: ...
3
3
0
If you have a list of numbers, how do you return only the max odd integer without using the max() function? I'm assuming it will have something to do with int % 2 != 0, but I'm not sure what else. I also have to return the overall max integer without using max(), but I got around that by sorting my list and using list...
In Python, what's the method for returning only the max odd integer in a list?
-0.014285
0
0
4,845
9,185,443
2012-02-07T23:09:00.000
2
0
1
0
python,list
9,185,488
14
false
0
0
Have a look at 'filter' built-in function
3
3
0
If you have a list of numbers, how do you return only the max odd integer without using the max() function? I'm assuming it will have something to do with int % 2 != 0, but I'm not sure what else. I also have to return the overall max integer without using max(), but I got around that by sorting my list and using list...
In Python, what's the method for returning only the max odd integer in a list?
0.028564
0
0
4,845
9,185,443
2012-02-07T23:09:00.000
0
0
1
0
python,list
9,185,613
14
false
0
0
The easiest approach is to separate the problem into subproblems. You can safely ignore every even number, so you have to be able to identify even numbers, you have to ignore numbers that satisfy the condition of being even and on the result - a list of odd numbers - you just have to find the highest number. So, find o...
3
3
0
If you have a list of numbers, how do you return only the max odd integer without using the max() function? I'm assuming it will have something to do with int % 2 != 0, but I'm not sure what else. I also have to return the overall max integer without using max(), but I got around that by sorting my list and using list...
In Python, what's the method for returning only the max odd integer in a list?
0
0
0
4,845
9,186,395
2012-02-08T00:54:00.000
-1
0
1
0
python,decorator
9,186,721
7
false
0
0
No, it is not possible to access variables inside the wrapped function, because (as F.J. pointed out in his edit) they don't exist at the time the decorator is in scope.
1
19
0
I'd like to read an object method's local value from a decorator that wraps it. I've got access to the function and func_code from within the decorator but it seems all I can get out of it is the names of the local vars, but not their values. Is it possible?
Python: Is there a way to get a local function variable from within a decorator that wraps it?
-0.028564
0
0
10,234
9,187,540
2012-02-08T03:36:00.000
3
1
1
0
unicode,python-3.x,string-parsing
9,191,732
1
true
0
0
This sounds like you have fallen victim for a misunderstand the basics of Unicode and encodings. It may be that you have not, but misunderstandnings are common and understandable, while the situation you describe are not. A string of bytes that contains mixed encodings are, per definition, invalid in any of these encod...
1
0
0
I'm working with a binary file that references another file using absolute paths. The path contains both japanese and ascii characters. The length of the string is given, so I can just read that many bytes and convert it into a string. However the problem is trying to convert the string. If I specify the encoding as as...
Working with strings with mixed encodings in python 3.x
1.2
0
0
993
9,187,578
2012-02-08T03:42:00.000
1
0
0
1
python,cloud
9,187,618
3
false
0
0
One of the most popular systems for processing large amounts of data in a cluster is Hadoop (http://hadoop.apache.org/) You can write functions in python using the MapReduce programming pattern (google it), upload your program to the cluster, and it will process your data. Take a look and read up. It's a huge topic - t...
3
0
0
Let's say I had a cloud cluster with Python or C or something and I want to execute my function (as a client) in the cloud. How could I possibly pass the function I wrote locally up to the server? I've seen this elsewhere and I not only don't know how to do it but I want to see if there are many ideas for it. Thanks, ...
Cloud Computing Passing a Function to Server
0.066568
0
0
124
9,187,578
2012-02-08T03:42:00.000
0
0
0
1
python,cloud
9,187,637
3
false
0
0
Well if you wrote it locally you probably wont be executing anything that require compilation in realtime (I assume your looking for efficiency and will be exchanging a whole series of computations in the cloud) which in that case you looking to send it something like a ruby file on the fly? But that doesn't seem very ...
3
0
0
Let's say I had a cloud cluster with Python or C or something and I want to execute my function (as a client) in the cloud. How could I possibly pass the function I wrote locally up to the server? I've seen this elsewhere and I not only don't know how to do it but I want to see if there are many ideas for it. Thanks, ...
Cloud Computing Passing a Function to Server
0
0
0
124
9,187,578
2012-02-08T03:42:00.000
0
0
0
1
python,cloud
9,337,324
3
false
0
0
Code mobility is a largely unexplored field with more questions than answers. Generally you cannot move arbitrary code around at runtime. There are a few programming languages that historically supported code mobility (e.g. Kali Scheme), but it is not something that would be ready for main stream use. Concerning functi...
3
0
0
Let's say I had a cloud cluster with Python or C or something and I want to execute my function (as a client) in the cloud. How could I possibly pass the function I wrote locally up to the server? I've seen this elsewhere and I not only don't know how to do it but I want to see if there are many ideas for it. Thanks, ...
Cloud Computing Passing a Function to Server
0
0
0
124
9,187,921
2012-02-08T04:40:00.000
3
1
1
0
python
9,188,059
2
false
0
0
I would still prefer composition to inheritance, whether multiple or single. Really getting into duck typing is a bit like having loads of implicit interfaces everywhere, so you don't even need inheritance (or abstract classes) very much at all in Python. But that's prefer composition, not never use inheritance. If inh...
1
6
0
I have a solid understanding of OOP and its idioms in Java. Now I am coding in python, and I am in a situation where having multiple inheritance may be useful, however (and this may be due to years of java code), i am reluctant to do it and I am considering using composition instead of inheritance in order to avoid po...
Multiple inheritance in python vs composition
0.291313
0
0
2,803
9,189,734
2012-02-08T08:17:00.000
0
1
1
0
c#,ironpython,nlog
9,235,739
1
false
0
0
Put nlog.config next to the ipy.exe.
1
1
0
I have some assemblies written in C#, which I want to use with IronPython interpreter. These assemblies use NLog for logging, and if I use them from C# code, I can provide NLog settings with the NLog.config. But how can I configure logging if I use ipy.exe interpreter?
How do I use NLog with IronPython interpreter?
0
0
0
169
9,189,795
2012-02-08T08:23:00.000
0
0
0
0
python,django
9,189,836
1
false
1
0
In short, you can't (or, at least, it would be fairly tricky and magical). In longer: apart from performing the checks in the apps themselves, you might want to consider creating a router app which handles the requests, then decides which sub-app should be responsible for them. If you can give some more details, it wou...
1
0
0
I am developing a large Django site where some of the users are going to have specific needs. So I am looking for a way to overload part of a Django app if the user meets specific conditions. I would prefer to be able to dynamically load a user tailored version of an app, instead of loading the standard app all togethe...
Overloading a part of or entire Django app for a specific User
0
0
0
53
9,196,538
2012-02-08T15:41:00.000
1
0
0
1
python,asynchronous,websocket,real-time,tornado
10,864,121
1
false
0
0
First, the first message send to server must have some data for identify the client. The handler save itself into a shared data with the client's id. The simple way is save this into a dict, as the websocket application's property. If some message need to send to some clients, pick up their handlers from shared data, t...
1
2
0
We're trying to build a server that utilizes "tornado.websocket.WebSocketHandler". Opposite to what is demonstrated on "demos\websocket\chatdemo.py", we want every client to establish its own private session, not to broadcast the message to all connected subscribers. How to identify individual "waiters" and deliver eve...
Concurrent connections to Tornado WebSocket server
0.197375
0
0
1,369
9,197,385
2012-02-08T16:27:00.000
5
0
0
1
python,amazon-web-services,boto
33,725,689
3
false
1
0
For anyone looking for information on the now-current boto3, it does not use a separate configuration file but rather respects the default one created by the aws cli when running aws configure (Ie, it will look at ~/.aws/config)
1
4
0
I'm using AWS for the first time and have just installed boto for python. I'm stuck at the step where it advices to: "You can place this file either at /etc/boto.cfg for system-wide use or in the home directory of the user executing the commands as ~/.boto." Honestly, I have no idea what to do. First, I can't find th...
Getting Credentials File in the boto.cfg for Python
0.321513
0
0
14,015
9,197,668
2012-02-08T16:44:00.000
0
0
1
0
python,import
9,197,871
2
false
0
0
I think the best way to workaround, would be to change the name of the toplevel directory, unless other packages depend on that package. You can do this by altering the setup.py or just change the name folder in site-packages directly. The egg is just meta data. As far as setting sys.path, it's better to use the site m...
1
7
0
I have two packages that install different packages with the same name. They are both "packages" in that they have top-level setup.py files which specify package=['foo'] in the setup command. If I install using distutils.core, the last to be installed overwrites the previous one (but I think wouldn't overwrite unless ...
Python: Two packages with the same name; how do you specify which is loaded?
0
0
0
4,345
9,198,435
2012-02-08T17:31:00.000
0
0
1
0
python,string,fonts,formatting,font-size
9,198,540
2
false
0
0
If you're running this on the command line, I'm almost certain that there's nothing you can do to override the font preferences set by the user. In both windows and Linux, the font settings of the command line are user controlled, and I doubt that you can change it without sudo access. Seeing as you're writing a calcul...
1
0
0
I'm writing a calculator currently and I'd like to have results displayed in a visually appealing form. The program just has a command line interface for the moment, but I've been trying to find a way to do various things with the results it displays. For example, I'd like to have it display the result in a bigger font...
Formatting Python string output
0
0
0
463
9,198,494
2012-02-08T17:34:00.000
1
1
0
0
python,database,web-applications,cryptography,pycrypto
9,198,661
3
false
0
0
Symmetric encryption is indeed useless, as you have noticed; however for certain fields, using asymmetric encryption or a trapdoor function may be usable: if the web application does not need to read back the data, then use asymmetric encryption. This is useful e.g. for credit card data: your application would encrypt...
3
11
0
I'm looking at using a crypto lib such as pycrypto for encrypting/decrypting fields in my python webapp db. But encryption algorithms require a key. If I have an unencrypted key in my source it seems silly to attempt encryption of db fields as on my server if someone has access to the db files they will also have acces...
How to store a crypto key securely?
0.066568
0
0
6,258
9,198,494
2012-02-08T17:34:00.000
0
1
0
0
python,database,web-applications,cryptography,pycrypto
9,198,676
3
false
0
0
Before you can determine what crypto approach is the best, you have to think about what you are trying to protect and how much effort an attacker will be ready to put into getting the key/information from your system. What is the attack scenario that you are trying to remedy by using crypto? A stolen database file?
3
11
0
I'm looking at using a crypto lib such as pycrypto for encrypting/decrypting fields in my python webapp db. But encryption algorithms require a key. If I have an unencrypted key in my source it seems silly to attempt encryption of db fields as on my server if someone has access to the db files they will also have acces...
How to store a crypto key securely?
0
0
0
6,258
9,198,494
2012-02-08T17:34:00.000
5
1
0
0
python,database,web-applications,cryptography,pycrypto
9,198,785
3
true
0
0
If you are encrypting fields that you only need to verify (not recall), then simple hash with SHA or one-way encrypt with DES, or IDEA using a salt to prevent a rainbow table to actually reveal them. This is useful for passwords or other access secrets. Python and webapps makes me think of GAE, so you may want somethin...
3
11
0
I'm looking at using a crypto lib such as pycrypto for encrypting/decrypting fields in my python webapp db. But encryption algorithms require a key. If I have an unencrypted key in my source it seems silly to attempt encryption of db fields as on my server if someone has access to the db files they will also have acces...
How to store a crypto key securely?
1.2
0
0
6,258
9,199,456
2012-02-08T18:41:00.000
1
0
1
1
python
9,199,816
1
true
0
0
I'm working right now with Wingware WingIDE and Python 3.2.2, so it is possible, using exactly the method you mentioned. Your problem must be elsewhere. Try updating Python and Wingware to their last versions.
1
0
0
I upgraded Python from version 2.6.6 to version 3.2, however, my WING IDE still uses version 2.6.6. I tried changing the Python executable under Edit --> Configure Python (and linking to the python.exe under C:/Python32), but that didn't seem to work even after a WING restart... Any help is appreciated, thank you. This...
How do you change the Python version used in Wing IDE 101?
1.2
0
0
7,291
9,199,551
2012-02-08T18:48:00.000
1
1
1
0
python,unit-testing
9,199,631
2
false
0
0
I would create one TestCase with several test methods. A bloom filter has simple semantics, so only one TestCase. I usually add a TestCase per feature.
2
4
0
I've never written a proper test until now, only small programs that I would dispose of after the test succeeded. I was looking through Python's unittest module and tutorials around the web, but something's not clear to me. How much should one TestCase cover? I've seen examples on the web that have TestCase classes wit...
How much should one TestCase cover?
0.099668
0
0
204
9,199,551
2012-02-08T18:48:00.000
5
1
1
0
python,unit-testing
9,199,764
2
true
0
0
To put it simple: one unit test should cover single feature of your program. That's all there is to say. That's why they're called unit tests. Of course, what we understand by feature may vary. Think about smallest parts of your program that might break or not work as expected. Think about business requirements of your...
2
4
0
I've never written a proper test until now, only small programs that I would dispose of after the test succeeded. I was looking through Python's unittest module and tutorials around the web, but something's not clear to me. How much should one TestCase cover? I've seen examples on the web that have TestCase classes wit...
How much should one TestCase cover?
1.2
0
0
204
9,202,562
2012-02-08T22:32:00.000
0
0
0
0
python,sql-server,architecture
9,456,223
1
false
0
0
If we assume that each language you use will have an optimized set of classes to interact with databases, then there shouldn't be a real need to pass all database calls through a centralized module. Using a "middle-ware" for database manipulation does offer a very significant advantage. You can control, monitor and man...
1
2
0
I am working on a system where a bunch of modules connect to a MS SqlServer DB to read/write data. Each of these modules are written in different languages (C#, Java, C++) as each language serves the purpose of the module best. My question however is about the DB connectivity. As of now, all these modules use the lang...
DB Connectivity from multiple modules
0
1
0
112
9,204,384
2012-02-09T01:54:00.000
3
0
1
0
python,windows,blender-2.61
9,206,152
2
true
0
0
go to help toggle system console.
2
3
0
I want to refresh my Python skill in Blender since it been a while. However, when I open Blender the console window does not open anymore. Also, when I go to the console and run the scripts from the text editor nothing shows up on the console. I do not want to save this file but I do want feedback from the console. How...
Blender 2.6 Console in window
1.2
0
0
2,281
9,204,384
2012-02-09T01:54:00.000
0
0
1
0
python,windows,blender-2.61
44,634,406
2
false
0
0
In Blender 2.78 on Windows, go to Window -> Toggle System Console.
2
3
0
I want to refresh my Python skill in Blender since it been a while. However, when I open Blender the console window does not open anymore. Also, when I go to the console and run the scripts from the text editor nothing shows up on the console. I do not want to save this file but I do want feedback from the console. How...
Blender 2.6 Console in window
0
0
0
2,281
9,206,627
2012-02-09T06:56:00.000
0
0
1
1
python
12,851,137
1
false
0
0
Trying running WHERE PYTHON (or WHERE PYTHON.EXE) to figure out where the python executable is at. It may be that python v2.4.5 is as part of another program.
1
1
0
major noob question: when I run python on the windows command line, it says I have 2.4.5... however, it's not in my PATH environment variable (or anywhere in my environment variables), and, Python27 IS in PATH! Anyone know how I can get Python27 up and running in windows cmd?
getting python 2.4.5 out of my environment variables
0
0
0
104
9,207,430
2012-02-09T08:21:00.000
2
0
1
0
python,django,ubuntu,webserver,virtualenv
12,794,019
2
false
1
0
Please using Freeze command and you will get text file with all the versions of packages. Then install them using easy install or pip install
2
30
0
I have an existing Python django Project running in Web Server. Now the client needs to make some changes in the existing code. So I need to set it up in my Local Machine. All the packages needed for this project is installed in a Virtual environment. How can I copy or clone this virtual environment to my Local machine...
How to Copy/Clone a Virtual Environment from Server to Local Machine
0.197375
0
0
19,745
9,207,430
2012-02-09T08:21:00.000
51
0
1
0
python,django,ubuntu,webserver,virtualenv
9,207,511
2
true
1
0
Run pip freeze > requirements.txt on the remote machine Copy that requirements.txt file to your local machine In your local virtual environment, run pip install -r requirements.txt And, so long as all of the requirements are well behaved Python packages, you should be good to go.
2
30
0
I have an existing Python django Project running in Web Server. Now the client needs to make some changes in the existing code. So I need to set it up in my Local Machine. All the packages needed for this project is installed in a Virtual environment. How can I copy or clone this virtual environment to my Local machine...
How to Copy/Clone a Virtual Environment from Server to Local Machine
1.2
0
0
19,745
9,211,015
2012-02-09T12:41:00.000
0
0
1
1
python-3.x
9,233,272
2
false
0
0
Try the following. In a file called exe.py put: import os import sys os.popen(sys.argv[1]) # Usage: C:\Python32>python exe.py notepad.exe
1
0
0
i need to write a script in python, which run a process (notepad.exe). The probelm is, i dont know the path of the process so i need to pass the path of the process as an argument. How does it work?
Python: pass the path as an argument
0
0
0
491
9,212,350
2012-02-09T14:09:00.000
1
0
0
0
python,pygtk,gedit,pygobject
9,213,736
1
true
0
1
Either empty the current tree store and fill it again from the new directory, or call set_model(new_treestore) on the tree view widget. It will update itself.
1
0
0
I'm writing my first gedit plugin, a directory browser for the sidebar. Show sidepanel with content of the cwd. self._side_widget = self.get_dir() #returns a Gtk.Treestore obj self.side_panel = self.window.get_side_panel() self.side_panel.add_item(self._side_widget, "dir-browser", "Directory Browser", None) self.sid...
Update Gedit side panel
1.2
0
0
543
9,213,797
2012-02-09T15:33:00.000
0
0
0
0
python,graphviz
9,215,067
3
false
0
0
I don't think you can do this. Clusters are done via subgraphs, which are expected to be separate graphs, not overlapping with other subgraphs. You could change the visualisation though; if you imagine that the members of a clique are members of some set S, then you could simply add a node S and add directed or dashed ...
1
8
1
I want to use graphviz in order to draw for a given graph all the maximal cliques that it has. Therefore I would like that nodes in the same maximal clique will be visually encapsulated together (meaning that I would like that a big circle will surround them). I know that the cluster option exists - but in all the exam...
Graphviz - Drawing maximal cliques
0
0
0
3,488
9,213,883
2012-02-09T15:39:00.000
5
0
1
0
java,python
9,213,915
3
false
0
0
I would use an IllegalArgumentException for this purpose.
1
19
0
If I were writing a Python function which received an argument with the correct type, but a value out of bounds, then I might throw a ValueError or one of its sub-classes. For example, suppose I had a function which added up the prices on an invoice. If one of the prices had a negative value or one of the item-counts w...
In Java what is idiomatically most similar to raising a Python ValueError?
0.321513
0
0
6,218
9,216,792
2012-02-09T18:41:00.000
0
0
0
0
python,user-interface,wxpython,wxwidgets
9,217,489
1
true
0
1
If each toolbar item is to open a new "window", then I would recommend a wx.Frame or wx.Dialog. You almost never need to use wx.Window directly. wx.Window is the parent of wx.Frame and wx.Dialog. As such, wx.Frame and wx.Dialog potentially add additional functionality. Dialogs are modal and should be used when you want...
1
0
0
I am creating a program using wxpython which entails the need to create many sub-windows for each of menubar items. I am currently creating those sub-windows by writing different class definition for each and instantiating those classes for each event. Is this better than to have wx.window? How does two compare and wha...
creating child windows in wxpython
1.2
0
0
938
9,217,687
2012-02-09T19:49:00.000
0
0
0
1
python,pythonbrew
9,245,490
1
true
0
0
Finally I just ditched pythonbrew and did a multi install of python. Thereafter I used bash and profile to switch between my python environments.
1
0
0
I am using pythonbrew to install 2.7.2 on my CentOS. It has worked before but this time on a separate clean system I am running into an issue. After installing pythonbrew (which I had to --force since it complained in make test about distutils) I switched to 2.7.2 When I run easy_install setuptools it tries to go sys...
how to install additional python packages with pythonbrew
1.2
0
0
399
9,220,302
2012-02-09T23:03:00.000
0
0
0
1
python,security,debian,tornado
9,826,573
1
true
0
0
You can create www user just as deploying LAMP environment lock the www user in website directory Supervisor is a good solution of running several tornado process You can use nginx as front-end of your tornado server.
1
1
0
I just set up a simple virtual server with Debian netinst. Now I want to use the tornado webserver to host a public website. I am quite new to Linux so I don't know how to set up a secure server environment. Which users do I need to create? Which config changes do I need to do to get a secure system? How should I run ...
Tornado Web Production Environment
1.2
0
0
867
9,220,493
2012-02-09T23:20:00.000
0
1
0
1
python,eclipse,debugging,pydev
9,226,643
1
false
1
0
I don't think this is possible out of the box... you'd need to architecture your production server so that this would be possible (i.e.: when you send a given request it should spawn a different interpreter just to handle your request for debugging purposes and shutdown that interpreter after the debug session ends), b...
1
0
0
I'm using Eclipse + PyDev to work on python web projects. Sometimes I need to run debug session on production server rather then locally, due to specific environment. I was wondering if there is a way to run isolated remote debugging session, so the other users don't experience any issues, and code execution doesn't su...
Isolated debugging session with PyDev
0
0
0
79
9,220,720
2012-02-09T23:43:00.000
2
0
0
0
python,opencv,python-2.7,simplecv,mahotas
11,412,849
2
false
0
0
I have never used mahotas. But I'm currently working on SimpleCV. I have just sent a pull request for making SimpleCV numpy array compatible with cv2. So, basically, Image.getNumpy() -> numpy.ndarray for cv2 Image.getBitmap() -> cv2.cv.iplimage Image.getMatrix() -> cv2.cv.cvmat To convert cv2 numpy array to SimpleCV...
1
5
1
I am having to do a lot of vision related work in Python lately, and I am facing a lot of difficulties switching between formats. When I read an image using Mahotas, I cannot seem to get it to cv2, though they are both using numpy.ndarray. SimpleCV can take OpenCV images easily, but getting SimpleCV image out for legac...
Image Conversion between cv2, cv, mahotas, and SimpleCV
0.197375
0
0
5,140
9,221,195
2012-02-10T00:44:00.000
1
0
0
0
python,google-app-engine
9,221,655
1
true
1
0
When accessing the site via "example.com", self.request.uri is from that domain, which is the domain where the cookie is created. When it then redirects back, it goes to "www.example.com", which has no cookie, but your site is expecting a user to be logged in. Suggestions: use a relative path like / (or webapp2's uri r...
1
0
0
I just started hosting my app on a new domain. I selected a url forwarding option with my registrar. Which seems to work. example.com didn't work before (as opposed to the subdomain www.example.com) but now it does. The problem is that if I access the site via example.com and try to login, users.create_login_url(self....
get_login_url goes to blank page when coming from naked url
1.2
0
0
84
9,221,888
2012-02-10T02:21:00.000
1
0
0
0
python,sql,database,orm,sqlalchemy
29,831,712
2
false
0
0
The Command pip install sqlalchemy will download the necessary files and run setup.py install for you.
1
1
0
Is there any tutorials about how to set-up sqlalchemy for windows? I went to www.sqlalchemy.org and they don't have clear instructions about set-up for windows. When I opened the zipped package, I see distribute_setup, ez_setup and setup.py among other files but it doesn't see to install sqlalchemy.
Configuring sqlalchemy for windows
0.099668
1
0
9,330
9,222,734
2012-02-10T04:34:00.000
1
0
0
0
python,user-interface,event-handling,wxpython,wxwidgets
9,230,043
1
true
0
1
Sadly there is no builtin way to do this that I'm aware of. You'll need to catch the frame's EVT_SIZE and then use AppendRows and AppendCols as necessary with the grid. You'll need to take into account how much the frame size has changed and only append when it gets bigger, not smaller.
1
1
0
When using wx.grid for creating table with wxpython, how can I automatically extend the number of rows and columns in the table once the user resizes the frame? If I create 5*5 table(grid) to fit on my frame and user resizes the frame( say, makes it bigger), how can I implement automatic increase to the number of rows...
automatic resizing of table in wx
1.2
0
0
522
9,228,771
2012-02-10T13:51:00.000
0
1
0
0
python,c
9,231,111
2
false
0
1
For time critical code, I create a tuple of the desired length and then create the components individually and stuff them into the tuple.
1
0
0
I'm currently using the C/Python API to read data from a large binary file. This result in Python is not as efficient as the pure C result (time x2) because, I think, of the time took to wrap things up into a PyObject. Typically, I store 42-elements tuples in a PyArrayObject. To do this, I use: PyObject *r = Py_BuildVa...
C/Python API : efficiency of Py_BuildValue use
0
0
0
796
9,233,461
2012-02-10T19:14:00.000
7
0
0
0
python,ios,macos,winapi,com
9,234,067
1
true
0
1
COM is Windows only. COM requires extensive use of the Windows registry and WinAPI. I've seen some frameworks emulate or mock COM behavior on other operating systems (e.g. MainWin on Linux/Solaris), but I don't know of one for Mac. The win32py module is just a wrapper around WinAPI calls. So if the WinAPI isn't av...
1
5
0
I've got a quick question that I hope someone can help me with. I'm in the process of creating/planning an app that needs to run cross platform and use a com library from Windows. In the past I've used win32py to run these com objects in a python app, I've been doing a bunch of research finding a solution on Mac but I...
Pywin32 (com objects) on Mac
1.2
0
0
19,626
9,234,029
2012-02-10T19:57:00.000
2
0
0
0
python,file,select,browser,path
18,676,841
1
true
1
0
One approach is to communicate with your server; your client would start with the path "home" (or empty string) and the server would return the physical path ("c:\users\me" or "/home/me"), and the list of subfolders and files in the folder... And then if you give any other path to the server, it will return you info ab...
1
1
0
My question may seem strange, I'd love suggestions if you have a better way to go about what I'm doing: I'm running a local web server with the Bottle web framework for python. I'm using jQuery, HTML, and CSS to write the graphical front end to my "app", and just navigating to the address of the local host in a browser...
Localhost web-app. Get full path to file in browser
1.2
0
0
1,581
9,237,006
2012-02-11T01:28:00.000
1
0
0
0
python,sockets,udp,ip,ttl
37,691,767
3
false
0
0
Python 3.51 has the support for flags such as IP_RECVTTL or IP_RECVTOS. I gave it a try and it worked for me in a 3.x linux kernel.
1
1
0
I'm using the socket module in Python to do some basic UDP client-server communication. What I would need to do is quite simple: client sends server a packet, server answers with client's public ip address, port and a number representing the TTL the UDP packet had when it got to the server. This is my main problem: is ...
Getting TTL of incoming UDP packet in Python
0.066568
0
1
2,675
9,237,481
2012-02-11T03:04:00.000
0
0
0
0
php,python,mysql,localhost,sync
9,237,543
3
true
0
0
How high-performance does your local application need to be? Also, how reliable is the locally available internet connection? If you don't need extremely high performance, why not just leave the data in the remote MySQL server? If you're sure you need access to local data I'd look at MySQL's built-in replication for s...
2
2
0
There have been many questions along these lines but I'm struggling to apply them to my scenario. Any help would be be greatly appreciated! We currently have a functioning mySQL database hosted on a website, data is entered from a website and via PHP it is put into the database. At the same time we want to now create a...
Python sync with mySQL for local application?
1.2
1
0
2,804
9,237,481
2012-02-11T03:04:00.000
0
0
0
0
php,python,mysql,localhost,sync
9,237,521
3
false
0
0
Are you planning to run mysql on your local python offline apps ? I would suggest something like sqlite. As for keeping things in sync, it also depends on the type of data that needs to be synchronized. One question that needs to be answered: Are the data generated by these python apps something that is opague ? If yes...
2
2
0
There have been many questions along these lines but I'm struggling to apply them to my scenario. Any help would be be greatly appreciated! We currently have a functioning mySQL database hosted on a website, data is entered from a website and via PHP it is put into the database. At the same time we want to now create a...
Python sync with mySQL for local application?
0
1
0
2,804
9,237,508
2012-02-11T03:11:00.000
2
1
0
1
python,eclipse,osx-lion,32bit-64bit,pydev
9,282,173
1
true
0
0
The interpreter used in PyDev is computed from sys.executable... Now, a doubt: if you start a shell with /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-32 and do 'print sys.executable', which executable appears? Now, onto a workaround... you can try replacing the places where sys.executable appears in ...
1
3
0
I am running OSX Lion and have installed python2.7 from python.org (this distribution can run in both 64bit and 32bit mode). I have also installed the wxPython package. I can run python scripts that import wxPython from the Terminal by explicitly using the 32-bit version. I would like to run the same scripts in Eclipse...
How to configure PyDev to use 32-bit Python Interpreter In Eclipse, on OSX Lion
1.2
0
0
1,922
9,239,575
2012-02-11T10:45:00.000
1
0
0
1
python,google-app-engine,full-text-search,google-cloud-datastore
9,243,456
3
false
1
0
The best solution is to wait until app engine's full text search is released. They are currently in trusted tester phase, so it's coming soon. If you roll your own solution now, you may end up redoing it in a few months.
1
4
0
I have made a google app using next db module (ndb) to create my models. Now the problem is i want to deploy search over the fields of these models, and i have found two modules to do that: 1. The officially shipped with google app engine (appengine/google/ext/search) and 2. gae text search (http://code.google.com/p/ga...
Full text search with google app engine using ndb models
0.066568
0
0
2,635
9,240,115
2012-02-11T12:12:00.000
1
1
0
0
python,biopython
10,908,585
2
false
0
0
We need backbone atoms only N,CA,C. so for the protein chain we get N,CA,C,N,CA,C,N,CA,C,N,CA,C. we need to define them in plane, to find out the angle we need two planes (plane1: C,N,CA)(plane2: N,CA,C). we neglect the N,CA for first residue. Consider the bolded atoms only. so you submit the bolded atoms (3 atoms of o...
1
0
0
I want to calculate all the three dihedral angles in a residue. calc_dihedral(atom1, atom2, atom3, atom4) of Biopython requires vector coordinates of four atoms as arguments and returns an output of a single value. I'm not sure which of the three angles output represents. Please suggest which atoms in the residue are r...
Which atoms are required by Biopython's calc_dihedral() to calculate all 3 dihedral angles?
0.099668
0
0
1,649