Q_Id
int64
2.93k
49.7M
CreationDate
stringlengths
23
23
Users Score
int64
-10
437
Other
int64
0
1
Python Basics and Environment
int64
0
1
System Administration and DevOps
int64
0
1
DISCREPANCY
int64
0
1
Tags
stringlengths
6
90
ERRORS
int64
0
1
A_Id
int64
2.98k
72.5M
API_CHANGE
int64
0
1
AnswerCount
int64
1
42
REVIEW
int64
0
1
is_accepted
bool
2 classes
Web Development
int64
0
1
GUI and Desktop Applications
int64
0
1
Answer
stringlengths
15
5.1k
Available Count
int64
1
17
Q_Score
int64
0
3.67k
Data Science and Machine Learning
int64
0
1
DOCUMENTATION
int64
0
1
Question
stringlengths
25
6.53k
Title
stringlengths
11
148
CONCEPTUAL
int64
0
1
Score
float64
-1
1.2
API_USAGE
int64
1
1
Database and SQL
int64
0
1
Networking and APIs
int64
0
1
ViewCount
int64
15
3.72M
2,573,135
2010-04-04T00:28:00.000
3
1
0
0
0
python
0
4,169,614
0
19
0
false
0
0
Teaching to someone else who is starting to learn Python is always a great way to get your ideas clear and sometimes, I usually get a lot of neat questions from students that have me to re-think conceptual things about Python.
5
659
0
0
I've been learning, working, and playing with Python for a year and a half now. As a biologist slowly making the turn to bio-informatics, this language has been at the very core of all the major contributions I have made in the lab. I more or less fell in love with the way Python permits me to express beautiful solutio...
Python progression path - From apprentice to guru
0
0.031568
1
0
0
383,814
2,574,195
2010-04-04T10:55:00.000
0
0
0
0
0
python,qt,qt4,pyqt
0
2,574,214
0
2
0
false
0
1
How about creating multiple cursors (QTextCursor), each selection a different portion of the text. Would that work for you?
2
1
0
0
Qt3.3 used to allow for multiple selections in the QTextEdit widget by calling the setSelection() function and specifying a different selection id (selNum) as the last argument in that function. In Qt4, to create a selection, I do it by creating a QTextCursor object and call the setPosition() or movePosition() methods...
how to create multiple selections in text edit box in qt4?
1
0
1
0
0
1,173
2,574,195
2010-04-04T10:55:00.000
1
0
0
0
0
python,qt,qt4,pyqt
0
2,574,559
0
2
0
true
0
1
The solution, i realise now is actually quite simple. To graphically visualise all the various selections (separate QTextCursor objects), instead of calling the setTextCursor() method for the QTextEdit widget for each of the selections, i change the background color of each of those sections of text by calling the set...
2
1
0
0
Qt3.3 used to allow for multiple selections in the QTextEdit widget by calling the setSelection() function and specifying a different selection id (selNum) as the last argument in that function. In Qt4, to create a selection, I do it by creating a QTextCursor object and call the setPosition() or movePosition() methods...
how to create multiple selections in text edit box in qt4?
1
1.2
1
0
0
1,173
2,578,540
2010-04-05T13:18:00.000
0
1
0
0
0
python,django,cakephp,web-frameworks,yii
0
2,844,890
0
8
0
false
1
0
If for the PHP part I would choose CodeIgniter - it doesn't get too much into your way. But it doesn't have any code/view/model generators out of the box, you need to type a bit. But languages other than PHP appear to be more sexy.
5
21
0
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although ...
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
0
0
1
0
0
30,143
2,578,540
2010-04-05T13:18:00.000
4
1
0
0
0
python,django,cakephp,web-frameworks,yii
0
10,847,083
0
8
0
false
1
0
Codeigniter it's fast and very documented also has a large community to and finaly friendly with the programmer.
5
21
0
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although ...
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
0
0.099668
1
0
0
30,143
2,578,540
2010-04-05T13:18:00.000
0
1
0
0
0
python,django,cakephp,web-frameworks,yii
0
7,084,868
0
8
0
false
1
0
I am using CodeIgniter 1.7.2 and for complex websites it's very good and powerfull, but it definitely is missing some kind of code generator which will allow for example to build an IT application in one click. I had the impression (from watching a tutorial) that Django has it.
5
21
0
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although ...
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
0
0
1
0
0
30,143
2,578,540
2010-04-05T13:18:00.000
31
1
0
0
0
python,django,cakephp,web-frameworks,yii
0
2,578,635
0
8
0
false
1
0
This is a very subjective question but personally I'd recommend Django. Python is a very nice language to use and the Django framework is small, easy to use, well documented and also has a pretty active community. This choice was made partly because of my dislike for PHP though, so take the recommendation with a pinch ...
5
21
0
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although ...
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
0
1
1
0
0
30,143
2,578,540
2010-04-05T13:18:00.000
29
1
0
0
0
python,django,cakephp,web-frameworks,yii
0
2,578,670
0
8
0
true
1
0
Most of the frameworks out there nowadays are fast enough to serve whatever needs you will have. It really depends on in which environment you feel most comfortable. Though there are nuances here and there, MVC frameworks share a lot of the same principles, so whichever you choose to use is really a matter of which you...
5
21
0
0
I have to develop a site which has to accomodate around 2000 users a day and speed is a criterion for it. Moreover, the site is a user oriented one where the user will be able to log in and check his profile, register for specific events he/she wants to participate in. The site is to be hosted on a VPS server.Although ...
PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
0
1.2
1
0
0
30,143
2,580,955
2010-04-05T20:23:00.000
33
0
0
0
0
python,django,forms,autocomplete
0
3,672,334
0
5
0
false
1
0
Add the autocomplete="off" to the form tag, so you don't have to change the django.form instance. <form action="." method="post" autocomplete="off"> {{ form }} </form>
1
28
0
0
Does anyone know how you can turn off autocompletion on a textfield in Django? For example, a form that I generate from my model has an input field for a credit card number. It is bad practice to leave autocompletion on. When making the form by hand, I'd add a autocomplete="off" statement, but how do you do it in Djan...
Disable autocomplete on textfield in Django?
0
1
1
0
0
19,773
2,585,091
2010-04-06T13:24:00.000
4
1
1
0
0
python,emacs,ssh
0
2,585,123
0
8
0
false
0
0
indent-region mapped to C-M-\ should do the trick.
2
139
0
0
Working with Python in Emacs if I want to add a try/except to a block of code, I often find that I am having to indent the whole block, line by line. In Emacs, how do you indent the whole block at once. I am not an experienced Emacs user, but just find it is the best tool for working through ssh. I am using Emacs on ...
Emacs bulk indent for Python
0
0.099668
1
0
0
46,535
2,585,091
2010-04-06T13:24:00.000
10
1
1
0
0
python,emacs,ssh
0
2,585,268
0
8
0
false
0
0
In addition to indent-region, which is mapped to C-M-\ by default, the rectangle edit commands are very useful for Python. Mark a region as normal, then: C-x r t (string-rectangle): will prompt you for characters you'd like to insert into each line; great for inserting a certain number of spaces C-x r k (kill-rectang...
2
139
0
0
Working with Python in Emacs if I want to add a try/except to a block of code, I often find that I am having to indent the whole block, line by line. In Emacs, how do you indent the whole block at once. I am not an experienced Emacs user, but just find it is the best tool for working through ssh. I am using Emacs on ...
Emacs bulk indent for Python
0
1
1
0
0
46,535
2,597,501
2010-04-08T04:03:00.000
0
0
0
1
0
python,directory
0
2,597,538
0
2
0
false
0
0
you can use os.rmdir() to remove a directory. To remove a directory tree recursively, you can use shutil.rmtree. If you know that you already have empty directory nodes, you can also check out os.removedirs()
1
0
0
0
how can i delete a folder using python script?and what are the return values??
deletion of folders
0
0
1
0
0
120
2,610,000
2010-04-09T18:45:00.000
3
0
0
0
0
python,django,postgresql,isbn
0
2,610,094
0
4
0
false
1
0
I don't know postgres but normally ISBM would be a unique index key but not the primary. It's better to have an integer as primary/foreign key. That way you only need to add a new field EAN/ISSN as nullable.
2
2
0
1
I built an inventory database where ISBN numbers are the primary keys for the items. This worked great for a while as the items were books. Now I want to add non-books. some of the non-books have EANs or ISSNs, some do not. It's in PostgreSQL with django apps for the frontend and JSON api, plus a few supporting python ...
ISBNs are used as primary key, now I want to add non-book things to the DB - should I migrate to EAN?
0
0.148885
1
1
0
1,516
2,610,000
2010-04-09T18:45:00.000
1
0
0
0
0
python,django,postgresql,isbn
0
2,614,029
0
4
0
false
1
0
A simple solution (although arguably whether good) would be to use (isbn,title) or (isbn,author) which should pretty much guarantee uniqueness. Ideology is great but practicality also serves a purpose.
2
2
0
1
I built an inventory database where ISBN numbers are the primary keys for the items. This worked great for a while as the items were books. Now I want to add non-books. some of the non-books have EANs or ISSNs, some do not. It's in PostgreSQL with django apps for the frontend and JSON api, plus a few supporting python ...
ISBNs are used as primary key, now I want to add non-book things to the DB - should I migrate to EAN?
0
0.049958
1
1
0
1,516
2,610,421
2010-04-09T19:44:00.000
0
1
1
0
0
python,macos,gcc,distutils,shared-objects
0
2,611,684
0
5
0
false
0
1
You can write python extensions in many ways, including Cython, SWIG, boost.python ... You can also write a shared library and use the "ctypes" library to access it.
1
1
0
0
Looking at Python modules and at code in the "lib-dnyload" directory in the Python framework, I noticed whenever code is creating some kind of GUI or graphic it imports a non-Python file with a .so extension. And there are tons .so files in "lib-dnyload". From googling things I found that these files are called shared...
How to create make .so files from code written in C or C++ that are usable from Python
0
0
1
0
0
4,363
2,611,205
2010-04-09T21:58:00.000
0
0
1
0
0
python,codec,string
0
2,611,227
0
3
0
false
0
0
You shouldn't normally use codecs with str, except to turn them into unicodes. Perhaps you should be looking at using the latin-1 codec if you think you want "raw" data in your unicodes.
2
10
0
0
I've got a Python program that stores and writes data to a file. The data is raw binary data, stored internally as str. I'm writing it out through a utf-8 codec. However, I get UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 25: character maps to <undefined> in the cp1252.py file. This looks t...
How do I write raw binary data in Python?
0
0
1
0
0
24,608
2,611,205
2010-04-09T21:58:00.000
22
0
1
0
0
python,codec,string
0
2,617,930
0
3
0
true
0
0
NOTE: this was written for Python 2.x. Not sure if applicable to 3.x. Your use of str for raw binary data in memory is correct. [If you're using Python 2.6+, it's even better to use bytes which in 2.6+ is just an alias to str but expresses your intention better, and will help if one day you port the code to Python 3.]...
2
10
0
0
I've got a Python program that stores and writes data to a file. The data is raw binary data, stored internally as str. I'm writing it out through a utf-8 codec. However, I get UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 25: character maps to <undefined> in the cp1252.py file. This looks t...
How do I write raw binary data in Python?
0
1.2
1
0
0
24,608
2,615,923
2010-04-11T03:15:00.000
0
0
1
0
0
python,ci-server
0
2,615,976
0
5
0
false
0
0
While this is certainly not a complete answer to your question, I would like to recommend very highly the learning of the tool 'make'. I find myself using it on a VERY regular basis, for a wide variety of tasks, including (but by no means limited to) building, testing, and deploying software.
2
6
0
0
What I was taught at school is all about programming languages, software design, but hardly anything about how to automatically build a software, probably with something like unit testing integrated. Please tell me how do one start learning to set up a build process for his project. If this is too abstract to make any ...
How can I learn to set up a build process?
0
0
1
0
0
354
2,615,923
2010-04-11T03:15:00.000
1
0
1
0
0
python,ci-server
0
2,616,079
0
5
0
false
0
0
For Python projects you should use setuptools. Setuptools has all the stuff to pack things up into .eggs, compile C modules, run unit tests, etc... If you've ever done "python setup.py [build|install|test]" then you've used setuptools.
2
6
0
0
What I was taught at school is all about programming languages, software design, but hardly anything about how to automatically build a software, probably with something like unit testing integrated. Please tell me how do one start learning to set up a build process for his project. If this is too abstract to make any ...
How can I learn to set up a build process?
0
0.039979
1
0
0
354
2,615,968
2010-04-11T03:42:00.000
11
0
1
1
1
python,windows,virtualenv,virtualenvwrapper
0
2,616,482
0
6
0
true
0
0
mkvirtualenv is a bash script so you need to run bash shell to make use of it. mkvirtualenv is a bash function in the mkvirtualenv_bashrc script You will need to run this from cygwin under Windows. (You can call a native python from this and not need a cygwin python)
2
39
0
0
I've installed virtualenv and virtualenvwrapper on Windows using easy_install. But mkvirtualenv is missing. I tried to search on my machine but I couldn't find it. I don't know how to solve it. Do you have any idea?
Installing virtualenvwrapper on Windows
0
1.2
1
0
0
34,056
2,615,968
2010-04-11T03:42:00.000
5
0
1
1
1
python,windows,virtualenv,virtualenvwrapper
0
49,574,221
0
6
0
false
0
0
In windows we need to use virtualenv not mkvirtualenv while creating virtual environments
2
39
0
0
I've installed virtualenv and virtualenvwrapper on Windows using easy_install. But mkvirtualenv is missing. I tried to search on my machine but I couldn't find it. I don't know how to solve it. Do you have any idea?
Installing virtualenvwrapper on Windows
0
0.16514
1
0
0
34,056
2,616,190
2010-04-11T06:01:00.000
1
1
1
1
0
python,installation,metadata
0
2,616,194
0
2
0
false
0
0
You want the sys module: >>> print sys.executable /usr/bin/python >>> print sys.path ['', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-...
1
2
0
0
e.g., how can I find out that the executable has been installed in "/usr/bin/python" and the library files in "/usr/lib/python2.6"?
Python: what package contains the installation metadata?
0
0.099668
1
0
0
91
2,616,610
2010-04-11T09:45:00.000
2
0
0
0
0
python,django,memcached,python-memcached,consistent-hashing
0
2,616,824
0
6
0
true
1
0
Looking at the _get_server method on python-memcached v1.45, it seems it doesn't use consistent hashing, but a simple hash % len(buckets). Same goes for binary protocol, python-memcache uses, as far as I can see in the source, only text commands.
1
4
0
1
Python-memcached is the official supported memcached driver for Django. Does it support Consistent hashing Binary protocol If it does, how do I use those features within Django? I couldn't find any documentation.
Does python-memcached support consistent hashing & binary protocol?
0
1.2
1
0
0
2,396
2,627,775
2010-04-13T07:41:00.000
0
0
1
0
0
python
0
43,765,937
0
5
0
false
0
0
there are numerous options for learning python for web. I learned python to access web data from courser.org, and the tutorial was very interesting. If you want to learn python for web then I suggest you to learn python to access web data in courser.org you can also learn python for everybody which is a specialization ...
2
2
0
0
I have been learning Python for a while, and now I'd like to learn Python for the web; using Python as a back-end of a website. Where and how do I start learning this? Example usages are: connecting to databases, and retrieving and storing information from forms.
How do I start learn Python for web
0
0
1
0
0
612
2,627,775
2010-04-13T07:41:00.000
0
0
1
0
0
python
0
42,923,113
0
5
0
false
0
0
There are numerous frameworks for making websites in Python. Once you are familiar with Python and the general nature of websites which would include the knowledge of HTTP, HTML you can proceed by using any of the following to make websites using Python: Webapp2 - A simple framework to get you started with making webs...
2
2
0
0
I have been learning Python for a while, and now I'd like to learn Python for the web; using Python as a back-end of a website. Where and how do I start learning this? Example usages are: connecting to databases, and retrieving and storing information from forms.
How do I start learn Python for web
0
0
1
0
0
612
2,633,029
2010-04-13T20:38:00.000
0
1
0
1
0
python,android,ase,android-scripting
0
5,914,317
0
1
0
true
1
0
The newer versions of ASE now include a function call to create these identifiers.
1
2
0
0
I am working on am Android Scripting Environment (ASE) script in Python to replicate an iPhone app. I need a device UID of some sort. My thoughts where a salted MD5 hash of the MAC address or device phone number, but I can't figure out how to access either of those using the Python APIs within ASE. What can I do to cre...
How to get a Device Specific UID using Python in ASE on Android?
0
1.2
1
0
0
234
2,638,327
2010-04-14T14:46:00.000
0
0
1
0
0
python,eclipse,interactive
0
2,640,761
0
2
1
true
0
0
If you run it as a debug operation in Eclipse, you should be able to set a breakpoint, and you can then examine variables, etc. But you can evaluate random python scripts via the watch functionality.
1
0
0
0
Let's consider 3 situations: 1) I write a pyhon module in Eclipse (pydev) and run it Ctrl-F11. The module runs and I don't have any control or access (AFAIK) to the module variables and functions. 2) I have defined a python interpreter as an external tool in Eclipse, so I can run it within Eclipse. It works fine, but i...
Python and Eclipse: How to use interactive console after running a module, with the module variables and functions
0
1.2
1
0
0
2,456
2,650,499
2010-04-16T03:57:00.000
0
0
0
1
0
python,mysql,google-app-engine,bulk-load
0
2,662,880
0
3
0
false
1
0
If you're using Pentaho BI Server as your data source, why don't you consider using Pentaho Data Integration (ETL tool) to move the data over? At the very least PDI automate any movement of data between your data source and any AppEngine bulk loader tool (it can easily trigger any app with a shell step).
1
0
0
0
I'm from Brazil and study at FATEC (college located in Brazil). I'm trying to learn about AppEngine. Now, I'm trying to load a large database from MySQL to AppEngine to perform some queries, but I don't know how i can do it. I did some testing with CSV files,but is there any way to perform the direct import from MySQL?...
MySQL to AppEngine
1
0
1
1
0
1,278
2,650,591
2010-04-16T04:21:00.000
0
0
0
0
0
python,pygtk
0
2,788,540
0
3
0
false
0
1
gtk.TextView is "rich", in that it can display all types of formatting and even embedded widgets. If you want the functionality of editing rich text, you will have to write something yourself, though others have tried in applications like BloGTK. From which you could steal codes.
1
1
0
0
I would like to include a rich text editor in a pygtk drawing area for an application i am developing. The editor ( a small resizable widget ) should be able to move around the drawing area like a rectangle. I am not sure how to start as I am pretty new to PyGTK. thank you !
Py GTK Drawing area and Rich Text Editor
0
0
1
0
0
2,291
2,651,466
2010-04-16T07:58:00.000
2
1
1
0
0
python
0
2,651,534
0
2
0
false
0
0
Look for the subprocess module. It is the recommended way to invoke processes from within Python. The os.system function is a viable alternative sometimes, if your needs are very simple (no pipes, simple arguments, etc.)
2
0
0
0
i have this encryption algorithm written in C++ , but the values that has to be encrypted are being taken input and stored in a file by a python program . Thus how can i call this c++ program from python?
how to call a c++ file from python without using any of the spam bindings?
0
0.197375
1
0
0
83
2,651,466
2010-04-16T07:58:00.000
0
1
1
0
0
python
0
2,651,490
0
2
0
false
0
0
The os.system function will invoke an arbitrary command-line from python.
2
0
0
0
i have this encryption algorithm written in C++ , but the values that has to be encrypted are being taken input and stored in a file by a python program . Thus how can i call this c++ program from python?
how to call a c++ file from python without using any of the spam bindings?
0
0
1
0
0
83
2,653,079
2010-04-16T12:59:00.000
1
0
0
0
0
python,file,urllib,file-type
0
2,653,447
0
3
0
false
0
0
I suspect you may be optimising prematurely here. Most modern systems will cache files in memory for a significant period of time before they flush them to disk, so if you write the data to a temporary file, read it back in, then close and delete the file you may find that there's no significant disc traffic (unless it...
1
2
0
0
PdfFileReader reads the content from a pdf file to create an object. I am querying the pdf from a cdn via urllib.urlopen(), this provides me a file like object, which has no seek. PdfFileReader, however uses seek. What is the simple way to create a PdfFileReader object from a pdf downloaded via url. Now, what can I do ...
Inexpensive ways to add seek to a filetype object
0
0.066568
1
0
1
275
2,654,484
2010-04-16T16:11:00.000
1
0
1
0
1
python,function,variables,global-variables
0
2,654,582
0
2
0
true
0
0
If you want to share data between functions then create a class and turn the functions into methods on the class.
2
0
0
0
in python, how can i access the variables of one function into another function, is it possible, i tried the global variable method but that doesn't work for me. can someone help me, how to access the variables from one function to another function.
access variables of other functions
1
1.2
1
0
0
1,692
2,654,484
2010-04-16T16:11:00.000
0
0
1
0
1
python,function,variables,global-variables
0
2,654,647
0
2
0
false
0
0
Don't try to do this. Explicit is better than implicit - if your function needs access to certain variables, pass them in. If it needs to change a value in the calling function, return the new value.
2
0
0
0
in python, how can i access the variables of one function into another function, is it possible, i tried the global variable method but that doesn't work for me. can someone help me, how to access the variables from one function to another function.
access variables of other functions
1
0
1
0
0
1,692
2,654,689
2010-04-16T16:43:00.000
0
0
0
0
0
python,django,profiles
0
2,657,984
0
4
0
false
1
0
Thank you all for your answers! I know that django dev documentation mentions user profiles, but does it very briefly (roughly few lines) and links to djangobook containing information about user profiles, but... to its first version, covering django 0.96. The second version of djangobook, covering django 1.0 (that is ...
1
3
0
0
I am writing simple site that requires users and profiles to be handled. The first initial thought is to use django's build in user handling, but then the user model is too narrow and does not contain fields that I need. The documentation mentions user profiles, but user profiles section has been removed from djangoboo...
Django - how to write users and profiles handling in best way?
0
0
1
0
0
2,938
2,654,834
2010-04-16T17:04:00.000
4
1
1
0
0
python,stream
0
2,654,886
0
4
0
true
0
0
You said that your script "calls a bunch of functions" so I'm assuming that they're python functions accessible from your program. I'm also assuming you're using print to generate the output in all these functions. If that's the case, you can just replace sys.stdout with a StringIO.StringIO which will intercept all the...
1
7
0
0
I've got a python script that calls a bunch of functions, each of which writes output to stdout. Sometimes when I run it, I'd like to send the output in an e-mail (along with a generated file). I'd like to know how I can capture the output in memory so I can use the email module to build the e-mail. My ideas so far w...
Capturing stdout within the same process in Python
0
1.2
1
0
0
4,960
2,660,291
2010-04-17T22:24:00.000
1
0
0
1
0
python,scripting,drag-and-drop,arguments
0
2,660,314
0
3
0
false
0
0
This really is independent of python. It depends entirely on which file browser you're using and how it supports drag and drop.
2
4
0
0
I am writing a simple Python script with no GUI. I want to be able to drag and drop multiple files onto my python script and have access to their absolute paths inside of the script. How do I do this in Mac, Linux, and windows? For times sake, just Mac will be fine for now. I've googled this question and only found one...
In python, how do I drag and drop 1 or more files onto my script as arguments with absolute path? (for windows, linux, and mac)
0
0.066568
1
0
0
3,985
2,660,291
2010-04-17T22:24:00.000
1
0
0
1
0
python,scripting,drag-and-drop,arguments
0
2,660,293
0
3
0
false
0
0
Usually when you drag a file onto a script/executable, the OS passes the path to that file as a command-line argument. Check sys.argv
2
4
0
0
I am writing a simple Python script with no GUI. I want to be able to drag and drop multiple files onto my python script and have access to their absolute paths inside of the script. How do I do this in Mac, Linux, and windows? For times sake, just Mac will be fine for now. I've googled this question and only found one...
In python, how do I drag and drop 1 or more files onto my script as arguments with absolute path? (for windows, linux, and mac)
0
0.066568
1
0
0
3,985
2,661,069
2010-04-18T03:56:00.000
1
0
1
0
0
python-3.x
0
8,859,319
0
3
0
false
0
0
Pexpect has not been ported to python3, and apparently the author has no plans on doing so. I tried converting it with the python 2to3 program, but could not get it to work.
2
2
0
0
i have installed pexpect with the following command "python setup.py install" but when i try to run a program it says "AttributeError: 'module' object has no attribute 'spawn'". how to settle the matter?
pexpect install problem
0
0.066568
1
0
0
1,337
2,661,069
2010-04-18T03:56:00.000
2
0
1
0
0
python-3.x
0
4,926,558
0
3
0
false
0
0
It looks like pexpect wasn't ported yet to python 3 (quite a late answer, but still usable for people googling here)
2
2
0
0
i have installed pexpect with the following command "python setup.py install" but when i try to run a program it says "AttributeError: 'module' object has no attribute 'spawn'". how to settle the matter?
pexpect install problem
0
0.132549
1
0
0
1,337
2,665,253
2010-04-19T05:01:00.000
0
0
0
0
0
python,sqlalchemy
0
2,667,004
0
1
0
true
1
0
You'd better fix your code to avoid setting role.users for the item you are going to merge. But there is another way - setting cascade='none' for this relation. Then you lose an ability to save relationship from Role side, you'll have to save User with roles attribute set.
1
0
0
0
There is a m2m relation in my models, User and Role. I want to merge a role, but i DO NOT want this merge has any effect on user and role relation-ship. Unfortunately, for some complicate reason, role.users if not empty. I tried to set role.users = None, but SA complains None is not a list. At this moment, I use...
In SqlAlchemy, how to ignore m2m relationship attributes when merge?
0
1.2
1
1
0
396
2,677,713
2010-04-20T18:41:00.000
3
0
1
0
0
python,regex,django,sphinx
1
2,678,057
0
6
0
false
1
0
To match all allowed fields, the following rather fearful looking regex works: @((?:cat|mouse|dog|puppy)\b|\((?:(?:cat|mouse|dog|puppy)(?:, *|(?=\))))+\)) It returns these matches, in order: @cat, @(cat), @(cat, dog), @cat, @dog, @(cat, dog), @mouse. The regex breaks down as follows: @ ...
1
2
0
0
I'm trying to validate that the fields given to sphinx are valid, but I'm having difficulty. Imagine that valid fields are cat, mouse, dog, puppy. Valid searches would then be: @cat search terms @(cat) search terms @(cat, dog) search term @cat searchterm1 @dog searchterm2 @(cat, dog) searchterm1 @mouse searchterm2 ...
Regex for finding valid sphinx fields
0
0.099668
1
0
0
700
2,685,015
2010-04-21T17:09:00.000
4
0
1
0
0
python,replace
0
2,685,038
0
6
0
false
0
0
typical technique would be: read file line by line split each line into a list of strings convert each string to the float compare converted value with 1 replace when needed write back to the new file As I don't see you having any code yet, I hope that this would be a good start
1
6
0
0
I'm pretty new to Python programming and would appreciate some help to a problem I have... Basically I have multiple text files which contain velocity values as such: 0.259515E+03 0.235095E+03 0.208262E+03 0.230223E+03 0.267333E+03 0.217889E+03 0.156233E+03 0.144876E+03 0.136187E+03 0.137865E+00 etc for many l...
python: find and replace numbers < 1 in text file
0
0.132549
1
0
0
5,818
2,697,701
2010-04-23T10:08:00.000
0
0
0
0
0
python,linux,excel,automation
0
2,697,769
0
3
0
false
0
0
Excel Macros are per sheets, so, I am afraid, you need to copy the macros explicitly if you created new sheet, instead of copying existing sheet to new one.
2
1
0
0
I am using python in Linux to automate an excel. I have finished writing data into excel by using pyexcelerator package. Now comes the real challenge. I have to add another tab to the existing sheet and that tab should contain the macro run in the first tab. All these things should be automated. I Googled a lot and fo...
Automating Excel macro using python
0
0
1
1
0
1,093
2,697,701
2010-04-23T10:08:00.000
0
0
0
0
0
python,linux,excel,automation
0
3,596,123
0
3
0
false
0
0
Maybe manipulating your .xls with Openoffice and pyUno is a better way. Way more powerful.
2
1
0
0
I am using python in Linux to automate an excel. I have finished writing data into excel by using pyexcelerator package. Now comes the real challenge. I have to add another tab to the existing sheet and that tab should contain the macro run in the first tab. All these things should be automated. I Googled a lot and fo...
Automating Excel macro using python
0
0
1
1
0
1,093
2,698,533
2010-04-23T12:43:00.000
1
0
0
0
0
python,gtk,pygtk
0
2,698,565
0
2
0
false
0
1
You probably should create your own Gtk.TextBuffer implementation, as the default one relies on storing whole buffer in memory.
1
4
0
0
I'm trying to make a very large file editor (where the editor only stores a part of the buffer in memory at a time), but I'm stuck while building my textview object. Basically- I know that I have to be able to update the text view buffer dynamically, and I don't know hot to get the scrollbars to relate to the full fil...
Gtk: How can I get a part of a file in a textview with scrollbars relating to the full file
0
0.099668
1
0
0
494
2,699,987
2010-04-23T15:52:00.000
3
0
1
0
0
python,namespaces,module
0
2,700,321
0
2
0
true
0
0
I think this is the key statement in your question. I don't really want to add the module name in front of every call to the class My response: I hear what you're saying, but this is standard practice in Python. Any Python programmer reading code like "result = match(blah)" will presume you're calling a local functio...
2
1
0
0
Currently, I have a parser with multiple classes that work together. For Instance: TreeParser creates multiple Product and Reactant modules which in turn create multiple Element classes. The TreeParser is called by a render method within the same module, which is called from the importer. Finally, if the package has de...
Importing Classes Within a Module
0
1.2
1
0
0
185
2,699,987
2010-04-23T15:52:00.000
2
0
1
0
0
python,namespaces,module
0
2,700,126
0
2
0
false
0
0
I'm not really sure what your problem is, is it that you just want to type less? get a decent source editor with autocomplete! you can do import longmodulename as ln and use ln.something instead of longmodulename.something you can do from longmodulename import ( something, otherthing ) and use something directly impo...
2
1
0
0
Currently, I have a parser with multiple classes that work together. For Instance: TreeParser creates multiple Product and Reactant modules which in turn create multiple Element classes. The TreeParser is called by a render method within the same module, which is called from the importer. Finally, if the package has de...
Importing Classes Within a Module
0
0.197375
1
0
0
185
2,709,925
2010-04-25T20:55:00.000
1
0
1
0
0
python,executable
0
23,118,279
0
7
0
false
0
0
I've built exe files from Python 2.7 code using each of these tools: Cython (with --embed option) Nuitka Py2exe These all will produce a standalone exe. Your installer will have to include the requisite CRT dlls. Your end result will be indistinguishable from any other exe to the typical user. The first two compile...
1
10
0
0
I want to make an executable file (.exe) of my Python application. I want to know how to do it but have this in mind: I use a C++ DLL! Do I have to put the DLL along side with the .exe or is there some other way?
How to make an executable file in Python?
1
0.028564
1
0
0
22,332
2,722,036
2010-04-27T14:27:00.000
2
1
0
0
1
python,logging,smtp
1
2,734,655
0
2
0
true
0
0
Stress-testing was revealing: My logging configuration sent critical messages to SMTPHandler, and debug messages to a local log file. For testing I created a moderately large number of threads (e.g. 50) that waited for a trigger, and then simultaneosly tried to log either a critical message or a debug message, dependin...
1
2
0
0
A rather confusing sequence of events happened, according to my log-file, and I am about to put a lot of the blame on the Python logger, which is a bold claim. I thought I should get some second opinions about whether what I am saying could be true. I am trying to explain why there is are several large gaps in my log f...
Could Python's logging SMTP Handler be freezing my thread for 2 minutes?
1
1.2
1
0
0
701
2,726,176
2010-04-28T00:55:00.000
0
1
0
0
0
c++,python,c,linux,unix
0
2,726,201
0
5
0
false
0
0
The answer is conditionally "yes". If your languages/environment has interactive keyboard support that offers Key-Down and Key-Up events, then you catch both events and time the difference between them. This would be trivially easy in JavaScript on a web page, which would also be the easiest way to show off your work t...
2
4
0
0
I am working on a project in which I have to develop bio-passwords based on user's keystroke style. Suppose a user types a password for 20 times, his keystrokes are recorded, like holdtime : time for which a particular key is pressed. digraph time : time it takes to press a different key. suppose a user types a pass...
Can I get the amount of time for which a key is pressed on a keyboard
0
0
1
0
0
3,012
2,726,176
2010-04-28T00:55:00.000
0
1
0
0
0
c++,python,c,linux,unix
0
2,726,199
0
5
0
false
0
0
If you read from the terminal in conical mode, you can read each keystroke as it's pressed. You won't see keydown keyup events, like you could if you trapped X events, but it's probably easier, especially if you're just running in a console or terminal.
2
4
0
0
I am working on a project in which I have to develop bio-passwords based on user's keystroke style. Suppose a user types a password for 20 times, his keystrokes are recorded, like holdtime : time for which a particular key is pressed. digraph time : time it takes to press a different key. suppose a user types a pass...
Can I get the amount of time for which a key is pressed on a keyboard
0
0
1
0
0
3,012
2,730,969
2010-04-28T15:37:00.000
1
0
1
0
0
python,geometry,intersection,points
0
2,731,060
0
6
0
false
0
0
You may also want to look into the various clipping algorithms used in graphics development. I have used clipping algorithms to solve alot of problems similar to what you are asking here.
4
6
0
0
In Python, how would one find all integer points common to two circles? For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1) and (x2,y2) and radii r1=r2. Additionally, we already know the two points of intersection of the circles are (xi1,yi1) and (xi2,yi2). H...
Finding all points common to two circles
0
0.033321
1
0
0
4,391
2,730,969
2010-04-28T15:37:00.000
1
0
1
0
0
python,geometry,intersection,points
0
2,731,095
0
6
0
false
0
0
If the locations and radii of your circles can vary with a granularity less than your grid, then you'll be checking a bunch of points anyway. You can minimize the number of points you check by defining the search area appropriately. It has a width equal to the distance between the points of intersection, and a height ...
4
6
0
0
In Python, how would one find all integer points common to two circles? For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1) and (x2,y2) and radii r1=r2. Additionally, we already know the two points of intersection of the circles are (xi1,yi1) and (xi2,yi2). H...
Finding all points common to two circles
0
0.033321
1
0
0
4,391
2,730,969
2010-04-28T15:37:00.000
1
0
1
0
0
python,geometry,intersection,points
0
32,522,118
0
6
0
false
0
0
You're almost there. Iterating over the points in the box should be fairly good, but you can do better if for the second coordinate you iterate directly between the limits. Say you iterate along the x axis first, then for the y axis, instead of iterating between bounding box coords figure out where each circle intersec...
4
6
0
0
In Python, how would one find all integer points common to two circles? For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1) and (x2,y2) and radii r1=r2. Additionally, we already know the two points of intersection of the circles are (xi1,yi1) and (xi2,yi2). H...
Finding all points common to two circles
0
0.033321
1
0
0
4,391
2,730,969
2010-04-28T15:37:00.000
0
0
1
0
0
python,geometry,intersection,points
0
2,731,015
0
6
0
false
0
0
So you want to find the lattice points that are inside both circles? The method you suggested of drawing a box and iterating through all the points in the box seems the simplest to me. It will probably be efficient, as long as the number of points in the box is comparable to the number of points in the intersection. A...
4
6
0
0
In Python, how would one find all integer points common to two circles? For example, imagine a Venn diagram-like intersection of two (equally sized) circles, with center-points (x1,y1) and (x2,y2) and radii r1=r2. Additionally, we already know the two points of intersection of the circles are (xi1,yi1) and (xi2,yi2). H...
Finding all points common to two circles
0
0
1
0
0
4,391
2,732,407
2010-04-28T19:06:00.000
1
1
0
0
0
python,mysql,email,reminders
0
2,733,383
0
3
0
false
0
0
A cronjob every minute or so would do it. If you're considering this, you might like to mind two things: 1 - How many e-mails are expected to be sent per minute? If it takes you 1 second to send an e-mail and you have 100 e-mails per minute, you won't finish your queue. 2 - What will happen if one job starts before th...
2
1
0
0
I have written up a python script that allows a user to input a message, his email and the time and they would like the email sent. This is all stored in a mysql database. However, how do I get the script to execute on the said time and date? will it require a cron job? I mean say at 2:15 on april 20th, the script wil...
Timed email reminder in python
0
0.066568
1
0
0
2,308
2,732,407
2010-04-28T19:06:00.000
2
1
0
0
0
python,mysql,email,reminders
0
2,732,645
0
3
0
true
0
0
If you cannot have a continuously running script, something must trigger it, so that would have to rely on your OS internals. In a unix environment a cron job, as you self state, would do the trick. Set cron to run the script, and make the script wait for a given time and then continue running and sending until the nex...
2
1
0
0
I have written up a python script that allows a user to input a message, his email and the time and they would like the email sent. This is all stored in a mysql database. However, how do I get the script to execute on the said time and date? will it require a cron job? I mean say at 2:15 on april 20th, the script wil...
Timed email reminder in python
0
1.2
1
0
0
2,308
2,735,968
2010-04-29T09:00:00.000
1
0
0
1
1
python,eclipse,debugging,google-app-engine,pydev
0
2,735,992
0
1
0
true
1
0
In fact setting a breakpoint in eclipse is very easy. You have two options: In the grey area next to your line numbers, doubleclick or right mouseclick -> toggle breakpoint.
1
3
0
0
I've got 10+ years in C/C++, and it appears Visual Studio has spoilt me during that time. In Visual Studio, debbuging issimple: I just add a breakpoint to a line of code, and as soon as that code is executed, my breakpoint triggers, at which point I can view a callstack, local/member variables, etc. I'm trying to achi...
How to get debugging of an App Engine application working?
1
1.2
1
0
0
865
2,744,632
2010-04-30T13:00:00.000
0
0
0
0
0
python,django,sqlite,pysqlite
1
64,263,492
0
6
0
false
1
0
Incompatible Django version. Check Django version for solving this error first. I was running on Django==3.0.8 and it was producing an error. Than I ran virtualenv where I have Django==3.1.2 and the error was removed.
1
6
0
0
I have a django project that uses a sqlite database that can be written to by an external tool. The text is supposed to be UTF-8, but in some cases there will be errors in the encoding. The text is from an external source, so I cannot control the encoding. Yes, I know that I could write a "wrapping layer" between the e...
Change text_factory in Django/sqlite
0
0
1
1
0
4,701
2,747,017
2010-04-30T19:13:00.000
0
0
1
0
0
python,visual-studio,visual-studio-2010
0
2,747,130
0
4
0
false
0
0
You can create custom project that will execute a bat file when building. I remember that I used this method to generate a Inoosetup installer so that you should work to run the py2exe script. I have no idea for the rest of the features. The syntax highlighting and the auto-complete should be much more challenging. I w...
3
2
0
0
I would like to know how to use Visual Studio with CPython (the official python.org python interpreter, not IronPython). In particular, I am interested in getting "build" and "run" commands in Visual Studio working. Other features such as color highlighting and auto-complete, I am less concerned about. Also, can the "b...
Running CPython Applications With Visual Studio?
0
0
1
0
0
437
2,747,017
2010-04-30T19:13:00.000
1
0
1
0
0
python,visual-studio,visual-studio-2010
0
2,747,733
0
4
0
false
0
0
Are you trying to build CPython itself? Doesn't it come with project files suitable for use with Visual Studio? (I seem to remember that it did.) If you mean that you want to use CPython but not build it, then just type c:\pythonxx\python.exe into the debugging executable and in the arguments put your script's full p...
3
2
0
0
I would like to know how to use Visual Studio with CPython (the official python.org python interpreter, not IronPython). In particular, I am interested in getting "build" and "run" commands in Visual Studio working. Other features such as color highlighting and auto-complete, I am less concerned about. Also, can the "b...
Running CPython Applications With Visual Studio?
0
0.049958
1
0
0
437
2,747,017
2010-04-30T19:13:00.000
1
0
1
0
0
python,visual-studio,visual-studio-2010
0
2,747,097
0
4
0
false
0
0
Eclipse and PyDev already provide an excellent development environment for Python. Is there any reason you cannot use them?
3
2
0
0
I would like to know how to use Visual Studio with CPython (the official python.org python interpreter, not IronPython). In particular, I am interested in getting "build" and "run" commands in Visual Studio working. Other features such as color highlighting and auto-complete, I am less concerned about. Also, can the "b...
Running CPython Applications With Visual Studio?
0
0.049958
1
0
0
437
2,748,084
2010-04-30T22:37:00.000
4
0
0
1
0
python,mud
0
2,748,104
0
7
0
false
0
0
MUDs actions are usually performed on 'ticks' rather than immediately - this allows for limited affect of latency and for monster's commands to be inserted in the queue and processed fairly. Personally, I don't like this approach, but pretty much 99% of MUDs use it. You need to design a robust command queue & event que...
5
4
0
0
I'm trying my hand at building a MUD (multiplayer interactive-fiction game) I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice. Here's the problem as best I can explain it. When the player dec...
MUD (game) design concept question about timed events
1
0.113791
1
0
0
1,814
2,748,084
2010-04-30T22:37:00.000
3
0
0
1
0
python,mud
0
2,749,799
0
7
0
false
0
0
AI's are clients. They're "part of the server" only in the most distant view. They're actually outside the main game engine. They're specialized clients with no human being. An AI client has the same interface with the server that a human's client would.
5
4
0
0
I'm trying my hand at building a MUD (multiplayer interactive-fiction game) I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice. Here's the problem as best I can explain it. When the player dec...
MUD (game) design concept question about timed events
1
0.085505
1
0
0
1,814
2,748,084
2010-04-30T22:37:00.000
2
0
0
1
0
python,mud
0
4,190,774
0
7
0
false
0
0
You could use threads to handle specific types of Mobs, and put all the instances into an array of some sort. Then, the thread simply goes through the list repeatedly applying logic. DelayTimeStart and Delay could be attributes of the parent Mob class, and when the thread goes through the loop, it can put off process...
5
4
0
0
I'm trying my hand at building a MUD (multiplayer interactive-fiction game) I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice. Here's the problem as best I can explain it. When the player dec...
MUD (game) design concept question about timed events
1
0.057081
1
0
0
1,814
2,748,084
2010-04-30T22:37:00.000
0
0
0
1
0
python,mud
0
4,879,667
0
7
0
false
0
0
A basic approach would be to have a data structure representing the evil monster's instance of its spell, with a cooldown timer on it. When the power is used, the cooldown is set (presumably to a number of seconds defined by the master definition of the spell); an attempt to use it again will fail just like with the p...
5
4
0
0
I'm trying my hand at building a MUD (multiplayer interactive-fiction game) I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice. Here's the problem as best I can explain it. When the player dec...
MUD (game) design concept question about timed events
1
0
1
0
0
1,814
2,748,084
2010-04-30T22:37:00.000
0
0
0
1
0
python,mud
0
21,559,958
0
7
0
false
0
0
I'll provide you an answer from an LPMud/LDMud point of view. Every player in the MUD is an instance of player.c. Player.c inherits from living.c. Things that are living have a heartbeat. The heartbeat function is processed once every 2 seconds for every living object on the mud (or anything that has a heartbeat() f...
5
4
0
0
I'm trying my hand at building a MUD (multiplayer interactive-fiction game) I'm in the design/conceptualizing phase and I've run into a problem that I can't come up with a solution for. I'm hoping some more experienced programmers will have some advice. Here's the problem as best I can explain it. When the player dec...
MUD (game) design concept question about timed events
1
0
1
0
0
1,814
2,748,946
2010-05-01T04:57:00.000
2
0
0
0
0
python,database,postgresql,sqlalchemy,database-schema
0
2,768,187
0
4
0
true
0
0
The solution is rather administrative then technical :) The general rule is easy, there should only be tree-like dependencies in the project: - There should always be a single master source of schema, stored together with the project source code in the version control - Everything affected by the change in the master s...
1
9
0
0
I'm curious about how others have approached the problem of maintaining and synchronizing database changes across many (10+) developers without a DBA? What I mean, basically, is that if someone wants to make a change to the database, what are some strategies to doing that? (i.e. I've created a 'Car' model and now I wan...
What are some strategies for maintaining a common database schema with a team of developers and no DBA?
0
1.2
1
1
0
930
2,750,341
2010-05-01T14:43:00.000
2
1
0
0
0
python,rest,web.py
0
2,750,368
0
4
0
false
1
0
Instead of calling it /post/52/edit, what if you called it /post/52/editor? Now it is a resource. Dilemma averted.
2
4
0
0
I'm almost afraid to post this question, there has to be an obvious answer I've overlooked, but here I go: Context: I am creating a blog for educational purposes (want to learn python and web.py). I've decided that my blog have posts, so I've created a Post class. I've also decided that posts can be created, read, upda...
Is www.example.com/post/21/edit a RESTful URI? I think I know the answer, but have another question
0
0.099668
1
0
1
267
2,750,341
2010-05-01T14:43:00.000
4
1
0
0
0
python,rest,web.py
0
2,750,379
0
4
0
false
1
0
Another RESTful approach is to use the query string for modifiers: /post/52?edit=1 Also, don't get too hung up on the purity of the REST model. If your app doesn't fit neatly into the model, break the rules.
2
4
0
0
I'm almost afraid to post this question, there has to be an obvious answer I've overlooked, but here I go: Context: I am creating a blog for educational purposes (want to learn python and web.py). I've decided that my blog have posts, so I've created a Post class. I've also decided that posts can be created, read, upda...
Is www.example.com/post/21/edit a RESTful URI? I think I know the answer, but have another question
0
0.197375
1
0
1
267
2,750,911
2010-05-01T17:32:00.000
1
1
0
1
0
python,unit-testing,google-app-engine
0
4,059,206
0
4
0
false
1
0
Since, gae is based on webhooks it can be easy to set your own testing framework for all relevant urls in your app.yaml. You can test it on sample dataset on development server ( start devel server with --datastore_path option ) and assert writes to database or webhook responses.
1
17
0
0
I'd like to write some Python unit tests for my Google App Engine. How can I set that up? Does someone happen to have some sample code which shows how to write a simple test?
Google App Engine Python Unit Tests
0
0.049958
1
0
0
5,767
2,752,022
2010-05-02T00:27:00.000
4
0
1
0
1
python,string,email,data-mining,fuzzy-search
0
2,752,090
0
2
0
true
0
0
I would first turn each string of characters into a set or multiset of words (ignoring punctuation and differences in lower/upper case). (If that's not powerful enough, in a second pass I could try pairs or even triples of adjacent words, known as bigrams and trigrams). The key measure of similarity between strings t...
1
3
0
0
I'm downloading a long list of my email subject lines , with the intent of finding email lists that I was a member of years ago, and would want to purge them from my Gmail account (which is getting pretty slow.) I'm specifically thinking of newsletters that often come from the same address, and repeat the product/servi...
Algorithm detect repeating/similiar strings in a corpus of data -- say email subjects, in Python
0
1.2
1
0
0
768
2,755,403
2010-05-02T23:17:00.000
-4
0
1
0
0
python,function,recursion
0
2,755,421
0
6
0
false
0
0
This sounds like homework. So this is probably cheating: a+b is the same as a.__add__(b), and a-b is the same as a.__sub__(b). So you can easily add or subtract two numbers without using +/-. No need for any recursion.
1
0
0
0
I need to write a recursive function that can add two numbers (x, y), assuming y is not negative. I need to do it using two functions which return x-1 and x+1, and I can't use + or - anywhere in the code. I have no idea how to start, any hints?
Using recursion to sum two numbers (python)
0
-1
1
0
0
6,761
2,758,868
2010-05-03T14:48:00.000
1
0
1
0
0
python,ruby,shred
0
2,761,186
0
2
0
false
0
0
Since this is a learning exercise and not a professional attempt to secure data. How about this: 1. Discover the length of the file. 2. Write 0's to the same length of the file. 3. Save the file. 4. Delete the file. Then make another program that tries to recover the file. But yes, if looking to make something professi...
1
4
0
0
In the effort to learn python and/or ruby, I was wondering how a file shredder would be implemented? I would like it to take in a file as an argument and then employ an algorithm to make that file unrecoverable. Would possibly add the support for multiple files or even whole directories later.
Writing a file shredder in python or ruby?
0
0.099668
1
0
0
2,151
2,758,921
2010-05-03T14:54:00.000
2
0
1
0
0
python,regex
0
2,759,044
0
7
0
false
0
0
I'd rather just call ord on every character in the string, 1 by 1. If ord([char]) >= 128 the character is not an ascii character and should be replaced.
1
7
0
0
I need to change some characters that are not ASCII to '_'. For example, Tannh‰user -> Tannh_user If I use regular expression with Python, how can I do this? Is there better way to do this not using RE?
Regular expression that finds and replaces non-ascii characters with Python
0
0.057081
1
0
0
17,450
2,759,623
2010-05-03T16:41:00.000
1
0
1
0
1
python,installation,dependencies,multiple-versions
0
2,759,708
0
8
0
false
0
0
What I usually do is trying to (progressively) keep up with the Python versions as they come along (and once all of the external dependencies have correct versions available). Most of the time the Python code itself can be transferred as-is with only minor needed modifications. My biggest Python project @ work (15.000+...
4
10
0
0
short version: how can I get rid of the multiple-versions-of-python nightmare ? long version: over the years, I've used several versions of python, and what is worse, several extensions to python (e.g. pygame, pylab, wxPython...). Each time it was on a different setup, with different OSes, sometimes different architect...
How to maintain long-lived python projects w.r.t. dependencies and python versions?
0
0.024995
1
0
0
737
2,759,623
2010-05-03T16:41:00.000
4
0
1
0
1
python,installation,dependencies,multiple-versions
0
2,759,813
0
8
0
true
0
0
Some tips: on Mac OS X, use only the python installation in /Library/Frameworks/Python.framework. whenever you use numpy/scipy/matplotlib, install the enthought python distribution use virtualenv and virtualenvwrapper to keep those "system" installations pristine; ideally use one virtual environment per project, so ea...
4
10
0
0
short version: how can I get rid of the multiple-versions-of-python nightmare ? long version: over the years, I've used several versions of python, and what is worse, several extensions to python (e.g. pygame, pylab, wxPython...). Each time it was on a different setup, with different OSes, sometimes different architect...
How to maintain long-lived python projects w.r.t. dependencies and python versions?
0
1.2
1
0
0
737
2,759,623
2010-05-03T16:41:00.000
1
0
1
0
1
python,installation,dependencies,multiple-versions
0
2,844,226
0
8
0
false
0
0
install the python versions you need, better if from sources when you write a script, include the full python version into it (such as #!/usr/local/bin/python2.6) I can't see what could go wrong. If something does, it's probably macports fault anyway, not yours (one of the reasons I don't use macports anymore). I know...
4
10
0
0
short version: how can I get rid of the multiple-versions-of-python nightmare ? long version: over the years, I've used several versions of python, and what is worse, several extensions to python (e.g. pygame, pylab, wxPython...). Each time it was on a different setup, with different OSes, sometimes different architect...
How to maintain long-lived python projects w.r.t. dependencies and python versions?
0
0.024995
1
0
0
737
2,759,623
2010-05-03T16:41:00.000
0
0
1
0
1
python,installation,dependencies,multiple-versions
0
2,853,892
0
8
0
false
0
0
At least under Linux, multiple pythons can co-exist fairly happily. I use Python 2.6 on a CentOS system that needs Python 2.4 to be the default for various system things. I simply compiled and installed python 2.6 into a separate directory tree (and added the appropriate bin directory to my path) which was fairly painl...
4
10
0
0
short version: how can I get rid of the multiple-versions-of-python nightmare ? long version: over the years, I've used several versions of python, and what is worse, several extensions to python (e.g. pygame, pylab, wxPython...). Each time it was on a different setup, with different OSes, sometimes different architect...
How to maintain long-lived python projects w.r.t. dependencies and python versions?
0
0
1
0
0
737
2,763,541
2010-05-04T07:26:00.000
3
0
1
1
0
python,windows,scripting
0
2,763,663
0
1
0
true
0
0
I think the easiest solution is make an external .bat file that executes your exe file and deletes it when finished.
1
1
0
0
I have written a Python script and compiled it into a MS Windows EXE file. I can modify the code, but how do I make it remove itself after running?
I am using Python on Windows. How do I delete my script after it is run?
0
1.2
1
0
0
608
2,767,854
2010-05-04T18:14:00.000
2
0
1
0
0
python,lua,eval
0
2,768,130
0
3
0
false
0
0
From your comments, it appears you a interested in a secure way of executing untrusted code. Redifining python builtins, as you suggested in a comment, is a horrible way to secure code. What you want is sandboxing, there are solutions for python, but I wouldn't recommend them. You would be much better of using Jython ...
2
2
0
0
I'm looking into using Lua in a web project. I can't seem to find any way of directly parsing in pure python and running Lua code in Python. Does anyone know how to do this? Joe
Lua parser in python
0
0.132549
1
0
1
3,999
2,767,854
2010-05-04T18:14:00.000
1
0
1
0
0
python,lua,eval
0
18,090,375
0
3
0
false
0
0
@the_drow From Lua's web site: Lua is a fast language engine with small footprint that you can embed easily into your application. Lua has a simple and well documented API that allows strong integration with code written in other languages. It is easy to extend Lua with libraries written in other languages. It ...
2
2
0
0
I'm looking into using Lua in a web project. I can't seem to find any way of directly parsing in pure python and running Lua code in Python. Does anyone know how to do this? Joe
Lua parser in python
0
0.066568
1
0
1
3,999
2,777,919
2010-05-06T01:41:00.000
1
0
0
0
0
python,html,editor
0
2,778,024
0
2
0
true
0
1
To embed FCKeditor (or maybe better the current CKeditor?), you basically need to embed a full-fledged browser (with Javascript) -- I believe wxPython may currently be the best bet for that, as I hear it has wxIE for Windows and wxWebKitCtrl for the Mac (I don't know if old summer-of-code ideas about making something s...
2
0
0
0
I have a python application which need a gui HTML editor, I know FCKeditor is nice, so how to embed the FCKeditor in a python desktop app?
Embed FCKeditor in python app
0
1.2
1
0
0
340
2,777,919
2010-05-06T01:41:00.000
0
0
0
0
0
python,html,editor
0
2,778,087
0
2
0
false
0
1
In order of difficulty: If you just need to support Windows, you can embed IE in wx - see the docs and demos. wxWebKit is looking a bit more mature, but it's still in development. You could just use the web-browser using webbrowser.open(url). Things will be very crude, and interaction will be a pain. A fourth option - ...
2
0
0
0
I have a python application which need a gui HTML editor, I know FCKeditor is nice, so how to embed the FCKeditor in a python desktop app?
Embed FCKeditor in python app
0
0
1
0
0
340
2,780,413
2010-05-06T10:43:00.000
7
0
1
0
0
python,unicode,string
1
2,780,474
0
2
0
false
0
0
Calling str() on a unicode is the same as calling .encode(sys.getdefaultencoding()) on it. If the unicode contains characters that can't be encoded in the default encoding then it will throw a UnicodeEncodeError. The fix is to explicitly encode the unicode in a useful encoding, such as 'utf-8'.
2
2
0
0
for example the following: str(u'לשום') will throw an error. how can i prevent these?
why in python giving to str func a unicode string will throw an exception?
0
1
1
0
0
218
2,780,413
2010-05-06T10:43:00.000
0
0
1
0
0
python,unicode,string
1
2,780,957
0
2
0
false
0
0
If you're running on Python 3, the u'' notation is a syntax error. Is this your problem? Because in Python <3, your code is absolutely correct, and since 'test' is plain ASCII there are no decoding issues.
2
2
0
0
for example the following: str(u'לשום') will throw an error. how can i prevent these?
why in python giving to str func a unicode string will throw an exception?
0
0
1
0
0
218
2,780,893
2010-05-06T12:03:00.000
1
0
0
0
0
python,django,apache
0
2,780,948
0
5
0
false
1
0
Use python to rewrite the .htaccess automatically? Use a database with users and use a Apache sessions to authenticate?
1
2
0
0
In my app users can upload files for other users. To make the uploaded files accesible only for the addresse I need some kind of static files authentication system. My idea, is to create the apache hosted directory for each user and to limit access to this derectory using .htaccess. This means that each time new django...
django authentication .htaccess static
0
0.039979
1
0
0
1,305
2,791,946
2010-05-07T22:05:00.000
5
0
0
0
0
python,http,exception,tcp
1
2,792,030
0
1
0
true
0
0
The httplib module doesn't use exceptions to convey HTTP responses, just genuine errors (invalid HTTP responses, broken headers, invalid status codes, prematurely broken connections, etc.) Most of the httplib.HTTPException subclasses just have an associated message string (stored in the args attribute), if even that. h...
1
2
0
0
Does httplib.HTTPException have error codes? If so how do I get at them from the exception instance? Any help is appreciated.
python httplib httpexception error codes
0
1.2
1
0
1
3,303
2,810,235
2010-05-11T11:28:00.000
1
0
0
0
0
python,sqlite,pysqlite
0
2,810,300
0
2
0
true
0
0
when you create a prepared statement, the "template" SQL code is sent to the DBMS already, which compiles it into an expression tree. When you pass the values, the corresponding library (python sqlite3 module in your case) doesn't merge the values into the statement. The DBMS does. If you still want to produce a normal...
2
0
0
0
If so, how can I do this?
Can I get the raw SQL generated by a prepared statement in Python’s sqlite3 module?
0
1.2
1
1
0
848
2,810,235
2010-05-11T11:28:00.000
2
0
0
0
0
python,sqlite,pysqlite
0
2,810,250
0
2
0
false
0
0
When executing a prepared statement, no new SQL is generated. The idea of prepared statements is that the SQL query and its data are transmitted separately (that's why you don't have to escape any arguments) - the query is most likely only stored in an optimized form after preparing it.
2
0
0
0
If so, how can I do this?
Can I get the raw SQL generated by a prepared statement in Python’s sqlite3 module?
0
0.197375
1
1
0
848
2,819,134
2010-05-12T13:21:00.000
3
0
0
0
1
asp.net,asp.net-mvc,ironpython,dynamic-language-runtime
0
2,820,043
0
1
0
true
1
0
I've just started using IronPython as extensibility point in my ASP.NET MVC aplication. I have one ipy engine (in static property) and for each request I create new scope and execute the script in that scope. Each scope should be independent on other scopes, no locking is needed. If I run into issues, I'll post it her...
1
2
0
0
I would like to create an ASP.NET MVC web application which has extensible logic that does not require a re-build. I was thinking of creating a filter which had an instance of the IronPython engine. What I would like to know is: how much overhead is there in creating a new engine during each web request, and would it b...
Eval IronPython Scripts during ASP.NET Web Request; Static Engine or Not
1
1.2
1
0
0
310
2,825,100
2010-05-13T07:38:00.000
1
0
0
1
0
python
0
2,825,228
0
3
0
false
0
0
As xitrium mentioned, it would be better if you used telnetlib. You can dispense with the whole mess of shell redirection etc. If you do something like telnet foo | process.py, you can read your programs stdin (sys.stdin) to get the output of the telnet program. When you're happy, you can exit and terminate the pipelin...
1
1
0
0
My problem is that i want to do something like this in linux console telnet 192.168.255.28 > process.py i.e i would like to do some transformation with console telnet output using python script. I'm see Popen in python for this case, but i can't understand how can i get input from telnet if it do not stop all time.. P...
catch output from linux telnet to a python script
0
0.066568
1
0
0
1,408
2,832,064
2010-05-14T05:45:00.000
0
1
1
0
0
javascript,jquery,python,google-apps
0
2,832,539
0
3
0
false
0
0
If speed is the issue, and you by profiling discover that js is the culprit, then I would look into replacing the jQuery with vanilla javascript, or a more optimized library. As jQuery tries to do 'everything' and trains its users into wrapping everything in $(), its bound to introduce unnecessary method calls (I've se...
2
3
0
0
I want to make my component faster, I am using Javascript and JQuery to build that. I am using JSON object to communicate with component and back-end is python. Is there any suggestion to make component faster?
how to increase Speed of a component made from Javascript or JQuery?
0
0
1
0
0
141
2,832,064
2010-05-14T05:45:00.000
1
1
1
0
0
javascript,jquery,python,google-apps
0
2,832,159
0
3
0
true
0
0
Setup some analysis to see what takes time to process. Then decide if you want to try to optimize the javascript and client code, the communication up/down with the server or the actual speed of the python execution. When you have decided what you want to make faster, you can post samples of that to this site and peopl...
2
3
0
0
I want to make my component faster, I am using Javascript and JQuery to build that. I am using JSON object to communicate with component and back-end is python. Is there any suggestion to make component faster?
how to increase Speed of a component made from Javascript or JQuery?
0
1.2
1
0
0
141
2,833,312
2010-05-14T10:10:00.000
3
1
0
1
0
php,python,perl,shell,data-munging
0
2,833,559
0
3
1
true
0
0
import data from a file and possibly reformat it Python excels at this. Be sure to read up on the csv module so you don't waste time inventing it yourself. For binary data, you may have to use the struct module. [If you wrote the C++ program that produces the binary data, consider rewriting that program to stop us...
1
0
0
0
I need to write some scripts to carry out some tasks on my server (running Ubuntu server 8.04 TLS). The tasks are to be run periodically, so I will be running the scripts as cron jobs. I have divided the tasks into "group A" and "group B" - because (in my mind at least), they are a bit different. Task Group A import d...
Data munging and data import scripting
1
1.2
1
0
0
819
2,840,932
2010-05-15T16:54:00.000
4
1
0
1
0
python,c,objective-c,linux,macos
0
2,840,981
0
5
0
false
0
0
It's frequently helpful to learn programming languages in the order they were created. The folks that wrote Objective-C clearly had C and its syntax, peculiarities, and features in mind when they defined the language. It can't hurt you to learn C now. You may have some insight into why Objective-C is structured the ...
4
0
0
0
I know Ruby right now, however I want to learn a new language. I am running Ubuntu 10.04 right now but I am going to get a Mac later this summer. Anyways I want something more for GUI development. I was wondering if I should learn C on Ubuntu right now, and then learn Objective-C when I get an iMac? Will learning C giv...
If I start learning C on Ubuntu will it give me an edge when I start learning Objective-C later this summer?
0
0.158649
1
0
0
835
2,840,932
2010-05-15T16:54:00.000
1
1
0
1
0
python,c,objective-c,linux,macos
0
2,840,961
0
5
0
false
0
0
Sure Objective-C is quite easier to learn if you know C and quite a few books on Objective-C even asume you know C. Also consider learning a bit about MacRuby for GUI development ;)
4
0
0
0
I know Ruby right now, however I want to learn a new language. I am running Ubuntu 10.04 right now but I am going to get a Mac later this summer. Anyways I want something more for GUI development. I was wondering if I should learn C on Ubuntu right now, and then learn Objective-C when I get an iMac? Will learning C giv...
If I start learning C on Ubuntu will it give me an edge when I start learning Objective-C later this summer?
0
0.039979
1
0
0
835
2,840,932
2010-05-15T16:54:00.000
0
1
0
1
0
python,c,objective-c,linux,macos
0
2,909,728
0
5
0
false
0
0
Learning C will definitely be of help, as Objective C inherits its many properties and adds to it. You could learn Objective C either from 'Learn Objective C on the Mac', this one's really a great book, and then if you plan to learn cocoa, get 'Learn Cocoa on the Mac' or the one by James Davidson, they should give you ...
4
0
0
0
I know Ruby right now, however I want to learn a new language. I am running Ubuntu 10.04 right now but I am going to get a Mac later this summer. Anyways I want something more for GUI development. I was wondering if I should learn C on Ubuntu right now, and then learn Objective-C when I get an iMac? Will learning C giv...
If I start learning C on Ubuntu will it give me an edge when I start learning Objective-C later this summer?
0
0
1
0
0
835
2,840,932
2010-05-15T16:54:00.000
0
1
0
1
0
python,c,objective-c,linux,macos
0
5,783,941
0
5
0
false
0
0
Yes. Learn how to program in C.
4
0
0
0
I know Ruby right now, however I want to learn a new language. I am running Ubuntu 10.04 right now but I am going to get a Mac later this summer. Anyways I want something more for GUI development. I was wondering if I should learn C on Ubuntu right now, and then learn Objective-C when I get an iMac? Will learning C giv...
If I start learning C on Ubuntu will it give me an edge when I start learning Objective-C later this summer?
0
0
1
0
0
835