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
7,112,063
2011-08-18T18:12:00.000
1
1
0
0
c++,python,usb,sensors,hardware-interface
16,451,772
2
false
0
1
The FTDI chips have a linux driver. Just go to the FTDI website and download it. The driver creates a virtual serial port. You can use PySerial to interface with it. Too bad I didn't see the post sooner!
1
2
0
I am working with a pressure-sensing mattress having a USB interface. The maker provides USB device drivers for Windows, and an API written in C++ which has functions to request data and set some parameters. Currently, I cannot use this sensor for testing some Python data-visualization scripts directly, having had to a...
Access USB hardware (pressure sensor matrix with native C++ API) using Python
0.099668
0
0
1,493
7,112,315
2011-08-18T18:31:00.000
2
0
0
0
python,html,css,django
7,112,366
3
false
1
0
Sounds like a temp file created by your editor to support restoring if you crash/forget to save/etc. I'm sure if I googled a bit I'd even be able to figure out which editor(s) use that format for their temp files. Has nothing to do with django.
2
0
0
I'm running a django framework and notice that when I'm editing a file I will get another file in the form "filename.extension~". What exactly is that "~" doing there and why am I generating another file? If it's a temp file, when does it go away?
Why are some of my files being replicated?
0.132549
0
0
52
7,112,315
2011-08-18T18:31:00.000
1
0
0
0
python,html,css,django
7,112,355
3
false
1
0
I'm not familiar with django, but I'm sure it's a temporary/backup file.
2
0
0
I'm running a django framework and notice that when I'm editing a file I will get another file in the form "filename.extension~". What exactly is that "~" doing there and why am I generating another file? If it's a temp file, when does it go away?
Why are some of my files being replicated?
0.066568
0
0
52
7,112,347
2011-08-18T18:33:00.000
2
0
0
0
python,memcached,voting
7,112,410
6
true
0
0
Can you accept some degree of vote loss? If so, you can do a hybrid solution. Every modulo 100 (10, something), update the SQL database with the current memcache value. You can also have a periodic script scan and update if required.
4
3
0
I'm implementing a voting system for a relatively large website and I'm wondering where should I store the vote count. The main problem is that storing them in the main database would put a lot of strain on it, as MySQL isn't very good at handing lots and lots of simple queries. My best option so far is to use memcach...
Best way of storing incremental numbers?
1.2
1
0
145
7,112,347
2011-08-18T18:33:00.000
0
0
0
0
python,memcached,voting
7,112,511
6
false
0
0
Mongodb can work well.Since it can be faster or Google App Engine was designed to scale.
4
3
0
I'm implementing a voting system for a relatively large website and I'm wondering where should I store the vote count. The main problem is that storing them in the main database would put a lot of strain on it, as MySQL isn't very good at handing lots and lots of simple queries. My best option so far is to use memcach...
Best way of storing incremental numbers?
0
1
0
145
7,112,347
2011-08-18T18:33:00.000
2
0
0
0
python,memcached,voting
7,112,669
6
false
0
0
MySQL isn't very good at handing lots and lots of simple queries You may have something drastically misconfigured in your MySQL server. MySQL should easily be able to handle 4000 queries per minute. There are benchmarks of MySQL handling over 25k INSERTs per second.
4
3
0
I'm implementing a voting system for a relatively large website and I'm wondering where should I store the vote count. The main problem is that storing them in the main database would put a lot of strain on it, as MySQL isn't very good at handing lots and lots of simple queries. My best option so far is to use memcach...
Best way of storing incremental numbers?
0.066568
1
0
145
7,112,347
2011-08-18T18:33:00.000
0
0
0
0
python,memcached,voting
7,116,659
6
false
0
0
If you like memcached but don't like the fact that it doesn't persist data then you should consider using Membase. Membase is basically memcached with sqlite as the persistence layer. It is very easy to set up and supports the memcached protocol so if you already have memcached set up you can use Membase as a drop in r...
4
3
0
I'm implementing a voting system for a relatively large website and I'm wondering where should I store the vote count. The main problem is that storing them in the main database would put a lot of strain on it, as MySQL isn't very good at handing lots and lots of simple queries. My best option so far is to use memcach...
Best way of storing incremental numbers?
0
1
0
145
7,113,605
2011-08-18T20:17:00.000
0
0
0
0
python,wxpython,wxwidgets,panel,sizer
7,122,837
2
false
0
1
As I understand it, this is a calendar with rectangles for the days containing the events for the days. The simple thing would be to use a wxGrid, with seven columns and four or five rows, to represent the months. You would then place the events into the grid cell for the correct date. The wxGrid widget would look af...
2
2
0
This is about wxPython. I would like to have 2 Panels laying one over the other: PanelBG should be some sort of a "background", with its own GridBagSizer with subPanels, StaticTexts and so on; PanelFG should be the "foreground" panel, also with its own GridBagSizer with some StaticTexts, Buttons... but a transparent ba...
wxPython: how to lay one panel over another
0
0
0
1,387
7,113,605
2011-08-18T20:17:00.000
1
0
0
0
python,wxpython,wxwidgets,panel,sizer
7,123,083
2
true
0
1
This would be at least partially a change of direction, but it might be worth examining what other rendering options you have. In particular, I'm thinking of wxWebKit (http://wxwebkit.kosoftworks.com/), which would let you do layering, etc. using the WebKit browser rendering engine. I'm not sure whether it's at a stag...
2
2
0
This is about wxPython. I would like to have 2 Panels laying one over the other: PanelBG should be some sort of a "background", with its own GridBagSizer with subPanels, StaticTexts and so on; PanelFG should be the "foreground" panel, also with its own GridBagSizer with some StaticTexts, Buttons... but a transparent ba...
wxPython: how to lay one panel over another
1.2
0
0
1,387
7,114,946
2011-08-18T22:32:00.000
0
0
1
0
python,image,generator,python-imaging-library
7,115,394
1
false
0
0
If you want sub-pixel positioning, one possible-if-inefficient solution would be to scale everything up by a factor of, say, 10, rounding (original_floating_point_coordinates * 10) to integers, then resize the whole image back down at the end. Doesn't help with angles, I suppose.
1
1
0
Is there a way to set PIL and by extension Imagedraw to allow float values for such commands as Arc and Ellipse? I am running into major problems and cannot do what I need to do because of the seeming requirement that angles and bounding box position specifiers must be integers, and I cannot use a different package, no...
Using Float values in Imagedraw
0
0
0
197
7,116,553
2011-08-19T03:12:00.000
0
1
0
1
python,ssh,twisted
8,927,201
3
false
0
0
A cheap and posibly very dangerous hack is to put your app as the default shell for a particular user. you need to be very careful though (suggestion chroot it to hell and back) as it might be possible to break out of the app and into the server.
1
5
0
I'm in the process of writing an application with an Urwid front-end and a MongoDB back-end in python. The ultimate goal is to be able to be able to serve the application over SSH. The application has its own authentication/identity system. I'm not concerned about the overhead of launching a new process for each user, ...
Howto Serve Python CLI Application Over SSH
0
0
0
643
7,117,318
2011-08-19T05:30:00.000
1
0
1
0
python,windows-server-2008-r2,python-2.6,easy-install
7,117,448
2
false
0
0
Is this not what you would expect? On every computer I've ever used, admin privileges are required to make any type of modifications that will affect all users.
1
1
0
Python is installed in a directory all users have full access to, but when I run easy_install, a consent window appears asking for administrator credentials. Why?
easy_install requires admin rights on Windows
0.099668
0
0
1,347
7,117,525
2011-08-19T05:59:00.000
2
0
1
0
python,mysql,pickle
7,117,674
3
true
0
0
It's really that easy... so long as you don't need your DB to know anything about the dictionary. If you need any sort of structured data access to the contents of the dictionary, then you're going to have to get more involved. Another gotcha might be what you intend to put in the dict. Python's pickle serialization ...
1
7
0
I looked through several SO-Questions for how to pickle a python object and store it into a database. The information I collected is: import pickle or import cpickle. Import the latter, if performance is an issue. Assume dict is a python dictionary (or what so ever python object): pickled = pickle.dumps(dict). store p...
How to Pickle a python dictionary into MySQL?
1.2
1
0
5,063
7,119,196
2011-08-19T08:55:00.000
1
0
1
0
python,cpython
7,119,293
3
false
0
0
I have never come across a function that could do that no. But you could keep an internal index of every object you create and store it as well as it's memory address. Then do a lookup in the table.
1
3
0
In CPython, the builtin-function id(x) returns the memory address of x. Is it possible to reverse this ? Something like object_by_memoryadress(id(x)) == x. Update: The reason I need this is, because I'm using a program with embedded Python. And in this program I can create so called "Nodes" that can communicate with ea...
Is it possible to access an object via memory address?
0.066568
0
0
867
7,119,630
2011-08-19T09:31:00.000
2
0
0
1
python,filesystems,filepath
7,119,780
3
false
0
0
As df itself opens and parses /etc/mtab, you could either go this way and parse this file as well (an alternative would be /proc/mounts), or you indeed parse the df output.
2
3
0
In python, given a directory or file path like /usr/local, I need to get the file system where its available. In some systems it could be / (root) itself and in some others it could be /usr. I tried os.statvfs it doesnt help. Do I have to run the df command with the path name and extract the file system from the outp...
In Python, how can I get the file system of a given file path
0.132549
0
0
5,990
7,119,630
2011-08-19T09:31:00.000
4
0
0
1
python,filesystems,filepath
7,119,758
3
false
0
0
Use os.stat to obtain device number of the file/directory in question (st_dev field), and then iterate through system mounts (/etc/mtab or /proc/mounts), comparing st_dev of each mount point with this number.
2
3
0
In python, given a directory or file path like /usr/local, I need to get the file system where its available. In some systems it could be / (root) itself and in some others it could be /usr. I tried os.statvfs it doesnt help. Do I have to run the df command with the path name and extract the file system from the outp...
In Python, how can I get the file system of a given file path
0.26052
0
0
5,990
7,120,342
2011-08-19T10:34:00.000
0
0
1
0
python,decorator
7,120,926
4
false
0
0
Python decorators are just plain functions or other callables which take as single argument the function or class to be decorated. As such you can use many ordinary functions as decorators and vice versa. Possible use as decorator is often not explicitly documented.
1
20
0
Apart from @staticmethod and @classmethod? Most languages have some basic libraries making use of most of the language features. It seems that many of the decorators I find myself making are things which tons of people would use, but I haven't found any inbuilt python decorators which do them. Are there such things?
Does Python have decorators in the standard library?
0
0
0
8,167
7,120,806
2011-08-19T11:20:00.000
1
0
0
0
python,linux,web-applications,skype
7,120,949
2
false
1
0
SkypeKit has a Python API, too and does not require the Skype client running. However, you do need a helper application - but on the skype developer website you can compile it for various architectures and operating systems. If you don't have access yet it might take some time though to get it. I signed up for it when ...
1
3
0
Is there a skype web API or a python API that can be integrated into the Django APP. Server : Python 2.4, linux RHEL5
Skype python API
0.099668
0
0
8,235
7,123,387
2011-08-19T14:51:00.000
4
0
0
0
python,scrapy,web-crawler,pipeline
7,135,102
3
false
1
0
It's a perfect tool for the job. The way Scrapy works is that you have spiders that transform web pages into structured data(items). Pipelines are postprocessors, but they use same asynchronous infrastructure as spiders so it's perfect for fetching media files. In your case, you'd first extract location of PDFs in spid...
1
17
0
I need to save a file (.pdf) but I'm unsure how to do it. I need to save .pdfs and store them in such a way that they are organized in a directories much like they are stored on the site I'm scraping them off. From what I can gather I need to make a pipeline, but from what I understand pipelines save "Items" and "item...
Should I create pipeline to save files with scrapy?
0.26052
0
0
16,042
7,128,761
2011-08-20T00:39:00.000
2
0
0
1
python,macos,opencv,homebrew
7,129,002
4
false
0
0
You need to install the module using your python2.7 installation. Pointing your PYTHONPATH at stuff installed under 2.6 to run under 2.7 is a Bad Idea. Depending on how you want to install it, do something like python2.7 setup.py or easy_install-2.7 opencv to install. fwiw, on OS X the modules are usually installed un...
1
4
1
I spent the past couple of days trying to get opencv to work with my Python 2.7 install. I kept getting an error saying that opencv module was not found whenever I try "import cv". I then decided to try installing opencv using Macports, but that didn't work. Next, I tried Homebrew, but that didn't work either. Eventual...
How to properly install Python on OSX for use with OpenCV?
0.099668
0
0
7,935
7,128,868
2011-08-20T01:05:00.000
2
0
0
0
python,django
7,129,066
4
true
1
0
Sure it's possible. But if you are writing a web application you probably won't want to do that because of threading issues.
1
3
0
I'm just wondering if Django was designed to be a fully stateless framework? It seems to encourage statelessness and external storage mechanisms (databases and caches) but I'm wondering if it is possible to store some things in the server's memory while my app is in develpoment and runs via manage.py runserver.
Django statelessness?
1.2
0
0
4,009
7,129,285
2011-08-20T02:44:00.000
5
0
1
0
python,return,output
58,644,500
13
false
0
0
I think a really simple answer might be useful here: return makes the value (a variable, often) available for use by the caller (for example, to be stored by a function that the function using return is within). Without return, your value or variable wouldn't be available for the caller to store/re-use. print prints...
1
94
0
What is the simple basic explanation of what the return statement is, how to use it in Python? And what is the difference between it and the print statement?
What is the purpose of the return statement? How is it different from printing?
0.076772
0
0
683,021
7,130,303
2011-08-20T07:00:00.000
0
1
0
0
python,tornado
7,131,286
3
false
0
0
You might consider using Pinax. When I used it, it had the self-concept of 'django with an opinion.' I'm not sure where it's at now, but my experience was that it was best suited for exactly what you want to do. One of the base projects is actually a fully functional social network site. You could then customize fr...
2
0
0
I wanna build a simple social network use python. Just like twitter but smaller than twitter.I just wanna make a few features like follow,BE followed,view others profile,etc. My question is that i should use web.py or Tornado? BTW, is there any tutorial about Tornado? I feel it hard to understand when i read the docume...
Choose web.py or Tornado
0
0
0
2,321
7,130,303
2011-08-20T07:00:00.000
3
1
0
0
python,tornado
7,130,351
3
true
0
0
these two are different things. Tornado is web server while web.py is a framework. therefore you can use both of them.
2
0
0
I wanna build a simple social network use python. Just like twitter but smaller than twitter.I just wanna make a few features like follow,BE followed,view others profile,etc. My question is that i should use web.py or Tornado? BTW, is there any tutorial about Tornado? I feel it hard to understand when i read the docume...
Choose web.py or Tornado
1.2
0
0
2,321
7,130,489
2011-08-20T07:42:00.000
-3
0
1
0
python,windows
7,130,637
4
false
0
0
I'm not aware of any Python facility for doing that, that's really the OS's job. Debian/Ubuntu, for example, has support for installing multiple versions of Python and installing libraries into each version. I doubt there's any such support in Windows.
1
6
0
There are many versions of Python, and it becomes difficult to manage them all. Often I need to install one module into 3 different versions of Python. Is there a tool which can simplify things? I'm on Windows. Thanks.
Managing Python installations
-0.148885
0
0
2,573
7,131,834
2011-08-20T12:48:00.000
1
0
0
1
java,python,api,google-app-engine
7,142,758
2
false
1
0
No, but you can get a very close estimate of this by adding up the length of the request headers and body for incoming requests, and the response body and headers for responses.
1
0
0
I want to know if Google App Engine support using google.appengine.api.quota package to get bandwidth usage, not cpu usage? If so, how to get with Python or Java and print in webpage?
How to get bandwidth quota usage with Google app engine api?
0.099668
0
0
475
7,133,248
2011-08-20T16:56:00.000
0
0
1
0
python-3.x
41,916,044
2
false
0
0
To build the exe your code have to be first compiled and then linked. In the Linking step you must say where any external module, library or objectcode is so the linker can correctly integrate them in the executable.
2
1
0
I converted one .py file to .exe using cx_freeze. I am using python 3.2 and my OS is windows 7 the .py file executes properly in python interpreter and in command line..but.. when i create its exe file and execute it...it gives me following error Traceback (most recent call last): File "C:\Python32\lib\site-packag...
Import Error: no module named re
0
0
0
3,619
7,133,248
2011-08-20T16:56:00.000
0
0
1
0
python-3.x
7,153,614
2
false
0
0
You likely didn't tell cx_freeze to include the re module, which is what is causing the error. If you give us an idea of what your setup script looks like, we can tell you where to tell cx_freeze to include the re module.
2
1
0
I converted one .py file to .exe using cx_freeze. I am using python 3.2 and my OS is windows 7 the .py file executes properly in python interpreter and in command line..but.. when i create its exe file and execute it...it gives me following error Traceback (most recent call last): File "C:\Python32\lib\site-packag...
Import Error: no module named re
0
0
0
3,619
7,133,977
2011-08-20T18:59:00.000
12
0
1
0
python,datetime,python-3.x
7,134,020
2
true
0
0
I think that for your situation you'd be better off using a datetime.timedelta object. It has a function that will do exactly what you want, datetime.timedelta.total_seconds().
1
3
0
I have a datetime object. I want to print it as just number of seconds (i.e., 1 min 30.5 sec should print as 90.5 s). Can't seem to find a way to do it with strftime.
datetime: print as seconds
1.2
0
0
1,083
7,135,542
2011-08-21T00:16:00.000
5
0
1
0
python,jython,jvm-languages
7,135,680
1
true
0
0
With regular Python, .pyc files are generated when you import a module but not when it's the __main__ module. It is the same with Jython -- .class files are generated when you import a Jython module. You can use jythonc to manually compile a module.
1
5
0
I just started playing with Jython, and sometimes running jython on a .py file generates a .class file, but this doesn't always happen. At first I thought the trigger was that you had to define a Python class inside the .py file, but evidently a .class file is not always generated even then. What is the mechanism that ...
When does running Jython on a .py file generate a .class file?
1.2
0
0
1,124
7,137,214
2011-08-21T08:27:00.000
1
0
0
0
mysql,django,deployment,ubuntu,mysql-python
7,352,188
2
true
1
0
For those who come upon this question: It turns out that ubuntu _mysql version was different from the one in my venv. Uninstalling that and re-installing in my venv did the trick.
1
6
0
I'm trying to get a django site deployed from a repository. I was almost there, and then changed something (I'm not sure what!!) and was back to square one. Now I'm trying to run ./manage.py syncdb and get the following error: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: this is MySQLdb v...
Django MySQLdb version doesn't match _mysql version Ubuntu
1.2
1
0
4,064
7,137,275
2011-08-21T08:44:00.000
0
0
0
1
python,numpy,cython
7,153,215
1
true
0
0
well, it goes like this: when running python interpreter and imports the numpy library it tries to load from libpython.so the symbol Python is compiled with (i guess so). this is why it works with the interpreter. so the request for that unicode function doesn't come from numpy - but from Python - so it uses the UCS2 f...
1
2
0
i work on ubuntu 10.04 and used cython to compile my python code. i then tried to copy 2 of my binaries (one with numpy, and one without) to another distribution with supported kernel and etc... the only thing i did which is not so cool is that i used the python that comes with that distribution (2.6), and copy from my...
undefined _PyUnicodeUCS4_IsWhitespace in compiled cython+numpy
1.2
0
0
2,054
7,138,229
2011-08-21T12:23:00.000
4
0
1
1
python,virtualenv
9,660,148
2
false
0
0
Virtualenv lets you specify a python binary to use instead of the default. On your machine, python probably maps to /usr/bin/python, which will be a symlink to /usr/bin/python2.6. If you've got Python 2.5 installed, it will be /usr/bin/python2.5 You can create a virtualenv called envname with virtualenv -p /usr/bin/pyt...
1
2
0
I am trying to get started with Google App Engine. I have python 2.6 installed in my virtual environment which I wanted to use. But Google App Engine supports python2.5. So I want to set up another python virtual environment with python 2.5. Can you help me how to do exactly that?
Set up a python virtualenv with a specific version of Python
0.379949
0
0
2,418
7,139,023
2011-08-21T14:57:00.000
1
0
0
0
python,apache2,mod-wsgi,mod-python
12,194,811
1
false
1
0
You can use django middleware to intercept HTTP request/response traffic before it reaches your application (which might be in this case your graphical interface to fine tune your filter and/or database handling for storing your configurations or preset rules). My initial imagination for your application, is that you w...
1
3
0
I'd like to write a simple web content filter with flexible filtering rules that are written in Python. The filter is to be used as a forward proxy. Now, I have trouble choosing the right tools for this. What do you think would be a good set of tools? So far, I've been considering Apache HTTP server with mod_proxy and ...
Web content filter with Apache + mod_wsgi?
0.197375
0
0
491
7,139,361
2011-08-21T15:58:00.000
1
0
1
0
python,string,formatting
7,141,481
3
false
0
0
It sounds like you're putting input data in your source code. Don't do that; use a file or sys.stdin instead.
1
1
0
Whenever I feed a string like "Muhammed went to the store and said "Can I have some pickles please"" It seems to screw up how the string is handled since a Can I have some pickles please becomes invalid. So I thought adding """ at both sides of it would surely fix it, if there are any better solutions to this, I'm open...
Adding """ at the beginning and end of a string?
0.066568
0
0
135
7,142,284
2011-08-22T01:11:00.000
2
0
0
0
python,django,apache,wsgi,django-wsgi
7,147,377
1
true
1
0
You are possibly just getting confused and are actually using as poor Apache/mod_wsgi configuration. Specifically, you are likely using embedded mode with Apache prefork MPM. That is bad because Apache will use lots of single thread processes and so the code has to be loaded in all of them. That is why you probably thi...
1
2
0
My django application is running on apache+wsgi. One of the module in my django app needs to load a Java library via jpype and this Java library takes long time to initialize due to its application nature. The problem is that, for each http request handled by django in apache+wsgi setup, this Java library is re-loaded...
initializing module on django+mod_wsgi+apache
1.2
0
0
775
7,143,746
2011-08-22T06:13:00.000
10
0
1
0
python,memcached
7,143,766
3
true
0
0
The usual reason to use memcached is that you would like to distribute the cache among multiple machines, with the goal of both having data available on all the machines, while also utilizing the storage of all the machines. If those requirements don't apply to you, and you only need the cached data on a single machine...
2
7
0
In my current project, I am using Memcache to store key-value pairs, but since the communication happens over the socket between my process and the Memcache causing the huge latencies. We went with memcache because we had a requirement of storing large amount of key-value pairs. But now I want to store the dictionary a...
Difference between memcache and python dictionary
1.2
0
0
2,076
7,143,746
2011-08-22T06:13:00.000
1
0
1
0
python,memcached
7,143,827
3
false
0
0
If you data is not so big, you may just dump your python dictionary to files with cPickle.dump or marshal.dump and, reload it from file with cPickle.load or marshal.load, and if you need to worry about diskspace, you may use bz2 or gzip compress / decompress during file read / rewrite.
2
7
0
In my current project, I am using Memcache to store key-value pairs, but since the communication happens over the socket between my process and the Memcache causing the huge latencies. We went with memcache because we had a requirement of storing large amount of key-value pairs. But now I want to store the dictionary a...
Difference between memcache and python dictionary
0.066568
0
0
2,076
7,144,011
2011-08-22T06:52:00.000
1
0
0
0
python,apache,webserver,mod-wsgi
7,145,199
1
true
1
0
You cant. It is a limitation of the API defined by the WSGI specification. So, nothing to do with Apache or mod_wsgi really as you will have the same issue with any WSGI server if you follow the WSGI specification. If you search through the mod_wsgi mailing list on Google Groups you will find a number of discussions ab...
1
0
0
i'm trying to build a web server using apache as the http server, mod_wsgi + python as the logic handler, the server was supposed to handler long request without returning, meaning i want to keep writing stuff into this request. the problem is, when the link is broken, the socket is in a CLOSE_WAIT status, apache will ...
apache server with mod_wsgi + python as backend, how can i be able to notified my connection status?
1.2
1
0
393
7,144,756
2011-08-22T08:24:00.000
6
0
0
1
python,ubuntu,wxpython,wxwidgets,ubuntu-unity
8,073,276
3
false
0
1
With Ubuntu Unity desktop environment (i.e. Ubuntu 11.04 or 11.10), you need to "whitelist" your application. There are different ways to do this using the 'gsettings' application from the command line. I had to do this to get programs like Skype showing in the system tray again, not just for my own custom apps that us...
1
3
0
There is no tray in Unity under Ubuntu 11.04. How can I make icon appear somewhere in Unity? wx.TaskBarIcon is not appear anywhere. Thanks
wx.TaskBarIcon on Ubuntu 11.04
1
0
0
1,293
7,148,014
2011-08-22T13:13:00.000
0
0
1
0
c++,python,ubuntu
7,148,433
3
false
0
0
Which compiler was used to build python on your machine ? This is a crucial point for Python extensions. If you use a different compiler anything bad can happen.
3
0
0
I have written a python interface to c++ code.I have two different computers running ubuntu 11.04 with the same packages (python 2.7.1, numpy 1.5.1, gcc 4.5.2). Let's call them A and B. The code compiles and links without errors on both computers. However, on A, the code seems to enter an infinite loop somewhere in th...
compiled python library works on one computer but not on another
0
0
0
492
7,148,014
2011-08-22T13:13:00.000
0
0
1
0
c++,python,ubuntu
7,148,623
3
false
0
0
Even if you are not multithreading (as in defining multiple threads) there may be a SMP problem: if a memory location is volatile, context switches and CPU scheduling may cause the program to 'not' see the actual changes. Did you try to compile without any optimizations (-O0 on gcc). Are there any variables that could...
3
0
0
I have written a python interface to c++ code.I have two different computers running ubuntu 11.04 with the same packages (python 2.7.1, numpy 1.5.1, gcc 4.5.2). Let's call them A and B. The code compiles and links without errors on both computers. However, on A, the code seems to enter an infinite loop somewhere in th...
compiled python library works on one computer but not on another
0
0
0
492
7,148,014
2011-08-22T13:13:00.000
0
0
1
0
c++,python,ubuntu
7,148,642
3
false
0
0
Different computers might have different processors/architecture. Ideally, you would compile Python on the other computer as well. Do this and you'll know if the problem was copying the libraries over, or if it's something on your code, or if it's an environment configuration thing.
3
0
0
I have written a python interface to c++ code.I have two different computers running ubuntu 11.04 with the same packages (python 2.7.1, numpy 1.5.1, gcc 4.5.2). Let's call them A and B. The code compiles and links without errors on both computers. However, on A, the code seems to enter an infinite loop somewhere in th...
compiled python library works on one computer but not on another
0
0
0
492
7,148,419
2011-08-22T13:44:00.000
67
0
1
0
python,subclass
7,148,602
5
true
0
0
If you want a custom collection that actually holds the data, subclass dict. This is especially useful if you want to extend the interface (e.g., add methods). None of the built-in methods will call your custom __getitem__ / __setitem__, though. If you need total control over these, create a custom class that impleme...
1
52
0
What's the difference between UserDict, dict and ABC and which one is recommended? The docs seem to deprecate UserDict? Also it seems UserDict's update() would use my setitem method whereas dict doesn't? Which methods are really essential to override given I want custom setitem and getitem function? With ABCs I'd have ...
Subclass dict: UserDict, dict or ABC?
1.2
0
0
15,578
7,149,287
2011-08-22T14:50:00.000
0
0
1
0
python,multiprocessing
7,161,916
1
false
0
0
I use a SQL table to perform such a thing, because my users may launch dozens of tasks alltogether if I do not limit them. When a new file shows up, a daemon writes its name in the table (with allsort of other information such as size, date, time, user, ...) Another daemon is then reading the table, getting the first ...
1
2
0
My question might be quite vague. I am looking for some reasonable approach to perform my task. I have developed a webpage where the user uploads a file used as an input file for my code developed in python. When the input file is submitted through the webpage, it is saved in a temporary folder from where the daemon c...
multiprocessing in python
0
0
0
1,157
7,151,354
2011-08-22T17:45:00.000
0
0
1
0
python,interpolation,angle,curve
7,154,349
1
false
0
0
numpy.interp does not require your points to be evenly distributed. I'm not certain if you mean by "The inputs are time, the curve and the angle" that you have three independent variables, if so you will have to adapt it quite a bit... But for one-variable problems, interp is the way to go.
1
0
0
I am trying to make a python script that will output a force based on a measured angle. The inputs are time, the curve and the angle, but I am having trouble using interpolation to fit the force to the curve. I looked at scipy.interpolate, but I'm not sure it will help me because the points aren't evenly spaced.
How to use interpolation to calculate a force based on angle
0
0
0
187
7,152,172
2011-08-22T18:56:00.000
0
0
0
1
python,windows,popen
7,153,372
3
false
0
0
if 'script A' get generated by another process, you will either need to change the other process so the output file is in a format that you can source (import) into your python script. or write a parser in python that can digest the vars out of 'Script A' setting them within your python script.
1
0
0
I have a series of scripts I am automating the calling of in python with subprocess.Popen. Basically, I call script A, then script B, then script C and so forth. Script A sets a bunch of local shell variables, with commands such as set SOME_VARIABLE=SCRIPT_A, set PATH=%SCRIPT_A:/=\;%PATH%. Script B and C then need to ...
Running scripts whose purpose is to change shell variables with subprocess.popen
0
0
0
176
7,152,441
2011-08-22T19:20:00.000
7
0
1
0
python,comparison,boolean,readability
7,152,501
5
false
0
0
My answer is simple, as it applies to most coding problems: Don't try to write something that just works. Try to express your intent as clearly as possible. If you want to check if a value is false, use if not value. If you want to check for None, write it down. It always depends on the situation and your judgement. Yo...
3
65
0
I've always coded in the style of if not value, however, a few guides have brought to my attention that while this style works, it seems to have 2 potential problems: It's not completely readable; if value is None is surely more understandable. This can have implications later (and cause subtle bugs), since things lik...
Python: if not val, vs if val is None
1
0
0
40,121
7,152,441
2011-08-22T19:20:00.000
34
0
1
0
python,comparison,boolean,readability
7,152,491
5
false
0
0
No. If you want to run code when the value is false but isn't None, this would fail horribly. Use is None if you're checking for identity with the None object. Use not value if you just want the value to be False.
3
65
0
I've always coded in the style of if not value, however, a few guides have brought to my attention that while this style works, it seems to have 2 potential problems: It's not completely readable; if value is None is surely more understandable. This can have implications later (and cause subtle bugs), since things lik...
Python: if not val, vs if val is None
1
0
0
40,121
7,152,441
2011-08-22T19:20:00.000
5
0
1
0
python,comparison,boolean,readability
7,153,236
5
false
0
0
Your use of the is operator is a little problematic. if value is [] will always be false, for example, because no two active lists have the same identity. It works great with None because None is a singleton (all references to None are the same object) but for other comparisons, use ==. However, if value and if not val...
3
65
0
I've always coded in the style of if not value, however, a few guides have brought to my attention that while this style works, it seems to have 2 potential problems: It's not completely readable; if value is None is surely more understandable. This can have implications later (and cause subtle bugs), since things lik...
Python: if not val, vs if val is None
0.197375
0
0
40,121
7,155,729
2011-08-23T02:35:00.000
1
0
1
0
python,windows,mercurial,tortoisehg
7,607,868
1
true
0
0
I'm extending Mercurial and want to test if it works with TortoiseHg correctly It is good to test compatibility with both official Mercurial binaries and TortoiseHg. They are organized the same way. Namely, all Python binaries are stored in library.zip So to make your extension working with either of these bundles, yo...
1
2
0
I have installed Mercurial as a Python package. Now I want TortoiseHg to work with them. However, all versions of TortoiseHg are bundled with its own version of hg and Python libraries. How do I make sure that TortoiseHg is using Mercurial which I have installed?
Make TortoiseHg use a separate Mercurial package
1.2
0
0
249
7,155,866
2011-08-23T03:02:00.000
15
0
1
1
python,windows,usb,32bit-64bit,pyinstaller
10,328,518
3
false
0
0
Pyinstaller produces a binary depending from the python you used to build it. So if you use python 2.7 64 bit it is not possible, as far as I know, to produce a 32 bit executable. This is because Pyinstaller archives all modules and their dependencies (dlls, pyds etc..) which are 64 bit due to the python install. As al...
2
37
0
Short Question Is there any way to control / guarantee the architecture (32bit vs 64bit) when building a pyinstaller executable? Background I migrated from py2exe to pyinstaller because of the lack of 64bit support along with a host of small things that I am having a hard time looking past. So on that note, I would ...
Can I control the architecture (32bit vs 64bit) when building a pyinstaller executable?
1
0
0
42,223
7,155,866
2011-08-23T03:02:00.000
9
0
1
1
python,windows,usb,32bit-64bit,pyinstaller
8,941,506
3
false
0
0
If you are building an application and it runs fine on 32-bit Windows, there is no need to create a 64-bit version. Just create a 32-bit version and run it on both architectures. What is what WOW64 is for. If you need to use a library or feature which is 64-bit only, just build a 64-bit version. There is no point in bu...
2
37
0
Short Question Is there any way to control / guarantee the architecture (32bit vs 64bit) when building a pyinstaller executable? Background I migrated from py2exe to pyinstaller because of the lack of 64bit support along with a host of small things that I am having a hard time looking past. So on that note, I would ...
Can I control the architecture (32bit vs 64bit) when building a pyinstaller executable?
1
0
0
42,223
7,156,837
2011-08-23T05:56:00.000
0
1
0
0
python,ruby,sockets,tcp,udp
7,157,569
2
false
0
0
What a language you know better, that'll fit your needs.
2
1
0
I have a concept I'd like to work on that requires the use of low-level sockets (i.e.: no frameworks or wrappers, just the standard send/recv pattern included in most standard libraries. I'm familiar with both Ruby and Python, and from my (limited) experience they seem to have similar socket libraries. What I'd like t...
Ruby Vs Python - Socket Libraries
0
0
0
903
7,156,837
2011-08-23T05:56:00.000
0
1
0
0
python,ruby,sockets,tcp,udp
7,158,166
2
false
0
0
Both language offer a very thin wrapper above the underlying OS socket library. You won't get much difference.
2
1
0
I have a concept I'd like to work on that requires the use of low-level sockets (i.e.: no frameworks or wrappers, just the standard send/recv pattern included in most standard libraries. I'm familiar with both Ruby and Python, and from my (limited) experience they seem to have similar socket libraries. What I'd like t...
Ruby Vs Python - Socket Libraries
0
0
0
903
7,157,973
2011-08-23T08:07:00.000
6
0
0
1
python,progress,rsync
22,004,775
4
false
0
0
Note the caveat here that even --info=progress2 is not entirely reliable since this is percentage based on the number of files rsync knows about at the time when the progress is being displayed. This is not necessarily the total number of files that needed to be sync'd (for instance, if it discovers a large number of l...
2
19
0
I'm trying to write a Python script which will monitor an rsync transfer, and provide a (rough) estimate of percentage progress. For my first attempt, I looked at an rsync --progress command and saw that it prints messages such as: 1614 100% 1.54MB/s 0:00:00 (xfer#5, to-check=4/10) I wrote a parser for such messa...
Monitoring Rsync Progress
1
0
0
14,767
7,157,973
2011-08-23T08:07:00.000
9
0
0
1
python,progress,rsync
7,782,009
4
false
0
0
You can disable the incremental recursion with the argument --no-inc-recursive. rsync will do a pre-scan of the entire directory structure, so it knows the total number of files it has to check. This is actually the old way it recursed. Incremental recursion, the current default, was added for speed.
2
19
0
I'm trying to write a Python script which will monitor an rsync transfer, and provide a (rough) estimate of percentage progress. For my first attempt, I looked at an rsync --progress command and saw that it prints messages such as: 1614 100% 1.54MB/s 0:00:00 (xfer#5, to-check=4/10) I wrote a parser for such messa...
Monitoring Rsync Progress
1
0
0
14,767
7,158,635
2011-08-23T09:10:00.000
0
0
0
0
javascript,python,html,javascript-engine
7,158,707
4
false
1
0
This would be very hard to accomplish without the use of external libraries. You'd need a HTML parser to start with, so you can actually make sense of the HTML. Then you'd need a Javascript parser/lexer/engine so you could do the actual calculations. I guess it would be possible to implement this in Python, but I'd rec...
1
2
0
I have a python script and this python script shall call an html-file (i.e. a web page) stored locally on the computer. The html-file does some calculations (jquery,javascript and so on) and should pass the result back to the python script. I don't want to change the setting (python script calls html-file and result is...
How can my HTML file pass JavaScript results back to a Python script that calls it?
0
0
0
367
7,158,929
2011-08-23T09:34:00.000
0
0
1
0
mysql,osx-snow-leopard,32bit-64bit,mysql-python,python-2.5
7,159,017
1
true
0
0
It is possible but you'll need to to compile them by hand, start by creating separate folders for them to live in, then get the source and dependencies that they'll need and keep them separate, you'll need to alter the ./configure commands to point them to the correct places and they should build fine.
1
0
0
I am currently working on two projects in python. One need python 2.5 and other 2.7. Now the problem is when I installed mysql python for 2.5 it required 32 bit version of mysql and it was not working with 64 bit version. So I installed 32 bit version. This project is done by using virtualenv. Now I need to run it on ...
Install both 32 bit and 64 bit versions of mysql on a same mac machine
1.2
1
0
235
7,162,351
2011-08-23T14:09:00.000
0
0
0
0
python,interpolation
7,162,436
1
false
0
0
If you imagine each of the images as a still photo the frame number would be a sequence number that shows what order the images should be displayed in to produce a movie from the stills. If the images are stored in an array it would be the array index of the individul frame in question.
1
0
1
I have many sets of medical image sequences of the artery on the heart. Each set of sequenced medical images shows the position of the artery as the heart pumps. Each set is taken from different views and has different amount of images taken. I want to do a temporal interpolation based on time (i was told that the time...
temporal interpolation of artery angiogram images sequences
0
0
0
163
7,162,812
2011-08-23T14:39:00.000
0
1
0
1
python,performance,bash,testing
7,162,876
3
false
0
0
At the beginning of each script output the start time and at the end of each script output the end time. Subtract the times and compare. Or use the time command if it is available as others have answered.
1
1
0
I'd like to test the speed of a bash script and a Python script. How would I get the time it took to run them?
Test speed of two scripts
0
0
0
327
7,164,151
2011-08-23T16:13:00.000
0
0
0
0
python,unzip,dbf,shapefile
7,354,825
1
false
0
0
Two possible candidate problems: the file to extract is either empty, or is larger than 2Gb. Both of these issues were fixed in 2.6 or 2.7. If neither of these is the case, putting one of the culprit zip archives somewhere public would help us track down the issue.
1
1
0
So, I have a directory of rather large, zipped, shapefiles. I currently have code in python 2.5 that will unzip most of the files (i.e. all of the shapefile component parts .shp, .prj, .dbf...) but I run into occational problems unzipping some .dbf files. These files area generally quite large when I have a problem wi...
python 2.5 error on unzip large dbf file
0
0
0
314
7,164,843
2011-08-23T17:08:00.000
-1
0
1
1
python
16,995,242
5
false
0
0
we can used follow API to detect current is 32bit or 64 bit platform.architecture()[0] '64bit
1
12
0
I'm running python 2.6 on Linux, Mac OS, and Windows, and need to determine whether the kernel is running in 32-bit or 64-bit mode. Is there an easy way to do this? I've looked at platform.machine(), but this doesn't work properly on Windows. I've also looked at platform.architecture(), and this doesn't work when runn...
In Python, how do you determine whether the kernel is running in 32-bit or 64-bit mode?
-0.039979
0
0
8,553
7,166,528
2011-08-23T19:34:00.000
0
1
0
1
python,linux,shell,filesystems
7,166,842
5
false
0
0
You could create a separate command that creates the directory and make it setuid root (or, more safely, setuid or setgid to the owner of the parent directory). Make sure the command can't do anything other than what you want to allow it to do (e.g., don't let it pass its argument to system()). Then invoke that comma...
4
2
0
I'm trying to create a python shell script to create a number of directories in Ubuntu Linux. The main directory I'm trying to create directories in is protected from write access. Is there a way to allow the Python script to be allowed to create directories in there as if it's the root user but not have to run the scr...
How do you allow a Python script access to mkdir in a protected directory without su access in Linux?
0
0
0
2,415
7,166,528
2011-08-23T19:34:00.000
6
1
0
1
python,linux,shell,filesystems
7,166,747
5
true
0
0
This question is not really related to Python. The Python script is just a process like any other process and needs to have to right permissions to do things. The usual method is to create a group, and make the parent directory g+ws for that group. Then add the appropriate users to that group as a supplemental group.
4
2
0
I'm trying to create a python shell script to create a number of directories in Ubuntu Linux. The main directory I'm trying to create directories in is protected from write access. Is there a way to allow the Python script to be allowed to create directories in there as if it's the root user but not have to run the scr...
How do you allow a Python script access to mkdir in a protected directory without su access in Linux?
1.2
0
0
2,415
7,166,528
2011-08-23T19:34:00.000
2
1
0
1
python,linux,shell,filesystems
7,166,771
5
false
0
0
Unfortunately no. A process's permissions in a *nix environment are always less than or equal to the permissions of the person who fires it. This actually makes sense though -- it is a huge security risk to allow processes exceed the user's own abilities. This will require someone who has access to that directory -- e...
4
2
0
I'm trying to create a python shell script to create a number of directories in Ubuntu Linux. The main directory I'm trying to create directories in is protected from write access. Is there a way to allow the Python script to be allowed to create directories in there as if it's the root user but not have to run the scr...
How do you allow a Python script access to mkdir in a protected directory without su access in Linux?
0.07983
0
0
2,415
7,166,528
2011-08-23T19:34:00.000
0
1
0
1
python,linux,shell,filesystems
7,166,564
5
false
0
0
You could add a user just for this task, then give the said user permissions for the directory you want the subdirectories created in and execute the script as the said user. There might be easier solutions but that's what comes to my mind at first glance.
4
2
0
I'm trying to create a python shell script to create a number of directories in Ubuntu Linux. The main directory I'm trying to create directories in is protected from write access. Is there a way to allow the Python script to be allowed to create directories in there as if it's the root user but not have to run the scr...
How do you allow a Python script access to mkdir in a protected directory without su access in Linux?
0
0
0
2,415
7,166,998
2011-08-23T20:15:00.000
2
1
0
1
python,mongodb,pymongo,monkeypatching,gevent
7,168,735
2
false
0
0
On initial inspection it doesn't appear to do any socket operations in the c code so it should be fine (blocking ops should just block the green thread).
2
13
0
Quickie here that needs more domain expertise on pymongo than I have right now: Are the "right" parts of the pymongo driver written in python for me to call gevent monkey_patch() and successfully alter pymongo's blocking behavior on r/w within gevent "asynchronous" greenlets? If this will require a little more leg w...
pymongo + gevent: throw me a banana and just monkey_patch?
0.197375
0
0
4,465
7,166,998
2011-08-23T20:15:00.000
19
1
0
1
python,mongodb,pymongo,monkeypatching,gevent
7,169,174
2
true
0
0
I have used PyMongo with Gevent and here are a few things you need to watch out for: Instantiate only one pymongo.Connection object, preferrably as a global or module-level variable. This is important because Connection has within itself a pool! Monkey patch everything, or at least BOTH socket and threading. Due to th...
2
13
0
Quickie here that needs more domain expertise on pymongo than I have right now: Are the "right" parts of the pymongo driver written in python for me to call gevent monkey_patch() and successfully alter pymongo's blocking behavior on r/w within gevent "asynchronous" greenlets? If this will require a little more leg w...
pymongo + gevent: throw me a banana and just monkey_patch?
1.2
0
0
4,465
7,167,008
2011-08-23T20:16:00.000
5
0
1
0
python,text
7,167,126
11
false
0
0
Seek to the end of the file minus 100 bytes or so. Do a read and search for a newline. If here is no newline, seek back another 100 bytes or so. Lather, rinse, repeat. Eventually you'll find a newline. The last line begins immediately after that newline. Best case scenario you only do one read of 100 bytes.
1
50
0
I need to extract the last line from a number of very large (several hundred megabyte) text files to get certain data. Currently, I am using python to cycle through all the lines until the file is empty and then I process the last line returned, but I am certain there is a more efficient way to do this. What is the ...
Efficiently finding the last line in a text file
0.090659
0
0
156,071
7,167,985
2011-08-23T21:47:00.000
1
0
0
0
python,user-interface,cross-platform
7,168,535
3
true
0
1
I'm going to suggest tkinter. It's part of python, ridiculously easy to use, and of course is very cross platform. Many people dismiss tkinter based on years-old knowledge, but tkinter has evolved a lot. Some say it looks ugly, but more often than not functionality and ease of use is more important. Tkinter is definite...
3
1
0
I am developing a python program (my native platform is Ubuntu) for which I would like to build a simple gui. I would like the GUI to be cross platform.I came across python-gtk/wxpython/qt. What is the best tool to use? Thanks suresh
cross platform gui..which tool to use?
1.2
0
0
549
7,167,985
2011-08-23T21:47:00.000
0
0
0
0
python,user-interface,cross-platform
7,168,033
3
false
0
1
As Matt already suggested, wxPython should be the most portable choice. On Windows it uses the native GUI toolkit, on Linux it will use Qt as backend (I dunno what it does on OSX though, but you can probably find out all of that on their website).
3
1
0
I am developing a python program (my native platform is Ubuntu) for which I would like to build a simple gui. I would like the GUI to be cross platform.I came across python-gtk/wxpython/qt. What is the best tool to use? Thanks suresh
cross platform gui..which tool to use?
0
0
0
549
7,167,985
2011-08-23T21:47:00.000
4
0
0
0
python,user-interface,cross-platform
7,168,005
3
false
0
1
Your best bet would be either wxPython or Qt, although I'd lean strongly towards wxPython based on my previous use. Both of these have fairly good fidelity on both Windows and OSX and feel and look like native applications. GTK has marginal Windows support and pretty bad support on OSX. I would recommend against it.
3
1
0
I am developing a python program (my native platform is Ubuntu) for which I would like to build a simple gui. I would like the GUI to be cross platform.I came across python-gtk/wxpython/qt. What is the best tool to use? Thanks suresh
cross platform gui..which tool to use?
0.26052
0
0
549
7,169,845
2011-08-24T02:34:00.000
6
0
1
0
python,windows,networking
51,795,325
3
false
0
0
I had the same issue as OP but none of the current answers solved my issue so to add a slightly different answer that did work for me: Running Python 3.6.5 on a Windows Machine, I used the format r"\DriveName\then\file\path\txt.md" so the combination of double backslashes from reading @Johnsyweb UNC link and adding the...
1
73
0
I have a file that I would like to copy from a shared folder which is in a shared folder on a different system, but on the same network. How can I access the folder/file? The usual open() method does not seem to work?
Using Python, how can I access a shared folder on windows network?
1
0
0
187,115
7,169,852
2011-08-24T02:35:00.000
0
0
0
0
python,django,data-storage
7,171,161
1
true
1
0
Before giving any specific advice to you, you need to be aware of the limitations of these systems. ISSUES Architectural Differences between Django and PHP/other popular language. PHP re-reads and re-evaluates the entire code tree every time a page is accessed. This allows PHP to re-read settings from DB/cache/whateve...
1
1
0
I want create project wide accessible storage for project/application settings. What i want to achieve: - Each app has it's own app specific settings stored in db - When you spawn django wsgi process each settings are stored in memory storage and are available project wide - Whenever you change any setting value in db...
How to make process wide editable variable (storage) in django?
1.2
0
0
398
7,172,332
2011-08-24T08:08:00.000
0
0
0
0
python,django
10,638,394
1
false
1
0
That's because django's manage.py is by default located at the root of the project, and by default the startapp function(which is not created by the lincolnloop guys) places the apps in the current folder (where manage.py is located). this is from the official docs: startapp [destination] django-admin.py startapp Crea...
1
2
0
I have tested django-startproject (https://github.com/lincolnloop/django-startproject). I have read their doc and Lincoln Loop best practice, but many of their choices are still unclear for me (the way they organize their folders, etc.). Especially, I am quite confused by the way their bin/manage.py behave. When I exe...
Why does django-startproject (by lincoln loop) create app in conf/local?
0
0
0
309
7,172,772
2011-08-24T08:50:00.000
1
0
1
0
python,string,abstract-class,abc
7,173,685
2
false
0
0
You can just subclass str, you wouldn't need any mixins because you inherit everything you need from str itself. As for the "data" part: as you're not "simulating" a string (which is what you'd use UserString for), there is no need for a separate "data" part, use the string itself (that is: use self as you would use a ...
1
6
0
I recently discovered abstract base classes (ABCs) in collections and like their clear, systematic approach and Mixins. Now I also want to create customs strings (*), but I couldn't find an ABC for strings. There is UserString, but UserDict was discouraged!? Deriving from str itself would have no Mixins? How would you ...
ABC for String?
0.099668
0
0
1,670
7,173,171
2011-08-24T09:26:00.000
5
0
1
0
python,regex
7,173,207
1
true
0
0
Include the re.DOTALL option as well, that will allow the . character to match newlines.
1
1
0
I'm trying to get the contents of a <ul> tag from a webpage in python. I used the following code: matchResult = re.search(r'<ul\s*content="MSL">(.*)</ul>', queryResult, re.MULTILINE) This does not work. However if I remove the line breaks by using queryResult = queryResult.replace('\r','').replace('\n','') It works. T...
Python regex matching multiple lines
1.2
0
0
1,418
7,174,741
2011-08-24T11:32:00.000
0
0
0
0
python,oracle,cx-oracle
7,174,814
2
false
0
0
You normally can't bind an object name in Oracle. For variables it'll work but not for trigger_names, table_names etc.
1
1
0
Okay, so I'm connected to an oracle database in python 2.7 and cx_Oracle 5.1 compiled against the instant client 11.2. I've got a cursor to the database and running SQL is not an issue, except this: cursor.execute('ALTER TRIGGER :schema_trigger_name DISABLE', schema_trigger_name='test.test_tr...
Exception binding variables with cx_Oracle in python
0
1
0
1,300
7,175,045
2011-08-24T11:59:00.000
0
0
1
0
python,eclipse,netbeans,keyboard-shortcuts
26,119,404
3
false
0
0
For anyone going in the other direction i.e. from Eclipse to Netbeans, you can setup Netbeans to use Eclipse shortcut key mappings. In Netbeans select Tools > Options > Keymap and select the Eclipse option from the Profile dropdown list.
1
19
0
I have been a happy NetBeans user for a few years and I am pretty used to the keyboard shortcuts. Is there a way for import my NB preferences, and more specifically the keymap, into Eclipse? I know the opposite is possible. PS I have to say I do not insist on using Eclipse, but I found the PyDev plugin is superior to ...
Importing Netbeans keymap to Eclipse
0
0
0
5,558
7,175,909
2011-08-24T13:06:00.000
0
1
1
1
python,linux,module
7,176,030
3
false
0
0
Any modules you wish to use from the standard library must be imported before you can use them.
1
2
0
I need to know, When i run My python over terminal by default how many module are loaded with it which i do not have to import to use, which modules i can directly use ?? My System Env is Ubuntu 11.04 Regards
Python - How many Default Modules loaded
0
0
0
237
7,176,218
2011-08-24T13:28:00.000
0
1
0
0
python,unix
7,176,623
1
false
0
0
First and foremost, make sure you have the newest version of gmake/make. I had a nasty problem using an older version. It was similar to this, which is why I am suggesting it. If you don't have it, install gmake and redo the python installation (./configure, make, make install). Hope that helps!
1
0
0
installing python2.6 after running ./configure it runs with no errors but after running gmake i get this error * WARNING: renaming "_curses" since importing it failed: ld.so.1: python: fatal: relocation error: file build/lib.solaris-2.10-i86pc-2.6/_curses.so: symbol newscr: referenced symbol not found building '_curses...
python2.6.6 installation problem
0
0
0
715
7,176,746
2011-08-24T14:02:00.000
1
0
0
0
python,django,django-admin
7,477,875
1
true
1
0
I think what you want to do is set has_delete_permission(self, obj=None). That will allow you to decide when you can and cannot delete an entire inline.
1
1
0
I'm using TabularInlines for administrate many-to-many relationships in the django admin. When some conditions are met, I want to make the inline read only. To achieve this I override the get_readonly_fields() method from the BaseModelAdmin. This works like a charm, with the only problem, that the read only fields are ...
TabularInlines readonly fields are deleteable
1.2
0
0
157
7,177,596
2011-08-24T14:55:00.000
0
0
1
0
python,debugging,pyscripter
19,956,911
4
false
0
0
PyScripter Actually has a built in debugger Place a breakpoint on the side of the code (little dot on the edge|or| click in the code and push "F5") and then push "F9" to run in debug mode... and the "F8" to step over. Note: This is PyScripter Specific
2
0
0
I have a script I want to debug that has classes and functions that I want to test interactively in the interpreter window of PyScripter. I'd like to be able to do this in debug mode. Is this possible?
is there a way to use the PyScripter python interpreter in debug mode?
0
0
0
4,095
7,177,596
2011-08-24T14:55:00.000
1
0
1
0
python,debugging,pyscripter
7,404,186
4
true
0
0
Apparently, pyscripter does not have this capability.
2
0
0
I have a script I want to debug that has classes and functions that I want to test interactively in the interpreter window of PyScripter. I'd like to be able to do this in debug mode. Is this possible?
is there a way to use the PyScripter python interpreter in debug mode?
1.2
0
0
4,095
7,178,290
2011-08-24T15:40:00.000
1
0
1
0
java,python,windows,deployment,installation
7,178,398
3
false
0
0
---- Edited as the solution is obviously talking about Windows / MSI ---- MSI supports the passing of configuration parameters on the command line. Look into it. Unless they are doing something truly exotic, or they packaged the program in a way that purposefully ignores the parameters, you might find that the best s...
1
1
0
I work at a computer software installation center - our users run Windows. Some of the software is difficult to install for new employees. I would like to automate the setup of software using either Python or Java. How should I fill in the information in the setup dialogs and moving through the setup process automatic...
Software install automation
0.066568
0
0
2,066
7,180,914
2011-08-24T19:07:00.000
0
0
1
0
python
7,181,053
10
false
0
0
Have you tried the obvious and print a prompt then read a line from stdin? That will pause your whole script. What you asked in your original question isn't very clear, so if this doesn't do what you want, can you explain why?
3
20
0
Can I have a running python script(under Windows)being paused in the middle by user , and resume again when user decides ? There is a main manager program which generates,loads and runs other python scripts (by calling python script.py from console).I don't have GUI and user can interact via console.I want my main pro...
pause/resume a python script in middle
0
0
0
79,215
7,180,914
2011-08-24T19:07:00.000
5
0
1
0
python
7,183,576
10
true
0
0
Ok, from what I've seen in my searches on this, even with threading, sys.stdin is going to work against you, no matter how you get to it (input(), or even sys.stdin.read(), .readline(), etc.), because they block. Instead, write your manager program as a socket server or something similar. Write the scripts as generator...
3
20
0
Can I have a running python script(under Windows)being paused in the middle by user , and resume again when user decides ? There is a main manager program which generates,loads and runs other python scripts (by calling python script.py from console).I don't have GUI and user can interact via console.I want my main pro...
pause/resume a python script in middle
1.2
0
0
79,215
7,180,914
2011-08-24T19:07:00.000
0
0
1
0
python
52,696,149
10
false
0
0
In Windows, you can suspend/resume running Python scripts . Type resmon on CMD or via Run command (Windows+R). Locate your Python script process and right-click>Suspend Process. This will unlock CPU usage but not RAM. ;)
3
20
0
Can I have a running python script(under Windows)being paused in the middle by user , and resume again when user decides ? There is a main manager program which generates,loads and runs other python scripts (by calling python script.py from console).I don't have GUI and user can interact via console.I want my main pro...
pause/resume a python script in middle
0
0
0
79,215
7,182,084
2011-08-24T20:49:00.000
0
0
0
0
python,text,tkinter,real-time
7,182,219
2
false
0
1
How are you trying to display real-time text in Tkinter after a button calls a function? What I get so far is, user presses button, function starts and every two minutes posts some data to a server, and tries to display some text somewhere after each post, but has a problem? How does it try to display the text, and wh...
1
0
0
I am trying to display real-time text in Tkinter after a Button command calls a function. The function should display a "timestamp" when PycURL receives "HTTP/1.1 200 OK". The function POSTs energy data to a server every 2 minutes. Pseudocode, a basic example, and/or general discussion should get me headed in the rig...
Displaying real-time text in Tkinter after Button command calls function?
0
0
0
2,891
7,182,165
2011-08-24T20:56:00.000
6
0
0
0
python,django,command-line
7,182,225
3
true
1
0
If you are using a recent version of Django, the manage.py file should be an "executable" file by default. Please note, you cannot just type manage.py somecommand into the terminal as manage.py is not on the PATH, you will have to type ./ before it to run it from the current directory, i.e. ./manage.py somecommand. If ...
1
2
0
Why is it that I have to run python manage.py somecommand and others simply run manage.py somecommand? I'm on OSX 10.6. Is this because there is a pre-set way to enable .py files to automatically run as Python scripts, and I've somehow disabled the functionality, or is that something that you explicitly enable?
Django manage.py question
1.2
0
0
802
7,182,469
2011-08-24T21:24:00.000
0
0
1
0
python,regex,string
7,182,565
3
false
0
0
The re module is the one you want. You might want to reconsider your choice of delimiters, though. $% might get problematic because $ is a reserved character in regex. Up to you though, just remember to use '\\$' or r'\$' (that's a raw string. Very useful if you're doing regex stuff in python.) in your patterns.
1
1
0
I want to replace parts of a string that contains the following words "$%word$%" I want to replace it with the value of a dictionary with the corresponding key equal to word. In other words if I have a string: "blahblahblah $%word$% blablablabla $%car$%" and a dictionary {word:'wassup', car:'toyota'} The string would b...
python regex for string replacement
0
0
0
1,013
7,184,375
2011-08-25T02:10:00.000
8
1
1
0
python,namespaces,pypi,cheeseshop
7,461,581
3
true
0
0
Note that what you call a package here is not a package but a distribution. A distribution can contain zero or more modules or packages. That means there is no one-to-one mapping of distributions to packages. I'm not sure there is a way to detect what modules and packages will be installed by a distribution, other than...
1
28
0
I wonder if is there any reliable and consistant way to get a Python package's "import name" / namespace. For example; Package; django-haystack Import name; haystack or Package; ipython Import name; IPython So far I know, PyPi doesn't store that information that I've checked with PyPiXmlRpc. I also tried to automate to...
How to find "import name" of any package in Python?
1.2
0
0
8,641
7,192,763
2011-08-25T15:07:00.000
0
1
1
0
ironpython,monodevelop
7,242,146
1
false
0
0
The Python addin is for cpython, not IronPython, so it doesn't support assembly references.
1
0
0
I use mono develop 2.4 in ubuntu 10.10, with monodevelop-python and ironpython When I created a empty python project mono develop don't show the reference node. how I can add a new reference file ?
mono develop don´t show reference node
0
0
0
124
7,192,839
2011-08-25T15:12:00.000
0
0
1
0
python
7,192,898
4
false
0
0
Either set.issuperset or all(x in L2 for x in L1).
1
0
0
I want to return true from the if statement only if all of the elements from list 1 also exist in list 2 (list 2 is a superset of list 1). What is the most pythonic way of writing this?
Pythonic way of saying "if all of the elements in list 1 also exist in list 2"
0
0
0
214
7,193,798
2011-08-25T16:17:00.000
3
0
0
0
python,fonts,tkinter
7,195,241
2
true
0
1
You did mean to ask: “How can I measure the width of a string rendering via tkFont without creating a window first?” An the answer is: you can’t. Tk needs it’s root instance to do drawing and such. you can however create it, measure your text, and immediately dispose it via .delete(). This is so fast that the window do...
1
4
0
I can do the measure of text with tkFont, but I don't want a root window --> tk.Tk()
How can I measure the width of a string rendering via tkFont without creating a window first?
1.2
0
0
1,989
7,198,085
2011-08-25T22:46:00.000
0
0
0
0
python,django,geodjango,geos
8,174,249
1
true
0
0
The answer to this depends on the SRID. You call expand which gets a unitless float as a parameter, and the units on that depend on the units with which the SRID is defined.
1
2
0
I've got a bounding box, and I want to adjust it so it's not less than, say, 2km across. I get the bounding box from google's geolocate service, and then I search for stuff that's inside that in my database, but I want to make sure I don't test against anything smaller than 1 or 2km across.. I'd like to get the area, m...
How to measure width in KMs with geos
1.2
0
0
120
7,199,082
2011-08-26T01:16:00.000
2
0
1
1
python,cygwin,biopython
7,199,304
2
false
0
0
You wrote "(or everything of it past the ~ directory)". I think you need to use the full directory path. And ~ isn't expanded immediately after a ':', so use $HOME instead: export PYTHONPATH = $PYTHONPATH":$HOME/directory/where/you/put/Biopython" (Note the use of double rather than single quotes so $HOME is expanded....
1
4
0
In the Biopython installation instructions, it says that if Biopython doesn't work I'm supposed to do this: export PYTHONPATH = $PYTHONPATH':/directory/where/you/put/Biopython' I tried doing that in Cygwin from the ~ directory using the name of the Biopython directory (or everything of it past the ~ directory), but whe...
How do I set the PYTHONPATH on Cygwin?
0.197375
0
0
15,116
7,199,647
2011-08-26T03:13:00.000
0
0
1
0
python
7,199,885
2
true
0
0
No, it will be gone when you start a new session. If you want to add your shortcut so that it's there every time you start python, you have a few options: Add it in your sitecustomize.py file, this may be platform dependent but for my system it is located at /usr/lib/python2.7/sitecustomize.py. Add it in your ipy_u...
1
0
0
I'm new with Python and I created a method that clears the screen. Is it already saved somewhere in my computer so that everytime I call it in Python cmd I can use it? Something to add: Should I learn Python 2 or 3 is fine enough?
Where are functions saved in Python and will they still remain after I close the cmd
1.2
0
0
103
7,200,700
2011-08-26T06:16:00.000
4
1
1
1
python,ruby,bash,interpreter
7,200,742
1
true
0
0
bash loads a large number of commands from disk. Most other scripting languages have many more instructions that they run internally. For example, to do a simple computation in bash, you'd use a=`expr 1 + 2` and bash will first load /usr/bin/expr, run that command which writes the result in the output, bash collects th...
1
3
0
I assume it is because of the interpreter's implementation. Can anyone give me a more in-depth answer please? Thanks. Also, I wonder if bash has a garbage collector?
Why is bash language often slower than python or ruby?
1.2
0
0
635