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
6,163,105
2011-05-28T17:06:00.000
0
0
1
0
python,silverlight,client-side,appcelerator
6,165,444
1
true
1
0
I got the answer from appcelerator developer center: The php/python/ruby scripts are executed in the context of the Titanium Desktop. So you will need to run it inside a session of Ti Desktop application, and not on a webpage. Ti Desktop is a modified webkit that knows how to handle this scripts. So apparen...
1
0
0
Something that I couldn't understand from appcelerator website: If I use appcelerator to write a client-side python application for the web, will it require that users have silverlight installed on their machines?
Appcelerator Python Application Requires Silverlight?
1.2
0
0
161
6,165,824
2011-05-29T03:43:00.000
-2
1
1
0
python
6,196,366
4
false
0
0
I think that you need to start by making a separate file in Python and getting the -m option to work. Then, turn that Python file into a code object and incorporate it into your binary in such a way that it continues to work. Look up setuptools in PyPi, download the .egg and take a look at the file. You will see that t...
2
15
0
I have a pure C module for Python and I'd like to be able to invoke it using the python -m modulename approach. This works fine with modules implemented in Python and one obvious workaround is to add an extra file for that purpose. However I really want to keep things to my one single distributed binary and not add a...
Getting python -m module to work for a module implemented in C
-0.099668
0
0
3,104
6,165,824
2011-05-29T03:43:00.000
0
1
1
0
python
7,943,332
4
false
0
0
Does your requirement of single distributed binary allow for the use of an egg? If so, you could package your module with a __main__.py with your calling code and the usual __init__.py... If you're really adamant, maybe you could extend pkgutil.ImpLoader.get_code to return something for C modules (e.g., maybe a specia...
2
15
0
I have a pure C module for Python and I'd like to be able to invoke it using the python -m modulename approach. This works fine with modules implemented in Python and one obvious workaround is to add an extra file for that purpose. However I really want to keep things to my one single distributed binary and not add a...
Getting python -m module to work for a module implemented in C
0
0
0
3,104
6,165,893
2011-05-29T04:08:00.000
1
0
1
0
python,unicode,utf-8,markdown
6,166,085
1
false
1
0
The \xe2\x80\x9c is U+201C LEFT DOUBLE QUOTATION MARK (a "smart quote") when decoded as UTF-8. The two occurrences of \xe2\x80" are not valid UTF-8 sequences and the presence there of a " (a "dumb" quote) is suspicious. You appear to have a mangling problem or an encoding problem, or both. We need to sort that out befo...
1
1
0
I'm using the markdown module from web2py to handle marked up text. The problem is, people are submitting stuff with smartquotes, special characters etc, and I need to replace those with their equivalents. I have text like this: '\n\r\nThe Colonels face paled a bit. \xe2\x80\x9cBut, then \xe2\x80" excuse my boldness, s...
Python Markdown module choking on unicode conversion, utf-8
0.197375
0
0
957
6,166,654
2011-05-29T08:14:00.000
0
0
0
0
python,exception,django-models,importerror
6,170,760
1
true
1
0
Get rid of the models directory, and put all your models in a models.py file, unless you have a VERY good reason not to. Change your imports to from core.models import Variable (rename your Variables class to Variable - django models should be named as the singular not the plural). The problem probably has to do with t...
1
1
0
I've model which represents settings in my system and I use it from another part of my application so that import has 3 levels WORKING CODE <- Module <- Model Model Variables from django.db import models class Variables(models.Model): key = models.CharField(max_length = 20, verbose_name = 'Variable') value ...
Django: Model.objects.get fails with ImportError exception
1.2
0
0
1,042
6,168,035
2011-05-29T13:41:00.000
5
0
1
1
python,pythonpath
6,168,163
2
false
0
0
You need to execute setup.py by specifying which python interpreter on the command line, like this: /path/to/python setup.py install UPDATE: The error message indicates that you don't have the python-dev package installed on your system.
2
3
0
I'm on a bluehost-server which has a "rudimental" installation of python2.6. I installed python2.6 in my user-directory which works fine so far, but when I try to install python packages with "setup.py install", "easy_install" or "pip install" I get: error: invalid Python installation: unable to open /usr/lib/python2.6...
Python setup.py install uses wrong Python installation path
0.462117
0
0
9,083
6,168,035
2011-05-29T13:41:00.000
0
0
1
1
python,pythonpath
6,169,494
2
false
0
0
I just solved the problem by installing the needed packages manually, meaning copying the sourcefiles into my local python folder. Thanks for helping anyway. Best Jacques
2
3
0
I'm on a bluehost-server which has a "rudimental" installation of python2.6. I installed python2.6 in my user-directory which works fine so far, but when I try to install python packages with "setup.py install", "easy_install" or "pip install" I get: error: invalid Python installation: unable to open /usr/lib/python2.6...
Python setup.py install uses wrong Python installation path
0
0
0
9,083
6,169,479
2011-05-29T18:09:00.000
1
0
0
0
php,python,proxy
6,169,561
1
true
0
0
Are you caching the server's responses locally on the client? If not, you should - it ought to speed things up considerably. And if you're asking your server about each URL, you should only ask about the domain name, so that the number of requests per site goes down from lots to only one. (Unless there are domains fo...
1
0
0
I have been developing a parental control software program for my company, but have run into a problem. The software uses policy listings stored in a MySQL DB to determine whether to block a website or not. It uses a local proxy. Each time a website is visited, the proxy sends that site to the server, then the server d...
Parental Control Software
1.2
0
0
445
6,169,726
2011-05-29T18:54:00.000
3
1
1
0
interpreter,pypy,rpython
6,170,275
1
true
0
0
The two most complete (besides the Python one) are Javascript and Prolog, but there are also Squeak, Scheme, Brainfuck, and Haskell in various levels of completeness.
1
4
0
What interpreters have been made using the PyPy Translator Toolchain besides PyPy itself?
What interpreters have been made using the PyPy Translator Toolchain?
1.2
0
0
205
6,171,112
2011-05-29T23:29:00.000
1
0
0
0
python,sockets
6,171,227
2
false
0
0
With TCP sockets it is more typical to leave the connections open, given the teardown & rebuild cost. Eventually when scaling you will do look into NewIO\RawIO. If you do not, imagine that the game client might take a step & not get confirmation if sending it to the server & other players.
1
0
0
I have a client and a server, both written in Python 2.7. Lets say I wanted to make a multiplayer game server (which I don't at the moment but I'm working towards it). I would need to keep the server up to date (and other clients) on my characters whereabouts, correct? How would I do this with sockets? Send or request ...
How would I keep a constant piece of data updated through a socket in Python?
0.099668
0
1
83
6,171,749
2011-05-30T02:20:00.000
9
1
1
0
python,django,eclipse,python-imaging-library,pydev
6,486,750
2
true
0
0
Had the same problem here. Got it resolved by adding /usr/share/pyshared to the Libraries tab in window->preferences->pydev->Interpreter - Python. There were a lot of /usr/lib/python* paths with the compiled libraries (the C stuff with python bindings) where included already, but not /usr/share... parts with the source...
1
13
0
I am trying to work with PIL in my project but the pydev can't seem to find it in my project. First of all I can see it when I enter the python shell, I can import it and I see it in the python sys.path. Second, I Added it to the PYTHONPATH in eclipse. I restarted eclipse, but still, when I try to do "from PIL import I...
How do I add PIL to PyDev in Eclipse, so i could import it and use it in my project?
1.2
0
0
7,037
6,171,764
2011-05-30T02:24:00.000
2
0
0
0
python,pattern-matching,data-mining,wikipedia,text-mining
6,171,789
3
false
0
0
You mention Python and Open Source, so I would investigate the NLTK (Natural Language Toolkit). Text mining and natural language processing is one of those things that you can do a lot with a dumb algorithm (eg. Pattern matching), but if you want to go a step further and do something more sophisticated - ie. Trying to ...
1
2
0
I am planning to develop a web-based application which could crawl wikipedia for finding relations and store it in a database. By relations, I mean searching for a name say,'Bill Gates' and find his page, download it and pull out the various information from the page and store it in a database. Information may include ...
Mining Wikipedia for mapping relations for text mining
0.132549
1
0
3,092
6,172,123
2011-05-30T03:54:00.000
7
0
0
0
php,python,mysql,csv
6,172,230
6
false
0
0
This may not be a usable answer but someone needs to say it. You shouldn't have to do this. CSV is a file format with an expected data encoding. If someone is supplying you a CSV file then it should be delimited and escaped properly, otherwise its a corrupted file and you should reject it. Make the supplier re-export t...
5
2
0
The csv file was created correctly but the name and address fields contain every piece of punctuation there is available. So when you try to import into mysql you get parsing errors. For example the name field could look like this, "john ""," doe". I have no control over the data I receive so I'm unable to stop people ...
What is an easy way to clean an unparsable csv file
1
1
0
3,332
6,172,123
2011-05-30T03:54:00.000
0
0
0
0
php,python,mysql,csv
6,172,324
6
false
0
0
First of all - find all kinds of mistake. And then just replace them with empty strings. Just do it! If you need this corrupted data - only you can recover it.
5
2
0
The csv file was created correctly but the name and address fields contain every piece of punctuation there is available. So when you try to import into mysql you get parsing errors. For example the name field could look like this, "john ""," doe". I have no control over the data I receive so I'm unable to stop people ...
What is an easy way to clean an unparsable csv file
0
1
0
3,332
6,172,123
2011-05-30T03:54:00.000
0
0
0
0
php,python,mysql,csv
6,172,154
6
false
0
0
MySQL import has many parameters including escape characters. Given the example, I think the quotes are escaped by putting a quote in the front. So an import with esaped by '"' would work.
5
2
0
The csv file was created correctly but the name and address fields contain every piece of punctuation there is available. So when you try to import into mysql you get parsing errors. For example the name field could look like this, "john ""," doe". I have no control over the data I receive so I'm unable to stop people ...
What is an easy way to clean an unparsable csv file
0
1
0
3,332
6,172,123
2011-05-30T03:54:00.000
0
0
0
0
php,python,mysql,csv
6,172,145
6
false
0
0
That's a really tough issue. I don't know of any real way to solve it, but maybe you could try splitting on ",", cleaning up the items in the resulting array (unicorns :) ) and then re-joining the row?
5
2
0
The csv file was created correctly but the name and address fields contain every piece of punctuation there is available. So when you try to import into mysql you get parsing errors. For example the name field could look like this, "john ""," doe". I have no control over the data I receive so I'm unable to stop people ...
What is an easy way to clean an unparsable csv file
0
1
0
3,332
6,172,123
2011-05-30T03:54:00.000
1
0
0
0
php,python,mysql,csv
6,172,224
6
false
0
0
You don't say if you have control over the creation of the CSV file. I am assuming you do, as if not, the CVS file is corrupt and cannot be recovered without human intervention, or some very clever algorithms to "guess" the correct delimiters vs the user entered ones. Convert user entered tabs (assuming there are some)...
5
2
0
The csv file was created correctly but the name and address fields contain every piece of punctuation there is available. So when you try to import into mysql you get parsing errors. For example the name field could look like this, "john ""," doe". I have no control over the data I receive so I'm unable to stop people ...
What is an easy way to clean an unparsable csv file
0.033321
1
0
3,332
6,173,118
2011-05-30T06:47:00.000
31
0
1
0
python,visual-studio,ptvs
6,173,175
6
true
0
0
CTRL+K then CTRL+C adds the # in VS for selected lines. CTRL+K then CTRL+U removes the # in VS for selected lines.
5
13
0
What is the shortcut to comment out multiple lines with Python Tools for Visual Studio?
Shortcut to comment out multiple lines with Python Tools for Visual Studio
1.2
0
0
37,158
6,173,118
2011-05-30T06:47:00.000
0
0
1
0
python,visual-studio,ptvs
68,736,442
6
false
0
0
The easiest way to achieve this is to highlight all the previous written code you wish to comment out, then control KC. You will not experience any bugs or altered code during the process. Sometimes Other methods just don't work.
5
13
0
What is the shortcut to comment out multiple lines with Python Tools for Visual Studio?
Shortcut to comment out multiple lines with Python Tools for Visual Studio
0
0
0
37,158
6,173,118
2011-05-30T06:47:00.000
1
0
1
0
python,visual-studio,ptvs
52,196,625
6
false
0
0
If you want to comment out any line in python (when using visual code) then the shortcut is: Ctrl + / (control button plus forward slash)
5
13
0
What is the shortcut to comment out multiple lines with Python Tools for Visual Studio?
Shortcut to comment out multiple lines with Python Tools for Visual Studio
0.033321
0
0
37,158
6,173,118
2011-05-30T06:47:00.000
2
0
1
0
python,visual-studio,ptvs
42,664,145
6
false
0
0
All you need to do is select the block of code and type ctrl+1. You should be all set!
5
13
0
What is the shortcut to comment out multiple lines with Python Tools for Visual Studio?
Shortcut to comment out multiple lines with Python Tools for Visual Studio
0.066568
0
0
37,158
6,173,118
2011-05-30T06:47:00.000
4
0
1
0
python,visual-studio,ptvs
6,173,137
6
false
0
0
On python the only way is """ ... """, practically just a string.
5
13
0
What is the shortcut to comment out multiple lines with Python Tools for Visual Studio?
Shortcut to comment out multiple lines with Python Tools for Visual Studio
0.132549
0
0
37,158
6,174,390
2011-05-30T09:18:00.000
3
0
0
0
python,text,fonts,width,tkinter
6,182,702
3
false
0
1
What you want to do isn't directly supported by the widget. You can almost get there by using a couple of tricks. For example, you can set the wrap attribute to wrap at word or character boundaries, then make sure the widget is never wider than 80 characters (this requires using pack/grid/place options appropriately). ...
1
3
0
I noticed the width argument for the Tkinter Text widget is in characters. Is it possible to set a maximum width in characters for the text widget?
How to set maximum width in characters for the Text widget?
0.197375
0
0
8,149
6,176,445
2011-05-30T12:44:00.000
0
0
0
0
python,selenium-rc,socketexception
6,176,514
4
false
0
0
There are several possibilities. If none of your tests can listen on some port (you don't say what port) then perhaps your Windows machine is running something on a port that you previously had open; this new service may have appeared during the reinstall. If, on the other hand, it's only a problem for some tests, or i...
2
2
0
I have a troublesome problem socket.error error: [Errno 10048]: Address already in use. Only one usage of each socket address (protocol/IP address/port) is normally permitted during automated tests using Selenium with Python. The problem is so interesting that it runs on one machine (Linux) works correctly, but on anot...
problem: Socket error [Address already in use] in python/selenium
0
0
1
15,849
6,176,445
2011-05-30T12:44:00.000
0
0
0
0
python,selenium-rc,socketexception
6,176,956
4
false
0
0
Maybe there is a software on your Windows that already use port 4444, can you try set Selenium to another port and try again?
2
2
0
I have a troublesome problem socket.error error: [Errno 10048]: Address already in use. Only one usage of each socket address (protocol/IP address/port) is normally permitted during automated tests using Selenium with Python. The problem is so interesting that it runs on one machine (Linux) works correctly, but on anot...
problem: Socket error [Address already in use] in python/selenium
0
0
1
15,849
6,176,547
2011-05-30T12:55:00.000
0
1
1
1
python,linux,complexity-theory,ext4
6,176,569
2
false
0
0
Chances are good that the complexity is O(n) with n being the depth in the filesystem (e.g. / would have n=1, /something n=2, ...)
1
4
0
Does anyone know what the complexity of the os.path.exists function is in python with a ext4 filesystem?
python: complexity of os.path.exists with a ext4 filesystem?
0
0
0
810
6,178,664
2011-05-30T16:29:00.000
1
1
0
1
python,binary,easy-install,python-c-extension
39,579,939
3
false
0
0
Sometimes you don't actually really intend to easy_install the 'directory', which will look for a setup.py file. In simple words, you may be doing easy_install xyz/ while what you really want to do is easy_install xyz
1
11
0
After uploading a binary distribution of my Python C extension with python setup.py bdist upload, easy_install [my-package-name] fails on "error: Couldn't find a setup script in /tmp/easy_install/package-name-etc-etc". What am I doing wrong?
easy_install fails on error "Couldn't find setup script" after binary upload?
0.066568
0
0
23,071
6,179,537
2011-05-30T18:20:00.000
2
0
1
0
python,wait
6,179,796
4
false
0
0
Python doesn't have any standard way to catch this, it gets keyboard input only through input() and raw_input(). If you really want this you could use Tkinter or pygame to catch the keystrokes as "events". There are also some platform-specific solutions like pyHook. But if it's not absolutely vital to your program, I...
1
11
0
I'm a n00b to python, and I'm looking a code snippet/sample which performs the following: Display a message like "Press any key to configure or wait X seconds to continue" Wait, for example, 5 seconds and continue execution, or enter a configure() subroutine if a key is pressed. Thank you for your help! Yvan Janssens
Python wait x secs for a key and continue execution if not pressed
0.099668
0
0
14,382
6,180,349
2011-05-30T20:04:00.000
3
0
1
0
python,eclipse,vim,emacs,ide
6,182,428
3
false
0
0
In Python, it is not possible to generically infer the types of variables without actually running the code and seeing what they end up referencing. And even then, much Python code works on many different types, so there really is no true unique type of a variable. For example, the any builtin function iterates over it...
1
5
0
Sometimes I write projects and don't return to them until months later. Unfortunately for me I forget what was intended to be passed into a function. I would like to be able to hover over an argument and see the type such as integer, string, some class, etc. Is there an IDE out there that will do this for me? Any h...
Is there a python IDE that will tell you the type of a variable when you hover over it?
0.197375
0
0
1,144
6,180,732
2011-05-30T21:04:00.000
0
0
0
0
python,django,memory
6,181,167
3
false
0
0
In my opinion, the only real way to be sure is to build a test system and compare the space requirements. It shouldn't take that long to generate some random data programatically. One might think the file system would be more efficient, but databases can and might compress the data or deduplicate it, or whatever. Don't...
1
1
0
I'm writing the server for a Javascript app that has a syncing feature. Files and directories being created and modified by the client need to be synced to the server (the same changes made on the client need to be made on the server, including deletes). Since every file is on the server, I'm debating the need for a My...
Memory usage of file versus database for simple data storage
0
1
0
216
6,180,944
2011-05-30T21:35:00.000
3
0
0
0
python,text,popup,tkinter
6,181,133
1
true
0
1
The bbox method can be used to get the bounding box of an index. You can use that to get the position relative to the window. You can use the winfo method to get the x/y of the window. Typically popups appear next to the mouse rather than the insertion point (though typically, right-clicking first sets the insertion p...
1
2
0
Is it possible to get the x y coordinates of the insertion cursor in a Tkinter Text widget? I'm trying to make a popup menu that pops up next to the insertion cursor.
The Tkinter Text Widget Insertion Cursor
1.2
0
0
556
6,180,947
2011-05-30T21:35:00.000
2
0
0
0
c++,python,qt
10,348,201
2
false
0
1
PythonQt only creates Python wrappers for C++ instances that are exposed to Python. So if you do not expose millions of C++ instances to Python at the same time, it will scale nicely and create wrappers only for the exposed objects. These wrappers are deleted when they go out of scope in Python, so this should scale as...
2
1
0
I was thinking about adding pythonqt to my application for writing plugins. My application is in C++ and already uses the Qt framework. The pythonqt option seems like a natural fit for adding GUI components, but I'm concerned about how well the program will scale if I expose an class with millions of instances. It w...
scalability of pythonqt for millions of objects
0.197375
0
0
310
6,180,947
2011-05-30T21:35:00.000
0
0
0
0
c++,python,qt
6,182,460
2
true
0
1
I haven't done much with it but it almost sounds like you should at least look at QtQuick/QML layer. It is hard to tell from your description what is going on but QML is a way to write Qt GUIs without doing any C++ coding. It build on the already exisiting and well working Qt/JavaScript Implementation and Bridge. As f...
2
1
0
I was thinking about adding pythonqt to my application for writing plugins. My application is in C++ and already uses the Qt framework. The pythonqt option seems like a natural fit for adding GUI components, but I'm concerned about how well the program will scale if I expose an class with millions of instances. It w...
scalability of pythonqt for millions of objects
1.2
0
0
310
6,181,555
2011-05-30T23:23:00.000
3
1
1
0
python,unit-testing
45,474,275
3
false
0
0
Simply call your functionality, e.g. do_something(). If an unhandled exception gets raised, the test automatically fails! There is really no reason to do anything else. This is also the reason why assertDoesNotRaise() does not exist. Credit: comment by Sven
1
26
0
In the Python unittest framework, is there a way to pass a unit test if an exception wasn't raised, and fail with an AssertRaise otherwise?
Pass a Python unittest if an exception isn't raised
0.197375
0
0
31,748
6,184,491
2011-05-31T07:50:00.000
1
0
0
0
php,python,database
6,184,556
2
true
1
0
Here's a possible solution - a script, either in php or python performing your database tasks - a scheduler : Cron for linux, or the windows task scheduler ; where you set the frequency of your jobs. I'm using this solution for multiple projects. Very easy to set up.
1
0
0
I need a job scheduler (a library) that queries a db every 5 minutes and, based on time, triggers events which have expired and rerun on failure. It should be in Python or PHP. I researched and came up with Advanced Python Scheduler but it is not appropriate because it only schedules the jobs in its job store. Instead,...
Database Based Job scheduler
1.2
1
0
710
6,184,994
2011-05-31T08:41:00.000
1
0
0
0
python,django,session,django-sessions,django-users
6,249,925
2
true
1
0
I ended up storing the per-site data in the user's session, i.e. session['site_id_1'] = user_obj_1, session['site_id_2'] = user_obj_2, etc... Instead of logging in, I just store the user data in the appropriate key. Instead of logging out, I delete the key for the site.
1
1
0
I'm creating a widget that gets installed on various different sites and I need distinct users for each site. Problem is, the same person browsing might have 2 different sites open at once that use my widget. This means that I need users to be logged in with multiple accounts simultaneously to the same Django site. Fr...
Allowing Users logged in with multiple accounts at once to the same Django site
1.2
0
0
329
6,186,091
2011-05-31T10:17:00.000
4
0
1
0
python,windows,pyqt,startup,pyinstaller
6,186,198
2
false
0
1
You may add registry key under [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run], with any name and value "path_to_your_exec". this will require local administrator right, but will work for all users. The same key but starting with [HKEY_CURRENT_USER] will not require administrator privileges, but will...
1
5
0
I'm using PyQt to develop an application that in Windows, if set in preferences, should be able to start at boot. I'm releasing this software with PyInstaller as a single executable file; i don't have a proper "installer". Which is the best way to achieve this? ( = starting at boot) A possible solution is to add a link...
PyQt: best way to do the trick "start at boot" for my program in Windows
0.379949
0
0
2,695
6,187,874
2011-05-31T12:54:00.000
3
0
1
1
python,pydev
6,187,949
2
true
0
0
Neil speaks the truth, except for telling you to turn it off -- spell check in comments is quite helpful -- those who come after will thank you for ensuring they can read your comments without trying to decode random spelling errors. The lines are simply pointing out words your IDE thinks are spelled wrong. I don't kno...
2
1
0
I am developing using PyDev in Eclipse. I have put in some comments in my code. I get wavy red lines underneath certain words. The program runs fine and there are no warnings mentioned. So what is the meaning of these wavy lines. e.g. #!/usr/bin/python - I get the line under usr and python # generated by accessing re...
pydev - can someone please explain these errors
1.2
0
0
254
6,187,874
2011-05-31T12:54:00.000
0
0
1
1
python,pydev
6,187,969
2
false
0
0
Might be this is just a spellchecker. You have a typo "follwing" instead of "following".
2
1
0
I am developing using PyDev in Eclipse. I have put in some comments in my code. I get wavy red lines underneath certain words. The program runs fine and there are no warnings mentioned. So what is the meaning of these wavy lines. e.g. #!/usr/bin/python - I get the line under usr and python # generated by accessing re...
pydev - can someone please explain these errors
0
0
0
254
6,188,464
2011-05-31T13:39:00.000
1
0
1
0
python,pydev
6,188,499
1
true
0
0
The argument self is only necessary for class methods. It doesn't make sense for normal functions. That means you either omitted a vital information in your question or there is a bug in PyDev.
1
0
0
I am new to PyDev, written scripts using mainly notepad++ and jedit where I never had these issues. In a module, I have defined a function - get_user_inputs(self). I used the argument self as PyDev would not let me define the function othewise (and apparently it is the right thing to do). Now my question is how do I ca...
pydev - call a function with only self as argument
1.2
0
0
214
6,188,798
2011-05-31T14:05:00.000
2
1
0
0
c++,python,ruby,scripting,lua
6,190,078
6
false
0
0
TCL would be another option for an easy to embed scripting language. personally I'd go with the scripting language you and/or whoever will be using the scripting language is most familiar with already, especially if end users will be able to run custom scripts, you will need to know what, if any, languages they are fa...
1
9
0
I want to choose an embedded scripting language that i will use on C++. It should connect a database such as Oracle. My host application is a server application. That will pass raw data to script. The script will parse and do some specific logics. Also updates database. Then script will returns raw data as result. Can ...
Choosing embedded scripting language for C++
0.066568
0
0
10,847
6,189,047
2011-05-31T14:24:00.000
2
0
0
0
python,wxpython
6,191,925
1
false
0
1
You need to catch EVT_SPIN or EVT_SPINCTRL and in your handler, you can select all the values by calling each of the control's GetValue method. In the wxPython demo, it seems to support tab traversal. I'm not sure what's going on with yours. Did you try the FloatSpin widget as an alternative?
1
0
0
I have 4 spinctrls in my app. When I click on them, I want all their content to be selected instantly. And another thing is, I need to make them tab traversal. Can you help me with some sort of code to do this task? Thanks in advance.
Make Spinctrl selected when activated in WxPython
0.379949
0
0
158
6,189,398
2011-05-31T14:49:00.000
2
1
1
0
python,multithreading,resources,simulation,multiprocess
6,189,789
5
false
1
0
I wrote an ant simulation (for finding a good TSP-solution) and a wouldnt recommend a Thread-Solution. I use a loop to calculate for each ant the next step, so my ants do not really behave concurrently (but synchronize after each step). I don't see any reason to model those ants with Threads. Its no advantage in terms...
2
6
0
The simple study is: Ant life simulation I'm creating an OO structure that see a Class for the Anthill, a Class for the Ant and a Class for the whole simulator. Now I'm brainstorming on "how to" make Ants 'live'... I know that there are projects like this just started but I'm brainstorming, I'm not looking for a just-r...
Ant simulation: it's better to create a Process/Thread for each Ant or something else?
0.07983
0
0
1,030
6,189,398
2011-05-31T14:49:00.000
1
1
1
0
python,multithreading,resources,simulation,multiprocess
6,189,548
5
false
1
0
I agree with @delan - it seems like overkill to allocate a whole thread per Ant, especially if you are looking to scale this to a whole anthill with thousands of the critters running around. Instead you might consider using a thread to update many ants in a single "cycle". Depending on how you write it - you need to ca...
2
6
0
The simple study is: Ant life simulation I'm creating an OO structure that see a Class for the Anthill, a Class for the Ant and a Class for the whole simulator. Now I'm brainstorming on "how to" make Ants 'live'... I know that there are projects like this just started but I'm brainstorming, I'm not looking for a just-r...
Ant simulation: it's better to create a Process/Thread for each Ant or something else?
0.039979
0
0
1,030
6,189,956
2011-05-31T15:31:00.000
4
0
1
0
python,string,decimal
6,190,948
13
false
0
0
The decimal library is for working with decimal numbers, like in Accounting. It doesn't inherently have a function to return the number of decimal places. This is especially a problem when you realize that the context it runs under sets it at whatever the user wants. If you get a string, you can convert to decimal, bu...
2
84
0
Is there an easy way or integrated function to find out the decimal places of a floating point number? The number is parsed from a string, so one way is to count the digits after the . sign, but that looks quite clumsy to me. Is there a possibility to get the information needed out of a float or Decimal object?
Easy way of finding decimal places
0.061461
0
0
110,709
6,189,956
2011-05-31T15:31:00.000
1
0
1
0
python,string,decimal
6,190,248
13
false
0
0
Since Python floating point numbers are internally represented as binary rather than decimal, there's really no shortcut other than converting to decimal. The only built-in way to do that is by converting to a string. You could write your own code to do a decimal conversion and count the digits, but it would be a dupli...
2
84
0
Is there an easy way or integrated function to find out the decimal places of a floating point number? The number is parsed from a string, so one way is to count the digits after the . sign, but that looks quite clumsy to me. Is there a possibility to get the information needed out of a float or Decimal object?
Easy way of finding decimal places
0.015383
0
0
110,709
6,190,982
2011-05-31T17:03:00.000
1
0
0
0
python,connection,global-variables
6,191,102
1
true
0
0
I think that database cursors are scarce resources, so passing them around can limit your scalability and cause management issues (e.g. which method is responsible for closing the connection)? I'd recommend pooling connections and keeping them open for the shortest time possible. Check out the connection, perform the ...
1
2
0
When accessing a MySQL database on low level using python, I use the MySQLdb module. I create a connection instance, then a cursor instance then I pass it to every function, that needs the cursor. Sometimes I have many nested function calls, all desiring the mysql_cursor. Would it hurt to initialise the connection as g...
What is the best way to handle connections (e.g. to mysql server using MySQLdb) in python, needed by multiple nested functions?
1.2
1
0
301
6,191,477
2011-05-31T17:51:00.000
0
0
0
0
python,django,internationalization,locale,python-babel
9,914,642
1
true
1
0
The solution I ended up taking is just converting the utf-8 string to ASCII and stripping the diacritics just for the sort operation. Not ideal but it ended up working for this specific case.
1
0
0
I need to sort a collection of objects by a utf-8 string property (built via ActiveRecord). Currently the code is sorting by ASCII order via the order_by method, however this needs to be changed to locale.strcoll. Unfortunately using the built in locale functionality requires changing the culture for the entire appl...
How to sort collections based on current user locale on a Django site
1.2
0
0
393
6,191,624
2011-05-31T18:06:00.000
1
1
0
1
python,cron
6,192,123
4
false
0
0
If the cron job runs as "you", and if you set the DISPLAY var (export DISPLAY=:0) you should have no issues.
2
3
0
I coded a python application which was running OK as a cron job. Later I added some libraries (e.g. pynotify and other *) because I wanted to be notified with the message describing what is happening, but it seems that cron can't run such an application. Do you know some alternative how to run this application every fi...
Notification as a cron job
0.049958
0
0
728
6,191,624
2011-05-31T18:06:00.000
0
1
0
1
python,cron
6,191,715
4
false
0
0
I don't see any problem in cron job with pynotify? What is the error you are getting? Can you run your python code separately to check whether your python code is working really well but only fails with cron? Celery is distributed job queue & task manager written in Python but it may be too much for your needs. Supervi...
2
3
0
I coded a python application which was running OK as a cron job. Later I added some libraries (e.g. pynotify and other *) because I wanted to be notified with the message describing what is happening, but it seems that cron can't run such an application. Do you know some alternative how to run this application every fi...
Notification as a cron job
0
0
0
728
6,191,651
2011-05-31T18:09:00.000
1
0
1
0
python,multithreading
6,192,262
2
false
0
0
Python passes references to objects. Doesn't matter if your object is a string or a whole class instance full of attributes. BTW, as said on other answer, this design choice isn't the best one.
2
3
0
I have two or more threads(created by subclassing threading.Thread) running in parallel and they often communicate with each other. They communicate by calling each others methods. As I have been doing it, I have each thread pass itself as an argument, so that all of that classes attributes are available right away. T...
Python: Is passing a function more information a bad thing?
0.099668
0
0
110
6,191,651
2011-05-31T18:09:00.000
6
0
1
0
python,multithreading
6,191,693
2
true
0
0
It's not less efficient, but it can increase coupling -- that is, it might lead you to make your function more dependent on the details of the overall structure. This makes code more brittle -- you might have to make more changes throughout the code to account for a change in the structure.
2
3
0
I have two or more threads(created by subclassing threading.Thread) running in parallel and they often communicate with each other. They communicate by calling each others methods. As I have been doing it, I have each thread pass itself as an argument, so that all of that classes attributes are available right away. T...
Python: Is passing a function more information a bad thing?
1.2
0
0
110
6,192,655
2011-05-31T19:40:00.000
8
0
0
0
python,django,slug
6,192,676
1
true
1
0
The slug provides a human-friendly url fragment for the page. This is often useful when people are deciding whether or not to click a link. There's one in the url of this page, for example: http://stackoverflow.com/questions/6192655/whats-the-advantage-or-benefit-of-slug-field-in-django You can actually get to this que...
1
1
0
What's the benefit of the slug field? Does it make the url more searching engine friendly? If it does, how? Isn't a meaningful title of the page searching engine friendly enough?
What's the advantage or benefit of Slug field in Django?
1.2
0
0
3,559
6,194,618
2011-05-31T23:15:00.000
1
0
0
1
python,windows,testing,virtualization
6,194,672
3
false
0
0
Whatever happens, if you're developing for multiple platforms you're going to have to copy from whichever you're developing on to the secondary platform(s), build it and instigate your tests. Your best bet is to automate as much of it as possible (for both environments) and make a build bot which watches for new code ...
2
0
0
I'm trying to develop a cross-platform library and want to be able to develop code and then quickly test it on both Windows and Linux. I'm not sure if it's even an option or worthwhile testing under Wine (it uses the multiprocessing module, and COM on Windows) but I do have a VM I've been running it under. It's just be...
Develop in python on Linux, test on Windows
0.066568
0
0
447
6,194,618
2011-05-31T23:15:00.000
2
0
0
1
python,windows,testing,virtualization
6,194,653
3
true
0
0
Using a DVCS to push the local changes to the server will take you far. You will need a SSH server on the Windows machine, but there are several of those around. You can also use a makefile to direct the pushing and testing, possibly even running the tests remotely depending on what they consist of.
2
0
0
I'm trying to develop a cross-platform library and want to be able to develop code and then quickly test it on both Windows and Linux. I'm not sure if it's even an option or worthwhile testing under Wine (it uses the multiprocessing module, and COM on Windows) but I do have a VM I've been running it under. It's just be...
Develop in python on Linux, test on Windows
1.2
0
0
447
6,195,424
2011-06-01T01:46:00.000
-2
0
0
0
python,django,django-forms
58,656,035
4
false
1
0
You can just add required=False on your forms.BooleanField() args.
1
47
0
I've a settings page where users can select if they want to receive a newsletter or not. I want a checkbox for this, and I want that Django select it if 'newsletter' is true in database. How can I implement in Django?
How to insert a checkbox in a django form
-0.099668
0
0
114,804
6,195,508
2011-06-01T02:04:00.000
0
1
0
0
java,python
6,195,610
3
true
1
1
I'd recommend going with PySFML, and, of course, Python. If you do your Python programming correctly , and if you really are willing to fiddle with C or ASM Python plugins for faster computations, you shouldn't really have too much performace hits.
2
1
0
The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The plan is to mainly load the graphics from a disc, or .iso (I already know the sectors the g...
Game Engine Remake - Trouble Choosing a Language /API(Java or Python)
1.2
0
0
213
6,195,508
2011-06-01T02:04:00.000
0
1
0
0
java,python
6,195,870
3
false
1
1
At the end of the day if you're passionate about the project and committed to getting the most out of the language you choose, the performance difference between java and python will be minimal if non-existent. Personally speaking, the biggest challenge is finishing the project once it loses novelty and initial momentu...
2
1
0
The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The plan is to mainly load the graphics from a disc, or .iso (I already know the sectors the g...
Game Engine Remake - Trouble Choosing a Language /API(Java or Python)
0
0
0
213
6,197,760
2011-06-01T07:36:00.000
1
1
1
0
python,lua,compilation,obfuscation
6,198,605
3
false
0
0
(For Lua) Depends on how safe it should be. For keeping out dumb edits you can just change the extension, and configure the path to recognize it anyhow. For keeping out people who know how to change extensions, you can ship files compiled with luac. For deciphering that you already have to put considerable effort in it...
2
3
0
I will separate my business code into a script language. it would be Lua or Python. My question is my business code written in script file is viewable by others. Because of script file will not compiled that is open. Anyone can see it. How can I hide it? I think if I use Python, it would be compiled (.pyo), but Lua lo...
Compiling script files Lua or Python
0.066568
0
0
1,177
6,197,760
2011-06-01T07:36:00.000
1
1
1
0
python,lua,compilation,obfuscation
6,197,862
3
false
0
0
You will not be able to hide this easily. You can encrypt and decipher on the fly. The problem is that people will be able to look at you're process memory and see the code clear as day. If you want to prevent people from changing the lua you can create a hash which the text file is checked against on each run.
2
3
0
I will separate my business code into a script language. it would be Lua or Python. My question is my business code written in script file is viewable by others. Because of script file will not compiled that is open. Anyone can see it. How can I hide it? I think if I use Python, it would be compiled (.pyo), but Lua lo...
Compiling script files Lua or Python
0.066568
0
0
1,177
6,197,908
2011-06-01T07:51:00.000
2
0
1
0
python,floating-point,format,fortran
6,200,763
3
false
0
0
.0 on output gives a decimal point but no digit after the decimal point. On input, other numbers of digits after the decimal are allowed in the numeric string and override the format specifier -- what matters is the width and that the input is within the correct columns. If the examples are for input, they could b...
2
2
0
I'm writing a front end gui in Python3.2, and part of the final output is based off of a fortran format. I've found a good few examples, and haven't had many problems translating from fortran to python (e.g. F10.3 == "{:10.3F}") However, I'm seeing some differences in some of the example output my python is trying to m...
Fortran to Python format floats
0.132549
0
0
2,398
6,197,908
2011-06-01T07:51:00.000
0
0
1
0
python,floating-point,format,fortran
6,198,443
3
false
0
0
Yes, a "Fw.0" edit descriptor implies no fractional digits. See Section 10.7.2.3.2 in the Fortran 2008 standard (N1830.pdf). Either your Fortran compiler is buggy, or you're misinterpreting the Fortran source code and the corresponding output. Note that in general, Fortran formatting is quite complex, and a general pu...
2
2
0
I'm writing a front end gui in Python3.2, and part of the final output is based off of a fortran format. I've found a good few examples, and haven't had many problems translating from fortran to python (e.g. F10.3 == "{:10.3F}") However, I'm seeing some differences in some of the example output my python is trying to m...
Fortran to Python format floats
0
0
0
2,398
6,198,941
2011-06-01T09:23:00.000
0
1
1
0
java,php,python,linux,sync
6,199,290
3
false
1
0
For Java projects, you could give Maven a try, and configure you own repository on your server. Don't know if it can be used for the other languages, however.
1
1
0
I am doing various projects acroos diff computers , servers and diff languages like php python java etc. Now on every computer i have to install / download various supporting libraries like javascript libraries for PHP , Jar files for Java and many python modules. Is there way so that i can make online folder on server...
How can keep my libraries , modules or jar files Synced across diff projects
0
0
0
229
6,200,707
2011-06-01T11:55:00.000
0
1
0
0
php,python
6,200,853
2
false
1
0
There are a million ways to do this. I suggest you write the local data gathering first, to know the amount and format of the data (and because getting Windows hardware information via Python seems to be the hardest part). Then write the web page login, to see if you can get HTTPS or have to take care of security yours...
1
1
0
Well, i do want to make a web app in php, where the user could create an account and log in, then download a desktop app made in python, log in there also with the username and the password from the web app and then run in tray. The purpose of this project is none, i want to do it for fun and practice, but i do have so...
Python desktop app linked to PHP web app?
0
0
0
227
6,201,503
2011-06-01T12:57:00.000
1
1
1
0
python,distutils
9,918,482
3
false
0
0
I would use a virtual environment, that is, an isolated Python installation that is not affected by distributions installed system-wide. See virtualenv and virtualenvwrapper on PyPI.
1
16
0
I have a package I am developing. This package is already installed as an egg file parked in the site-packages directory, egg path added to easy-install.pth. I now realized I have a bug in the package, so I invoked python setup.py develop to hook up the development dir. The path of the source dir is correctly added to...
python setup.py develop to override installed version
0.066568
0
0
6,964
6,202,726
2011-06-01T14:23:00.000
0
0
0
0
python,unicode,utf-8
7,720,395
8
false
0
0
and db.set_character_set('utf8'), imply that use_unicode=True ?
1
37
0
I am trying to push user account data from an Active Directory to our MySQL-Server. This works flawlessly but somehow the strings end up showing an encoded version of umlauts and other special characters. The Active Directory returns a string using this sample format: M\xc3\xbcller This actually is the UTF-8 encoding f...
Writing UTF-8 String to MySQL with Python
0
1
0
77,413
6,207,211
2011-06-01T20:26:00.000
1
0
0
0
python,django,pylons,cherrypy
6,207,234
5
false
1
0
I would recommend DJANGO or TurboGears.
1
3
0
I have 4 days off and I will use this time to rewrite our RoR (Ruby on Rails) Application in a python web framework just for fun ;-] (and why not make the switch, RoR is great but keep changing all the time, can be exhausting.) I don't know the python web framework very well, I've glad web.py, django, cherry.py, pylons...
Python Web Framework for Small Team
0.039979
0
0
1,144
6,208,274
2011-06-01T22:02:00.000
2
1
0
1
python,crontab
6,208,294
1
true
0
0
They will be sent to the email address defined at the top of the crontab, or to the crontab's owner by default. See the crontab(5) man page for more details.
1
0
0
If I schedule print "Hello World!"; to run every hour with crontab, where will Hello World! be printed? Is there a log file? If I do it with Java or C instead of Python, will it make any difference? Thanks!
Where do scheduled python programs "print"?
1.2
0
0
109
6,208,385
2011-06-01T22:14:00.000
1
1
0
1
python,testing,automation,functional-testing,cots
6,208,551
1
true
0
0
Interesting problem. One thing to avoid is using the antivirus APIs to check to see if your application triggers them. You want a real live deployment of your application, on the expected operating system, with a real live AV install monitoring it. That way you'll trigger the heuristics monitoring as well as the simple...
1
5
0
My (rather small) company develops a popular Windows application, but one thing we've always struggled with is testing - it frequently is only tested by the developers on a system similar to the one they developed it on, and when an update is pushed out to customers, there is a segment of our base that experiences issu...
How can I automate antivirus/WSUS patch testing of my Windows driver and binary?
1.2
0
0
1,381
6,208,476
2011-06-01T22:27:00.000
0
0
1
0
python,function,module,matrix,return
6,208,763
1
false
0
0
As Graeme said, it doesn't return anything. When you import it, the function gets compiled at the time of importation. Does your module define a and then run matrixdets on it? It will do that even when you import the function from a module, since importing a module executes all the code inside it. You need to be clear...
1
0
0
def matrixdets(a): x=(a[0][0] * a[1][1] * a[2][2]) + \ (a[0][1] * a[1][2] * a[2][0]) + \ (a[0][2] * a[1][0] * a[2][1]) print(x) I wrote this code to find a certain value of a matrix. It returns a number when I type the function in python. However, when i import this as a module, it just returns the...
Why does importing as modules and writing creates a different result?
0
0
0
58
6,208,922
2011-06-01T23:34:00.000
2
1
0
1
python,svn,windows-7,credentials,jenkins
6,209,784
1
true
0
0
Create a new Jenkins job, and use Subversion as the revision control system. Put in the URL of the Subversion repository you want to manipulate in your Python script. Under the URL will appear a link to let you set the login. Click the link and log in. Once you're done, you can delete the job. The whole purpose was to ...
1
4
0
I have Jenkins running a python script that makes some SVN calls, my problem is that Jenkins tries to run this script as SYSTEM user which doesn't seem to have permission to access the SVN. It prompts me for a password for 'SYSTEM' upon my svn call. If I run the python script by itself, I have no problems accessing the...
SVN having credential problems with Jenkins running as SYSTEM
1.2
0
0
1,833
6,211,868
2011-06-02T07:50:00.000
0
0
0
0
python,django,multiprocessing
6,213,293
3
true
1
0
Andrey Fedoseev gave a great suggestion, but let me come up with a more general solution. You can create some WaitingTasks model into which where your view puts new tasks. Then, there can use any method to process those waiting tasks - cronjob, upstart daemon, whatever - writing back progress and result. (In fact cele...
1
1
0
I would like to do something similar: f(n) calculates n! , this obviously takes a long time to do, so the calculations need to run in a separate process from the django view. Additionally I would like the view to return a response immediately (ex. progress 0% ) and subsequent polling needs to update progress, so the v...
Django view and separate processes
1.2
0
0
488
6,213,869
2011-06-02T11:24:00.000
3
0
0
0
python,debugging,numpy,scipy,nan
6,213,966
2
false
0
0
You can use numpy.seterr to set floating point error handling behaviour globally for all numpy routines. That should let you pinpoint where in the code they are arising from (or a least where numpy see them for the first time).
1
9
1
I have a moderately large piece (a few thousand lines) of Python/Numpy/Scipy code that is throwing up NaNs with certain inputs. I've looked for, and found, some of the usual suspects (log(0) and the like), but none of the obvious ones seem to be the culprits in this case. Is there a relatively painless way (i.e., apar...
Finding the calculation that generates a NaN
0.291313
0
0
1,232
6,215,324
2011-06-02T13:41:00.000
7
0
0
1
python,linux,file
6,215,475
4
false
0
0
Typically on Linux, unless you're using locking of some kind, two processes can quite happily have the same file open at once, even for writing. There are three ways of avoiding problems with this: Locking By having the writer apply a lock to the file, it is possible to prevent the reader from reading the file partial...
4
4
0
I am writing a script that will be polling a directory looking for new files. In this scenario, is it necessary to do some sort of error checking to make sure the files are completely written prior to accessing them? I don't want to work with a file before it has been written completely to disk, but because the info...
Will Python open a file before it's finished writing?
1
0
0
2,987
6,215,324
2011-06-02T13:41:00.000
0
0
0
1
python,linux,file
6,229,831
4
false
0
0
Yes it will. I prefer the "file naming convention" and renaming solution described by Donal.
4
4
0
I am writing a script that will be polling a directory looking for new files. In this scenario, is it necessary to do some sort of error checking to make sure the files are completely written prior to accessing them? I don't want to work with a file before it has been written completely to disk, but because the info...
Will Python open a file before it's finished writing?
0
0
0
2,987
6,215,324
2011-06-02T13:41:00.000
4
0
0
1
python,linux,file
6,215,361
4
true
0
0
On Unix, unless the writing application goes out of its way, the file won't be locked and you'll be able to read from it. The reader will, of course, have to be prepared to deal with an incomplete file (bearing in mind that there may be I/O buffering happening on the writer's side). If that's a non-starter, you'll have...
4
4
0
I am writing a script that will be polling a directory looking for new files. In this scenario, is it necessary to do some sort of error checking to make sure the files are completely written prior to accessing them? I don't want to work with a file before it has been written completely to disk, but because the info...
Will Python open a file before it's finished writing?
1.2
0
0
2,987
6,215,324
2011-06-02T13:41:00.000
0
0
0
1
python,linux,file
6,215,461
4
false
0
0
If you have some control over the writing program, have it write the file somewhere else (like the /tmp directory) and then when it's done move it to the directory being watched. If you don't have control of the program doing the writing (and by 'control' I mean 'edit the source code'), you probably won't be able to m...
4
4
0
I am writing a script that will be polling a directory looking for new files. In this scenario, is it necessary to do some sort of error checking to make sure the files are completely written prior to accessing them? I don't want to work with a file before it has been written completely to disk, but because the info...
Will Python open a file before it's finished writing?
0
0
0
2,987
6,215,690
2011-06-02T14:11:00.000
0
0
0
0
python,multithreading,timer,pyqt4,event-loop
6,218,924
3
false
0
1
I haven't used Qt before, so I might be wrong on this, but I imagine you could bind your on_start() method to the ApplicationActivate event, and set a flag from inside your on_start() method so that the code would only be run that very first time and not any other times the ApplicationActivate event is triggered during...
1
4
0
I would like to execute a method which can only be called once my QApplication is displayed, i.e. when it has entered its main event loop exec_(). I'm new to Qt4 (using PyQt4): i was hoping to have a on_start()-like callback, but didn't find one. Do i need to create a thread or a timer? Or is there some callback includ...
How to execute a method automatically after entering Qt event loop?
0
0
0
4,716
6,215,808
2011-06-02T14:21:00.000
3
0
0
0
python,urllib2,beautifulsoup
6,216,054
1
true
1
0
BeautifulSoup is for parsing html once you've already fetched it. You can fetch the html using any standard url fetching library. I prefer curl, as you tagged your post, python's built-in urllib2 also works well. If you're saying that after logging in the response html is the same as for those who are not logged in, ...
1
0
0
i have to retrieve some text from a website called morningstar.com . To access that data i have to log in. Once i log in and provide the url of the web page , i get the HTML text of a normal user (not logged in).As a result am not able to accees that information . ANy solutions ?
How to extract text from a web page that requires logging in using python and beautiful soup?
1.2
0
1
563
6,216,278
2011-06-02T14:58:00.000
1
0
1
0
python,excel
6,220,700
2
false
0
0
While Excel itself doesnot support other scripting Langauges than VBA, the open source OpenOffice and LibreOffice packages - which include a spreadsheet - can be scriptable with Python. Still, they won't allow Python code to be pasted on teh cells out of the box - but it is possible to write Python code which can act o...
1
2
0
I'd like to be able to include python code snippets in Excel (ideally, in a nice format -- all colors/formats should be kept the same). What would be the best way to go about it? EDIT: I just want to store python code in an Excel spreadsheet for an easy overview -- I am not going to run it -- just want it to be nicely ...
Include Python Code In Excel?
0.099668
1
0
486
6,216,890
2011-06-02T15:47:00.000
0
1
0
0
python,android,iphone,beeware
6,217,111
4
false
1
1
phonegap is one of the way that you can use to target the iphone & android.through the javascript,html.
1
3
0
I want to develop an application targeting both android and iphone. I guess they use Java and Objective-C. Can I use single language like Python? Is it the best route? Will I lose performance, features, etc. by using Python. Are there any limitations that I will run into?
target both android and iphone with Python
0
0
0
1,256
6,217,545
2011-06-02T16:49:00.000
1
1
0
1
.net,mono,ironpython
6,218,295
2
true
0
0
You could use System.AppDomain.CurrentDomain.GetAssemblies() (assuming you don't use AppDomain isolation, of course) and see if that contains an assembly that would only be preset when your application is running.
1
0
0
I have a ipy script that can be called either from an embedded console in a larger application or directly from the command line and I'm looking for a quick way to determine at run time which has occurred without having to pass an argument to differentiate the events. Additionally the script has to run on both mono/li...
How to detect in Iron Python what the script is being called from?
1.2
0
0
112
6,219,063
2011-06-02T18:59:00.000
2
0
0
0
python,mobile
6,219,095
3
false
1
0
You can use the time module and the sleep function.
1
2
0
I am writing a program that upload files from my nokia cell phone files to the web server which I am already done writing that. But, my program only does his job only one time and what I want is that I want to call that function for let's say every 5 mins again and again which I do not know how to do it.
Repeating function over certain amount of time
0.132549
0
0
244
6,220,274
2011-06-02T20:54:00.000
3
0
1
1
python,module
6,220,717
3
false
0
0
If you're installing through setuptools (ie python setup.py), it will install to the lib directory for the python executable you use (unless it's a broken package).
1
8
0
I have a couple different versions of Python installed on my Mac. The default version is 2.5, so when I install a module it gets installed to 2.5. I need to be able to install some modules to a different version of Python because I am working on projects that use different versions. Any one know how to accomplish this?...
Install python module to non default version of python on Mac
0.197375
0
0
4,874
6,220,619
2011-06-02T21:30:00.000
3
0
1
0
python
6,221,014
7
false
0
0
You can't stop the user from touching data. If they're running a program on their system, they can do whatever they want with the bits after you write them to disk. You can obfuscate the data in various ways, possibly even encrypting it, but they can still, eventually get to it if they're determined. If you want pro...
3
0
0
I need help storing data within a python program. I don't want the user to be able to touch the data at all. I've looked into pickle but many posts say it is "insecure".
Storing data in python
0.085505
0
0
1,065
6,220,619
2011-06-02T21:30:00.000
1
0
1
0
python
6,221,213
7
false
0
0
If the user will be running your program on his machine you just can't hide the data. The user running the program can access everything the program can, is just a matter of knowing where to look. If you are dealing with end-users then just encrypt the data and decrypt it at the last point before using it. Just keep in...
3
0
0
I need help storing data within a python program. I don't want the user to be able to touch the data at all. I've looked into pickle but many posts say it is "insecure".
Storing data in python
0.028564
0
0
1,065
6,220,619
2011-06-02T21:30:00.000
2
0
1
0
python
6,226,590
7
false
0
0
You can try to stop the program from running if it's been tampered with, for example by comparing its (md5) hash to a known good value. Check out the Chrome OS project for an example of a system which does roughly this. You can try to stop the user from understanding your program and data written to the disk, for examp...
3
0
0
I need help storing data within a python program. I don't want the user to be able to touch the data at all. I've looked into pickle but many posts say it is "insecure".
Storing data in python
0.057081
0
0
1,065
6,221,196
2011-06-02T22:40:00.000
0
0
1
0
python,image,data-structures,mp3,byte
6,221,233
2
false
0
0
Either the image has headers (which you could read with something like exiftool), or the image does not have headers, in which case you can get the size and color depth from the specification, either of the container tag for mp3, or from the standard for the graphic. Most bitmaps nowadays are 24bit color.
1
1
0
^ As above. Is this possible? I'm using a library to get image data from an mp3 and it returns the data as a byte string but to display the image I need to get the resolution and color depth. Ideally I would prefer a library written in Python without dependencies so as to make my app as portable as possible. If it's ...
How do I get the color depth and/or the resolution from a byte string in Python?
0
0
0
1,955
6,221,533
2011-06-02T23:32:00.000
3
0
1
0
python,callable
6,221,593
1
true
0
1
The third PyObject* is the kwargs. Write a wrapper that just... doesn't pass them. Raising TypeError if it contains anything is optional.
1
0
0
I am binding C++ classes to Python and have come to an interesting solution to a previous problem, unfortunately this has lead to another question that there seems to be no easy answer too. I am wrapping each function into a "callable" PyObject, what makes it callable is having the call function define (C side this i...
What is the exact requirement for defining a python tp_call function?
1.2
0
0
390
6,222,381
2011-06-03T02:22:00.000
8
0
1
0
python,database,sqlalchemy,pyramid
6,224,703
4
true
0
0
Well conceptually you can store a list as a bunch of rows in a table using a one-to-many relation, or you can focus on how to store a list in a particular database backend. For example postgres can store an array in a particular cell using the sqlalchemy.dialects.postgres.ARRAY data type which can serialize a python ar...
3
6
0
What would be the best way of storing a python list of numbers (such as [4, 7, 10, 39, 91]) to a database? I am using the Pyramid framework with SQLAlchemy to communicate to a database. Thanks!
The best way to store a python list to a database?
1.2
1
0
15,473
6,222,381
2011-06-03T02:22:00.000
0
0
1
0
python,database,sqlalchemy,pyramid
40,277,177
4
false
0
0
sqlalchemy.types.PickleType can store list
3
6
0
What would be the best way of storing a python list of numbers (such as [4, 7, 10, 39, 91]) to a database? I am using the Pyramid framework with SQLAlchemy to communicate to a database. Thanks!
The best way to store a python list to a database?
0
1
0
15,473
6,222,381
2011-06-03T02:22:00.000
0
0
1
0
python,database,sqlalchemy,pyramid
6,224,600
4
false
0
0
Use string(Varchar). From Zen of Python: "Simple is better than complex."
3
6
0
What would be the best way of storing a python list of numbers (such as [4, 7, 10, 39, 91]) to a database? I am using the Pyramid framework with SQLAlchemy to communicate to a database. Thanks!
The best way to store a python list to a database?
0
1
0
15,473
6,222,605
2011-06-03T03:15:00.000
2
0
1
0
python,ruby,format
6,222,617
3
false
0
0
I'd assume they use % because that's what the old C printf format strings looked like.
2
0
0
I mean what makes % look so much attractive compared to good old .format?! I know this may be subjective, but I wonder if there is something about this.
Why do Ruby and Python have the % for formatting instead of "format"
0.132549
0
0
199
6,222,605
2011-06-03T03:15:00.000
0
0
1
0
python,ruby,format
6,226,321
3
false
0
0
It's just a piece of syntactic sugar, meant to make a common operation more terse. If you don't like it, you can use str.format() instead. I enjoy it because it makes printf()-style formatting stand out in the code.
2
0
0
I mean what makes % look so much attractive compared to good old .format?! I know this may be subjective, but I wonder if there is something about this.
Why do Ruby and Python have the % for formatting instead of "format"
0
0
0
199
6,223,426
2011-06-03T05:46:00.000
7
0
1
1
python,dependencies,backup
6,223,955
2
false
0
0
If you have installed the packages with pip (an improved easy_install), you can just do pip freeze > my-reqs.txt to get a list and versions of the installed packages. There is also some option to install using the reqs file, which I can not remember right now. Pip is meant to companion virtualenv, which can be used to ...
1
5
0
i have installed many python modules plugins and libraries in my centos system. Now i don't want to install each thing again on separate computers. Is there any way i can make the package like rpm or any other thing so that when i install in in new location all the modules, dependencies also gets installed and everytim...
How to backup python dependencies or modules already installed
1
0
0
7,121
6,224,052
2011-06-03T07:06:00.000
0
0
1
0
python,string,character,byte
68,204,447
9
false
0
0
Putting it simple, think of our natural languages like - English, Bengali, Chinese, etc. While talking, all of these languages make sound. But do we understand all of them even if we hear them? - The answer is generally no. So, if I say I understand English, it means that I know how those sounds are encoded to some mea...
2
323
0
I am working with a library which returns a byte string and I need to convert this to a string. Although I'm not sure what the difference is - if any.
What is the difference between a string and a byte string?
0
0
0
214,782
6,224,052
2011-06-03T07:06:00.000
0
0
1
0
python,string,character,byte
69,373,753
9
false
0
0
A string is a bunch of items strung together. A byte string is a sequence of bytes, like b'\xce\xb1\xce\xac' which represents "αά". A character string is a bunch of characters, like "αά". Synonymous to a sequence. A byte string can be directly stored to the disk directly, while a string (character string) cannot be dir...
2
323
0
I am working with a library which returns a byte string and I need to convert this to a string. Although I'm not sure what the difference is - if any.
What is the difference between a string and a byte string?
0
0
0
214,782
6,224,228
2011-06-03T07:29:00.000
7
0
1
1
python,dependencies,development-environment
6,224,291
1
true
0
0
Installing Python from source installs the development files in the same prefix.
1
5
0
I have python 2.7 installed in /opt/python2.7. Now i want to install the devel packages for it but could not find it. How can i install it os that goes in python2.7 not for default python2.4
How to install Python 2.7 devel if I have Python 2.7 in a different directory
1.2
0
0
3,612
6,225,631
2011-06-03T10:04:00.000
0
0
1
1
python,installation,windows-installer
6,226,348
1
false
0
0
A solution would be temporary files. You can store them in Binary table and use two custom actions: one which extracts them before the installation starts another one which removes them when installation is finished You can extract them in a temporary location, for example the user Temp folder.
1
0
0
I am creating an python based msi installer. by which I am executing some python scripts while the installer is running. But I dont want to deliver/install these scripts with package just want to hide them in the msi and use while its running. I tried using binary table in the msi for the same but it didn't work. >H...
hide scripts in msi installer
0
0
0
188
6,227,589
2011-06-03T13:18:00.000
1
0
0
0
python,pca
6,229,101
2
false
0
0
What Sven mentioned in his comments is correct. There is no "default" ordering of the eigenvalues. Each eigenvalue is associated with an eigenvector, and it is important is that the eigenvalue-eigenvector pair is matched correctly. You'll find that all languages and packages will do so. So if R gives you eigenvalues [...
1
1
1
I am now trying some stuff with PCA but it's very important for me to know which are the features responsible for each eigenvalue. numpy.linalg.eig gives us the diagonal matrix already sorted but I wanted this matrix with them at the original positions. Does anybody know how I can make it?
Non sorted eigenvalues for finding features in Python
0.099668
0
0
1,121