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
2,889,561
2010-05-22T19:55:00.000
0
0
0
0
python,flash,firefox,bash,browser
2,889,576
2
false
0
0
i think this might do it if you put it in the initialization part: Stage["displayState"]="fullScreen";
1
0
0
I have a swf file (a flash game). I want to run some script to open it in full-screen mode. I'm not attached to any browser, but I do run Linux, so a bash, or generic answer is what I'm looking for. I'm also open to building a lite browser application if need-be.
Launch an SWF full screen
0
0
0
990
2,890,564
2010-05-23T03:10:00.000
1
0
0
0
python,matplotlib,sqlalchemy
2,891,001
1
true
0
0
It looks like matplotlib takes simple python data types -- lists of numbers, etc, so you'll be need to write custom code to massage what you pull out of mysql/sqlalchemy for input into the graphing functions...
1
1
0
After running a bunch of simulations I'm going to be outputting the results into a table created using SQLAlchemy. I plan to use this data to generate statistics - mean and variance being key. These, in turn, will be used to generate some graphs - histograms/line graphs, pie-charts and box-and-whisker plots specificall...
How to generate graphs and statistics from SQLAlchemy tables?
1.2
1
0
1,415
2,891,017
2010-05-23T07:56:00.000
3
1
0
0
java,php,python,ruby-on-rails,django
2,891,024
2
true
1
0
If you only know PHP and you don't feel like learning Ruby/Python/Java. Seriously, if it can be done better with another tool, it should be done with another tool. Of course, this assumes the other tools are actually better. That part is arguable. Some people are so stuck up on their "my way is the best way" that they ...
1
1
0
We have discussion in my job place about question (We use 1 of the php frameworks): Why program with php frameworks big web application if it can be done better with ruby on rails, python or java? Please say our opinion thanks
Why program with php frameworks if it can be done better with ruby on rails, python or java?
1.2
0
0
240
2,891,493
2010-05-23T11:22:00.000
0
0
1
0
python,dll,shared-libraries,ctypes
27,273,719
8
false
0
0
Internally ctypes uses functions provided by dynamic link library (dlopen/dlsym on unix, LoadLibrary/GetProcAddress on windows) to load library and find address of function specified by function name; and then use cffi library to pass parameter dynamically. Problem is that the dynamic link library that ctypes depends ...
1
45
0
Is there any way to know which functions are exported from the dll through python foreign function library ctypes? And if possible to know details about the exported functions through ctypes. If yes, could someone provide a snippet of code?
list exported functions from dll with ctypes
0
0
0
48,922
2,892,746
2010-05-23T17:44:00.000
-2
0
1
0
python,generator,pdb
2,892,917
2
false
0
0
In debuggers, generally you want to "step" (s) into a function in this case, rather than "next" (n). "Next" executes the next line in the scope you're looking at; "step" brings you into the next scope down, the generator in this case, which sounds like what you want to do.
1
5
0
When in the Python debugger (pdb) I want to step over a yield statement, but hitting (n) for next brings me to the destination of the yield i.e. the consumer of the generator. I want to go to the next line that is executed within the generator. Is there any way to do this? I'm using Python 2.6
Stepping over a yield statement
-0.197375
0
0
1,343
2,893,033
2010-05-23T19:06:00.000
4
0
0
1
python,linux,centos
2,893,047
1
true
0
0
What's dns.__file__ in the first case? I suspect it's not coming from the directory you cded into the second time (the current directory when you start Python goes at the front of sys.path) but rather from a package containing that crucial resolver module which the second one appears to be lacking.
1
2
0
Very strange for me: # uname -a Linux localhost.localdomain 2.6.18-194.3.1.el5 #1 SMP Thu May 13 13:09:10 EDT 2010 i686 i686 i386 GNU/Linux # pwd /root # python Python 2.6.5 (r265:79063, Apr 11 2010, 22:34:44) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type "help", "copyright", "credits" or "license" for more i...
Python modules import error
1.2
0
0
2,669
2,893,313
2010-05-23T20:29:00.000
7
1
1
0
python,scheme,code-translation
2,893,338
5
false
0
0
I would treat the original language implementation almost like a requirements specification, and write up a design based on it (most importantly including detailed interface definitions, both for the external interfaces and for those between modules within the library). Then I would implement from that design. What I ...
3
5
0
Reasoning: I'm trying to convert a large library from Scheme to Python Are there any good strategies for doing this kind of conversion? Specifically cross-paradigm in this case since Python is more OO and Scheme is Functional. Totally subjective so I'm making it community wiki
Advice on translating code from very unrelated languages (in this case Scheme to Python)?
1
0
0
193
2,893,313
2010-05-23T20:29:00.000
0
1
1
0
python,scheme,code-translation
2,893,602
5
false
0
0
If you don't have time to do as the others have suggested and actually re-implement the functionality, there is no reason you CAN'T implement it in a strictly functional fashion. Python supports the key features necessary to do functional programming, and you might find that your time was better spent doing other thing...
3
5
0
Reasoning: I'm trying to convert a large library from Scheme to Python Are there any good strategies for doing this kind of conversion? Specifically cross-paradigm in this case since Python is more OO and Scheme is Functional. Totally subjective so I'm making it community wiki
Advice on translating code from very unrelated languages (in this case Scheme to Python)?
0
0
0
193
2,893,313
2010-05-23T20:29:00.000
1
1
1
0
python,scheme,code-translation
2,893,563
5
false
0
0
I would setup a bunch of whiteboards and write out the algorithms from the Scheme code. Then I would implement the algorithms in Python. Then, as @PaulHankin suggests, use the Scheme code as a way to write test cases to test the Python code
3
5
0
Reasoning: I'm trying to convert a large library from Scheme to Python Are there any good strategies for doing this kind of conversion? Specifically cross-paradigm in this case since Python is more OO and Scheme is Functional. Totally subjective so I'm making it community wiki
Advice on translating code from very unrelated languages (in this case Scheme to Python)?
0.039979
0
0
193
2,893,686
2010-05-23T22:09:00.000
9
0
1
0
python
2,893,714
3
false
0
0
Python bytecode requires Python to run, cannot be ran standalone without Python, and is specific to a particular x.y release of Python. It should be portable across platforms for the same version. There is not a common reason for you to use it; Python uses it to optimize out parsing of your .py file on repeated imports...
1
14
0
I want to know what a pyc file(python bytecode) is. I want to know all the details. I want to know about how pyc files interface with the compiler. Is it a replacement for exe? Does it need to be run by python? Is it as portable as the .py file is? Where should I use this?
Where to use a pyc file
1
0
0
9,508
2,894,235
2010-05-24T01:07:00.000
0
0
1
0
python,import,modular
2,896,137
5
false
0
0
Alex's answer and the others cover the general case. However, since these modules you're working on are your own and you'll edit only them, it's possible to implement some kind of a local reloading mechanism rather than rely on the builtin reload. You can architect your module loader as something that loads up the fil...
1
2
0
scenario: a modular app that loads .py modules on the fly as it works. programmer (me) wishes to edit the code of a module and then re-load it into the program without halting execution. can this be done? i have tried running import a second time on an updated module.py, but the changes are not picked up
how do i edit a running python program?
0
0
0
325
2,894,344
2010-05-24T01:41:00.000
0
0
0
0
python,django,macos
2,901,051
2
false
1
0
Okay, so this is very bizarre and I don't know what happened... but here's what fixed: I open terminal and bash isn't recognizing any commands (python, vi, etc) I restart machine, still not recognizing any commands I look at my $PATH and /usr/bin is missing I add /usr/bin to $PATH I open vi and modify my profi...
1
1
0
I've been developing a Django app for weeks locally on OSX 10.6.3. Recently, I rebooted my machine and went to start my development environment up. Here's the error: cm:myApp cm$ python manage.py runserver Traceback (most recent call last): File "manage.py", line 11, in execute_manager(settings) File "/Libr...
manage.py runserver throws an ImportError with my appname, MacPorts issue on OSX?
0
0
0
2,460
2,894,802
2010-05-24T04:53:00.000
3
0
0
0
python,django,django-registration
17,230,981
4
false
1
0
EMAIL_PORT = 465 was working some year ago. Now you need to use port 587 with gmail. Reason: Django does not support SMTP with SSL from the beginning. Only STARTTLS command is supported AFTER plain-text connection is set up. Gmail, however, no longer supports this option on port 465.
2
8
0
I am curious if there's a way to send activated email with username, password by using django-registration. First I thought about modifying registration form but I need some example.
send activate-email with django-registration
0.148885
0
0
11,049
2,894,802
2010-05-24T04:53:00.000
2
0
0
0
python,django,django-registration
31,984,785
4
false
1
0
Hope this will help someone. After troubleshooting for half an hour, I realised that I had to explicitly state this as well while using django-registration - EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
2
8
0
I am curious if there's a way to send activated email with username, password by using django-registration. First I thought about modifying registration form but I need some example.
send activate-email with django-registration
0.099668
0
0
11,049
2,894,914
2010-05-24T05:26:00.000
0
0
0
0
python,django,apache
2,894,962
4
false
1
0
apache has a server setting for max file size..(also dont forget max post size). I do not believe apache can show an error page on its own, you can probably use python for that. unfortunetly I know nothing obout python (yet) so I can't really help you beyond that. I know php can do that easily so I'm sure there is a ...
1
1
0
How to restrict the size of file being uploaded. I am using django 1.1 with apache. Can I use apache for this and show some html error page if say size is bigger then 100MB. Thanks.
How to restrict the size of file being uploaded apache + django
0
0
0
4,866
2,895,187
2010-05-24T06:36:00.000
0
1
0
0
python,inotify,pyinotify
22,093,028
3
false
0
0
Why don't you add a dummy file at the end of the transfer? You can use the IN_CLOSE or IN_CREATE event code on the dummy. The important thing is that the dummy as to be transfered as the last file in the sequence. I hope it'll help.
1
4
0
for large files or slow connections, copying files may take some time. using pyinotify, i have been watching for the IN_CREATE event code. but this seems to occur at the start of a file transfer. i need to know when a file is completely copied - it aint much use if it's only half there. when a file transfer is finished...
which inotify event signals the completion of a large file operation?
0
0
0
4,934
2,895,397
2010-05-24T07:22:00.000
2
0
0
1
python,google-app-engine
2,940,702
2
false
1
0
If your administrator is an Apps for Domains account (eg, @yourdomain.com), and your app uses Google Accounts authentication, you won't be able to authenticate as an admin on your app. You need to add a Google Accounts (eg, @google.com) account as an administrator, and use that to upload.
1
3
0
I am using appcfg.py to upload data to datastore from a csv file. But every time I try, I am getting error: [info ] Authentication failed even if i am using Admin id and password. In my app.yaml file I am having: handlers: - url: /remote_api script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py log...
Google App Engine appcfg.py data_upload Authentication fail
0.197375
0
0
1,823
2,896,490
2010-05-24T11:11:00.000
4
0
0
0
python,django,admin,overriding
3,166,408
3
true
1
0
You can use template hierarchy like: index.html ... {% block content %} ... {% block mycontent %}My custom text{% endblock %} ... {% endblock %} app_index.html ... {% block mycontent %}{% endblock %} ..
1
3
0
I'm trying to add features to Django 1.2 admin's main page. I've been playing with index.html, but features added to this page affect all app pages. Any ideas on what template I'm supposed to use? Thanks loads!!
Overriding Django Admin's main page? - Django
1.2
0
0
8,486
2,898,685
2010-05-24T16:58:00.000
3
0
1
0
python,salt,sha,hashlib,saltedhash
15,399,755
6
false
0
0
use passlib, writing your own password crypto is an almost sure way to failure.
1
45
0
I have been looking through ths hashlib documentation but haven't found anything talking about using salt when hashing data. Help would be great.
Hashing in SHA512 using a salt? - Python
0.099668
0
0
75,624
2,899,907
2010-05-24T20:03:00.000
2
0
0
0
python,browser,python-webbrowser
2,899,946
5
false
0
0
You need to use something that the current browsers support, this means you're stuck with Flash, Java applets or Javascript+HTML if you want your game displayed in a browser. You can use python on the backend and display pure HTML, if that is enough for your needs.
3
12
0
is it possible to use python to create flash like browser games? (Actually I want to use it for an economic simulation, but it amounts to the same as a browser game) Davoud
Can I use python to create flash like browser games?
0.07983
0
0
32,924
2,899,907
2010-05-24T20:03:00.000
1
0
0
0
python,browser,python-webbrowser
2,899,951
5
false
0
0
Yes, but there a a number of ways to get there. Flash is the client side rendering. You could use Python to generate Flash, or you could use Python to generate some dynamic HTML with Javascript, etc. that was interactive in a similar way. But the Python will be running on the server. The Flash, ActionScript, HTML, Ja...
3
12
0
is it possible to use python to create flash like browser games? (Actually I want to use it for an economic simulation, but it amounts to the same as a browser game) Davoud
Can I use python to create flash like browser games?
0.039979
0
0
32,924
2,899,907
2010-05-24T20:03:00.000
1
0
0
0
python,browser,python-webbrowser
2,899,983
5
false
0
0
You could have Python CGI code as a backend and send input in to it through AJAX. Its probably better just use something on the client side for this, though.
3
12
0
is it possible to use python to create flash like browser games? (Actually I want to use it for an economic simulation, but it amounts to the same as a browser game) Davoud
Can I use python to create flash like browser games?
0.039979
0
0
32,924
2,900,358
2010-05-24T21:11:00.000
3
0
1
0
python,matlab,mlabwrap
2,900,462
1
true
0
0
Never mind. I found out how. Use mlab.addpath().
1
2
0
I tried to use mlab.path(path,'/my/path') but failed. Got NameError: name 'path' is not defined in python. Anyone has an idea?
how to set MATLABPATH in Python and using mlabwrap?
1.2
0
0
408
2,901,082
2010-05-24T23:38:00.000
2
0
1
0
python,string,gettext,string-formatting
2,901,194
2
false
0
0
Don't have incorrectly spelled variable names - that's what testing is for. On the face of it, displaying something seems better than throwing an exception, but sooner or later one of those mistranslations is bound to cause offence to some user. .format() is the way to go these days. Reconsider passing locals() straigh...
2
2
0
Looking for best practice advice on what string substitution technique to use when using gettext(). Or do all techniques apply equally? I can think of at least 3 string techniques: 1) Classic "%" based formatting: "My name is %(name)s" % locals() 2) .format() based formatting: "My name is {name}".format( locals() ) 3) ...
Best practice for string substitution with gettext using Python
0.197375
0
0
2,170
2,901,082
2010-05-24T23:38:00.000
3
0
1
0
python,string,gettext,string-formatting
2,901,181
2
true
0
0
Actually I would prefer to get an exception during my tests, to fix the error as soon as possible -- "errors should not pass silently". So I consider that approach (2) is the best one in modern Python (which supports the readable and flexible format), and approach (1) a probably inevitable fall-back if you're stuck su...
2
2
0
Looking for best practice advice on what string substitution technique to use when using gettext(). Or do all techniques apply equally? I can think of at least 3 string techniques: 1) Classic "%" based formatting: "My name is %(name)s" % locals() 2) .format() based formatting: "My name is {name}".format( locals() ) 3) ...
Best practice for string substitution with gettext using Python
1.2
0
0
2,170
2,902,320
2010-05-25T05:51:00.000
5
0
0
1
python,twisted,m2crypto,pyopenssl
2,905,513
2
true
0
0
Neither pyOpenSSL nor M2Crypto exposes OpenSSL's DTLS features (as far as I know). So, the first step would be to extend one of these libraries to support it. After that, you could extend Twisted to use the new features you just added to the underlying SSL library.
1
2
0
How to implement dtls protocol using twisted with m2crypto (or pyopenssl)?
Twisted DTLS connection
1.2
0
0
1,465
2,903,507
2010-05-25T09:41:00.000
1
0
1
1
python,deployment
2,903,621
2
false
0
0
May be you should try to make your application running standalone with py2exe or pyInstaller. It will generate an application which doesn't expect anything from the target machine. You 'll have an exe file that the user can execute without knowing that Python is used. The Python interpreter and the needed libs will be ...
1
0
0
My application uses many Python libraries (Django, Twisted, xmlrpc). I cannot expect that the end user has the Python installed with all needed libraries. I've created a fancy installer for my application using Inno Setup, but I don't think that it is a good solution to execute 5 other setup programs from my installer...
installing Python application with Python under windows
0.099668
0
0
220
2,903,827
2010-05-25T10:36:00.000
1
0
1
0
java,python,exception
2,903,876
6
false
0
0
It's just naming. In Java, you have java.lang.Error distinct from other Throwables because those kinds of errors need to be unchecked. In Python, all exceptions are unchecked, so the distinction is kind of pointless.
3
85
0
Why are Python exceptions named "Error" (e.g. ZeroDivisionError, NameError, TypeError) and not "Exception" (e.g. ZeroDivisionException, NameException, TypeException). I come from a Java background and started to learn Python recently, as such this is confusing because in Java there is a distinction between errors and e...
Why are Python exceptions named "Error"?
0.033321
0
0
17,771
2,903,827
2010-05-25T10:36:00.000
100
0
1
0
java,python,exception
2,903,946
6
false
0
0
You don't name each class with 'Class' in name and each variable with '_variable' in name. The same way you don't name exception using the word 'Exception'. A name should say something about the meaning of an object. 'Error' is the meaning of most exceptions. Not all Exceptions are Errors. SystemExit, KeyboardInterrupt...
3
85
0
Why are Python exceptions named "Error" (e.g. ZeroDivisionError, NameError, TypeError) and not "Exception" (e.g. ZeroDivisionException, NameException, TypeException). I come from a Java background and started to learn Python recently, as such this is confusing because in Java there is a distinction between errors and e...
Why are Python exceptions named "Error"?
1
0
0
17,771
2,903,827
2010-05-25T10:36:00.000
9
0
1
0
java,python,exception
2,903,973
6
false
0
0
Python is fairly similar to Java in this respect. But Python's Exception should be compared to Java's Throwable. As Throwables come in all kinds of flavors - Error, RuntimeException and (checked) Exception - so do Python's (though no checked exceptions). As for the language, an Error is exceptional, so that inheritanc...
3
85
0
Why are Python exceptions named "Error" (e.g. ZeroDivisionError, NameError, TypeError) and not "Exception" (e.g. ZeroDivisionException, NameException, TypeException). I come from a Java background and started to learn Python recently, as such this is confusing because in Java there is a distinction between errors and e...
Why are Python exceptions named "Error"?
1
0
0
17,771
2,905,097
2010-05-25T13:35:00.000
0
0
0
0
python,postgresql
2,906,866
7
false
0
0
I agree with the SQL Alchemy suggestions or using Django's ORM. Your needs seem to simple for PL/Python to be used.
1
4
0
If you wanted to manipulate the data in a table in a postgresql database using some python (maybe running a little analysis on the result set using scipy) and then wanted to export that data back into another table in the same database, how would you go about the implementation? Is the only/best way to do this to simpl...
Python and Postgresql
0
1
0
1,582
2,905,948
2010-05-25T15:12:00.000
0
1
0
0
python,mako
2,946,762
2
true
1
0
I don't think you're likely to find such a thing. Like all the other fast python template engines, Mako achieves its speed by compiling your template into python code and then executing it. An exception will divert execution out of your template's code, so by the time one is raised, that template will have no way of ...
2
2
0
Is there a way to add tempate string which contains error to mako`s error trace?
Better error reporting mako
1.2
0
0
198
2,905,948
2010-05-25T15:12:00.000
0
1
0
0
python,mako
9,271,873
2
false
1
0
I was looking for another error I have and found this. I though it would be nice if you still ever need this, you can achieve it by setting mako.strict_undefined = True. I am using mako-0.6.2 so it may not been possible in the version back in 2010.
2
2
0
Is there a way to add tempate string which contains error to mako`s error trace?
Better error reporting mako
0
0
0
198
2,906,790
2010-05-25T17:12:00.000
0
0
0
0
python,django,session
2,907,043
3
false
1
0
You're not asking about sessions, you're asking about requests. What you want is known as throttling. However, it would be quite difficult to do it inside the app, because Apache manages multiple processes and threads, so you'd need some external process to keep track of these in order to enable the throttling. Basical...
1
2
0
How can I fix number of concurrent sessions allowed at app level? Basically I want a limit to how many concurrent requests to this url to keep the server from getting congested. I guess some middleware hack? Thanks.
way to fix number of concurrent sessions allowed at app level. django
0
0
0
201
2,907,087
2010-05-25T17:47:00.000
1
1
0
0
javascript,c++,python,scripting,embedding
5,080,151
5
false
0
0
Have a look at angelscript simple and easy to embed, c/c++ like syntax. free and corss-platform. u can get start in a few hrs.
2
4
0
I'm researching how to best extend a C++ application with scripting capability, and I am looking at either Python or JavaScript. User-defined scripts will need the ability to access the application's data model. Have any of you had experiences with embedding these scripting engines? What are some potential pitfalls...
Embedding a scripting engine in C++
0.039979
0
0
2,816
2,907,087
2010-05-25T17:47:00.000
7
1
0
0
javascript,c++,python,scripting,embedding
2,907,217
5
false
0
0
Lua is also a great candidate for embedding in programs. Its very self contained, and even the native cross-language call system isn't bad. For JavaScript, your best bet right now is to look at V8 (from Google), which is easy enough to work with.
2
4
0
I'm researching how to best extend a C++ application with scripting capability, and I am looking at either Python or JavaScript. User-defined scripts will need the ability to access the application's data model. Have any of you had experiences with embedding these scripting engines? What are some potential pitfalls...
Embedding a scripting engine in C++
1
0
0
2,816
2,907,498
2010-05-25T18:43:00.000
0
0
0
0
python,metaprogramming
2,907,750
5
false
1
0
SQLalchemy also uses them for declarative database models. Sorry my answer isn't very different from your example, but if you're looking for example code, I found declarative to be pretty readable.
1
13
0
I'm learning about metaclasses in Python. I think it is a very powerful technique, and I'm looking for good uses for them. I'd like some feedback of good useful real-world examples of using metaclasses. I'm not looking for example code on how to write a metaclass (there are plenty examples of useless metaclasses out th...
Good real-world uses of metaclasses (e.g. in Python)
0
0
0
2,053
2,907,864
2010-05-25T19:28:00.000
0
0
0
1
python,linux,shell,process
2,907,901
2
false
0
0
Writing to *argv will change it, but you'll need to do that from C or the like; I don't think Python is going to readily give you access to that memory directly. I'd also recommend just leaving it alone.
2
3
0
I'm using Python, for what it's worth, but will accept answers in any applicable language. I've tried writing to /proc/$pid/cmdline, but that's a readonly file. I've tried assigning a new string to sys.argv[0], but that has no perceptible impact. Are there any other possibilities? My program is executing processes via...
How do I rename a process on Linux?
0
0
0
4,944
2,907,864
2010-05-25T19:28:00.000
0
0
0
1
python,linux,shell,process
2,907,918
2
false
0
0
If you use subprocess.Popen instead of os.system you can use the executable argument to specify the path to the actual file to execute, and pass the name you want to show as the first item in the list that is parameter args.
2
3
0
I'm using Python, for what it's worth, but will accept answers in any applicable language. I've tried writing to /proc/$pid/cmdline, but that's a readonly file. I've tried assigning a new string to sys.argv[0], but that has no perceptible impact. Are there any other possibilities? My program is executing processes via...
How do I rename a process on Linux?
0
0
0
4,944
2,908,440
2010-05-25T20:52:00.000
0
0
0
0
python,lxml,celementtree
2,908,479
3
false
0
0
lxml is basically a superset of ElementTree so you could start with ElementTree and then if you have performance or functionality issues then you could change to lxml. Performance issues can only be studied by you using your own data,
1
4
0
I am going to handle XML files for a project. I had earlier decided to use lxml but after reading the requirements, I think ElemenTree would be better for my purpose. The XML files that have to be processed are: Small in size. Typically < 10 KB. No namespaces. Simple XML structure. Given the small XML size, memory...
Which Python XML library should I use?
0
0
1
372
2,909,423
2010-05-26T00:21:00.000
10
0
1
0
python,shell,performance,getattr
2,909,510
2
false
0
0
does getattr have the same problems as eval? No -- code using eval() is terribly annoying to maintain, and can have serious security problems. Calling getattr(x, "foo") is just another way to write x.foo. will I be taking a hit to the efficiency of my shell It will be imperceptibly slower if the command isn't found...
1
10
0
I'm creating a shell-like environment. My original method of handleing user input was to use a dictionary mapping commands (strings) to methods of various classes, making use of the fact that functions are first class objects in python. For flexibility's sake (mostly for parsing commands), I'm thinking of changing my s...
Is it bad practice to use python's getattr extensively?
1
0
0
6,796
2,909,605
2010-05-26T01:15:00.000
3
1
0
0
python,mp3,lame,mutagen
3,113,148
2
true
0
0
The transformations done by the MP3 encoding process drop completely the concept of “bit depth”. You can only know the bit depth of the source audio if such information was stored in a tag of the MP3 file. Otherwise, you can take the MP3 data and produce 8-bit, 16-bit or 24-bit audio.
1
1
0
Is there a way to determine an MP3 file's encoded bit depth (ie 8, 16, 24, 32) in Python using the Mutagen library?
Determine MP3 bit depth in Python via Mutagen
1.2
0
0
1,355
2,911,991
2010-05-26T10:16:00.000
1
0
0
0
python,pyqt4,qlistview
2,912,399
2
false
0
1
Imho, an easier way to achieve this would be to use a QListWidget instead of a QListView, this way you could use the itemClicked signal, which sends the selected item to the callback function.
1
1
0
I have a working QListView, but from the documentation, I can't figure out how to get a signal to fire with the index of the newly selected item. Any ideas?
clicked() signal for QListView in PyQt4
0.099668
0
0
3,622
2,912,216
2010-05-26T10:52:00.000
2
1
0
1
c#,python,ubuntu,mono
2,912,360
2
false
0
0
I cannot say much about the market for Ubuntu. And since business is your primary concern, the programming language is, as you say yourself, secondary. I would say that in any business, choose the language and tools that solves the business problem most effectively. When release comes do your end users really care? Tha...
1
2
0
I'm a c# programmer by trade and looking to move my wares over to Ubuntu as a business concern. I have some experience of Python and like it a lot. My question is, as a developer which would be the best language to use when targeting ubuntu Mono c# or python as a commercial concern. please note that I am not interested...
Which Language to target on Ubuntu?
0.197375
0
0
309
2,912,615
2010-05-26T11:48:00.000
-6
0
1
0
python,arguments
2,912,640
5
false
0
0
I would use sed s/None//g, but that's not in python, but you can probably use os.popen() to do that.
1
48
0
I have a Python function accepting several string arguments def foo(a, b, c): and concatenating them in a string. I want to iterate over all function arguments to check they are not None. How it can be done? Is there a quick way to convert None to ""? Thanks.
How to iterate over function arguments
-1
0
0
54,043
2,914,585
2010-05-26T15:52:00.000
0
0
1
1
python,windows,visual-studio,dll,ctypes
2,914,833
1
true
0
0
I can load LibName64 when I use the 64 bit version of python. Should have tried that earlier!
1
0
0
Disclaimer: I'm new to windows programming so some of my assumptions may be wrong. Please correct me if so. I am developing a python wrapper for a C API using ctypes. The API ships with both 64 and 32 DLLs/LIBs. I can succesfully load the DLL using ctypes.WinDLL('TheLibName') and call functions etc etc. However some fu...
ctypes DLL with optional dependencies
1.2
0
0
971
2,914,816
2010-05-26T16:17:00.000
0
0
0
0
python,wxpython,listctrl
2,915,460
2
false
0
1
Are you building on the wxPython demo code for virtual list controls? There are a couple of bookkeeping things you need to do, like set the ItemCount property. One comment about your OnGetItemText method: Since there's no other return statement, it will return None if data is None, so your test has no effect. How about...
2
2
0
I'm rewriting this post to clarify some things and provide a full class definition for the Virtual List I'm having trouble with. The class is defined like so: from wx import ListCtrl, LC_REPORT, LC_VIRTUAL, LC_HRULES, LC_VRULES, \ EVT_LIST_COL_CLICK, EVT_LIST_CACHE_HINT, EVT_LIST_COL_RIGHT_CLICK, \ ImageList, IMA...
wxPython ListCtrl Column Ignores Specific Fields
0
0
0
1,183
2,914,816
2010-05-26T16:17:00.000
0
0
0
0
python,wxpython,listctrl
2,954,639
2
true
0
1
There's a problem with the native object in Windows. If GetImg returns None instead of -1 the list has a problem with column 1 for some reason. That from Robin over on the Google Group post for this issue.
2
2
0
I'm rewriting this post to clarify some things and provide a full class definition for the Virtual List I'm having trouble with. The class is defined like so: from wx import ListCtrl, LC_REPORT, LC_VIRTUAL, LC_HRULES, LC_VRULES, \ EVT_LIST_COL_CLICK, EVT_LIST_CACHE_HINT, EVT_LIST_COL_RIGHT_CLICK, \ ImageList, IMA...
wxPython ListCtrl Column Ignores Specific Fields
1.2
0
0
1,183
2,915,945
2010-05-26T19:07:00.000
4
0
1
0
python,drag-and-drop,executable
2,915,964
1
true
0
0
The dropped file will be available as an element of sys.argv.
1
3
0
I have a Python script that takes the directory path of a text file and converts it into an excel file. Currently I have it running as a console application (compiled with py2exe) and prompts the user for the directory path through raw_input(). How do i make it such that I can drag & drop my text file directly into th...
Python - drag file into .exe to run script
1.2
0
0
1,610
2,916,052
2010-05-26T19:20:00.000
0
0
0
0
python,pyqt4
3,012,347
1
true
0
1
The answer was to reimplement the resizeEvent and check table.horizontalScrollBar().isVisible()
1
0
0
I have a window with 2 QTableWidgets, having their scrolling synchronized. The 1st one usually has horizontal scroll, while the 2nd usually (automatically) not. In order for them to show consistent data (row against row) I make the 2nd have the scroll (through property HorizontalScrollBar -> AlwaysOn). But sometimes th...
Track window/control resize in PyQt?
1.2
0
0
695
2,916,116
2010-05-26T19:30:00.000
1
0
1
0
python,argparse
2,916,155
3
false
0
0
It would be best for the user to install it so that only one copy is present on the system and so that it can be updated if there are any issues, but including it with your project is a viable option if you abide by all requirements specified in the license. Try to import it from the public location, and if that fails ...
1
2
0
For my project I would be using the argparse library. My question is, how do I distribute it with my project. I am asking this because of the technicalities and legalities involved. Do I just: Put the argparse.py file along with my project. That is, in the tar file for my project. Create a package for it for my distr...
Distributing a Python library (single file)
0.066568
0
0
228
2,916,769
2010-05-26T21:00:00.000
1
0
1
0
python,tiff
12,981,385
3
false
0
0
you can use the command utility "tiffutil"
1
7
0
I've found, via Google, numerous people asking the same question, but no solutions. The Python Image Library (PIL) has tools for stepping through an already existing multi-page TIFF, but nothing about creating them. Libraries would hopefully be available on Windows, for Python 2.6. If there's some freeware out there w...
How Can I Programmatically Build a Multi-Page TIFF out of Many Single Page TIFFs, Using Python?
0.066568
0
0
3,347
2,916,966
2010-05-26T21:30:00.000
2
0
0
0
python,django,middleware,django-middleware
33,104,799
9
false
1
0
You can use process_view method, that is called before calling the view func. In process_view you can check — if this view requires this middleware interception.
2
48
0
In Django there is a settings file that defines the middleware to be run on each request. This middleware setting is global. Is there a way to specify a set of middleware on a per-view basis? I want to have specific urls use a set of middleware different from the global set.
Non-global middleware in Django
0.044415
0
0
20,267
2,916,966
2010-05-26T21:30:00.000
1
0
0
0
python,django,middleware,django-middleware
18,391,612
9
false
1
0
The best thing I've been able to find is using if request.path_info.startswith('...') to skip over the middleware by just returning the request. Now, you could create middleware just for the sake of skipping and then inherit that. Maybe you could do something even simpler and save that list in your settings.py and then...
2
48
0
In Django there is a settings file that defines the middleware to be run on each request. This middleware setting is global. Is there a way to specify a set of middleware on a per-view basis? I want to have specific urls use a set of middleware different from the global set.
Non-global middleware in Django
0.022219
0
0
20,267
2,917,687
2010-05-27T00:03:00.000
2
0
0
0
python,django,fastcgi,django-urls
2,955,645
2
false
1
0
Django has a odd behaviour when matching urls in a environment that isn't under debug mode. For example, with DEBUG=False, Django will ignore urls such as: url(r'^', include('someapp.urls')), specifically in the case above, you could let the string empty: url(r'', include('someapp.urls')), In other words, c...
2
2
0
We recently launched a new Django-powered website, and we are experiencing the oddest bug: The site is running under Apache with mod_fastcgi. Everything works fine for a while, and then the URL tag and reverse() functionality stops working. Instead of returning the expected URL, they return "". We haven't noticed anyt...
Django URL resolving infrastructure stops working
0.197375
0
0
367
2,917,687
2010-05-27T00:03:00.000
7
0
0
0
python,django,fastcgi,django-urls
2,957,239
2
true
1
0
This has happened to me before. Normally it's due to a 'broken' urls.py file. There are two things that make this kind of bug really hard to fix: It could be the urls.py file in any of the apps that breaks the reverse() function, so knowing that reverse() breaks for app X doesn't mean the error is in that particular a...
2
2
0
We recently launched a new Django-powered website, and we are experiencing the oddest bug: The site is running under Apache with mod_fastcgi. Everything works fine for a while, and then the URL tag and reverse() functionality stops working. Instead of returning the expected URL, they return "". We haven't noticed anyt...
Django URL resolving infrastructure stops working
1.2
0
0
367
2,917,974
2010-05-27T01:42:00.000
16
0
1
0
python
2,917,989
8
false
0
0
How easy and convenient is python for scientific computing? Scipy/NumPy. Does it have a library of algorithms that compares to matlab's? Yes. Is Python a scripting language or does it compile? Interpreted. Is it a great language for prototyping an algorithm? Yes. How long would it take me to learn enough of it ...
4
5
0
My interests in programming lie mainly in algorithms, and lately I have seen many reputable researchers write a lot of their code in python. How easy and convenient is python for scientific computing? Does it have a library of algorithms that compares to matlab's? Is Python a scripting language or does it compile? Is i...
Is Python appropriate for algorithms focused on scientific computing?
1
0
0
1,053
2,917,974
2010-05-27T01:42:00.000
4
0
1
0
python
2,918,046
8
false
0
0
I've used Python for 6 years for scientific computing. Having come from matlab/IDL, it was very easy to do the switch since it's also interpreted. There are 3rd party tools such as SciPy and Matplotlib to help specifically with data analysis /visualization. Also, if you look in Amazon there are books targeting this au...
4
5
0
My interests in programming lie mainly in algorithms, and lately I have seen many reputable researchers write a lot of their code in python. How easy and convenient is python for scientific computing? Does it have a library of algorithms that compares to matlab's? Is Python a scripting language or does it compile? Is i...
Is Python appropriate for algorithms focused on scientific computing?
0.099668
0
0
1,053
2,917,974
2010-05-27T01:42:00.000
1
0
1
0
python
2,918,335
8
false
0
0
Is Python appropriate for algorithms focused on scientific computing? Yes
4
5
0
My interests in programming lie mainly in algorithms, and lately I have seen many reputable researchers write a lot of their code in python. How easy and convenient is python for scientific computing? Does it have a library of algorithms that compares to matlab's? Is Python a scripting language or does it compile? Is i...
Is Python appropriate for algorithms focused on scientific computing?
0.024995
0
0
1,053
2,917,974
2010-05-27T01:42:00.000
1
0
1
0
python
2,925,531
8
false
0
0
You asked about compiled/interpreted. If your concern here was execution speed, there is an aspect of python that doesn't seem to have been covered explicitly---you can use tools like SWIG and boost.python to make your lightning fast C/C++ packages appear in your python as modules. Once you get to the module, it will...
4
5
0
My interests in programming lie mainly in algorithms, and lately I have seen many reputable researchers write a lot of their code in python. How easy and convenient is python for scientific computing? Does it have a library of algorithms that compares to matlab's? Is Python a scripting language or does it compile? Is i...
Is Python appropriate for algorithms focused on scientific computing?
0.024995
0
0
1,053
2,918,010
2010-05-27T01:53:00.000
5
1
0
0
python,upload
2,918,021
2
false
1
0
No, that information isn't sent by the user, so it's not available on your end
1
0
0
Is it possible to get the full path of the file on the user's computer being uploaded to my site? Using os.path.abspath(fileitem.filename) simply gets me the address of where my script is executing from on my shared hosting server. FYI: fileitem = form['file'] and form = cgi.FieldStorage()
Get Path of Uploaded File using Python
0.462117
0
0
1,903
2,918,362
2010-05-27T03:56:00.000
0
0
1
0
python,newline
71,482,534
18
false
0
0
in order to suspport multiple operating systems use: file.write(f'some strings and/or {variable}. {os.linesep}')
1
365
0
I want to append a newline to my string every time I call file.write(). What's the easiest way to do this in Python?
Writing string to a file on a new line every time
0
0
0
984,695
2,918,445
2010-05-27T04:23:00.000
1
1
0
1
python,user-interface,open-source,monodevelop,glade
2,918,582
4
false
0
0
To access really low end computers, and if you have no real graphics requirements, you could consider a text mode interface - curses/ncurses for one.
1
3
0
My student group and I are trying to continue working on a project we worked on this semester over the summer to become a professional, deployable app. We originally did it in Adobe AIR but it seems now that the computers this program will be running on will be very slow, maybe 600mhz and 128-256mb ram so flash just is...
Making GUI applications on Linux/Windows. What languages/tools to use?
0.049958
0
0
1,292
2,918,572
2010-05-27T04:55:00.000
7
0
1
0
python,file-io
2,918,597
3
false
0
0
It's not that it adds a '\n' so much as that there's really one there. Use line = line.rstrip() to get the line sans newline (or something similar to it depending on exactly what you need). Don't use the readline method for reading a file line by line. Just use for line in f:. Files already iterate over their lines.
2
2
0
I am reading one line at a time from a file, but at the end of each line it adds a '\n'. Example: The file has: 094 234 hii but my input is: 094 234 hii\n I want to read line by line but I don't need to keep the newlines... My goal is to read a list from every line: I need ['094','234','hii'], not ['094','234','hii\...
problem with f.readline()?
1
0
0
868
2,918,572
2010-05-27T04:55:00.000
5
0
1
0
python,file-io
2,918,599
3
false
0
0
The \n is not added, it's part of the line that's being read. And when you do line.split() the traiing \n goes away anyway, so why are you worrying about it?!
2
2
0
I am reading one line at a time from a file, but at the end of each line it adds a '\n'. Example: The file has: 094 234 hii but my input is: 094 234 hii\n I want to read line by line but I don't need to keep the newlines... My goal is to read a list from every line: I need ['094','234','hii'], not ['094','234','hii\...
problem with f.readline()?
0.321513
0
0
868
2,920,619
2010-05-27T11:24:00.000
16
0
1
0
python,list,definition,sequence,slice
2,920,697
5
true
0
0
list are more than plain arrays. You can initialize them without giving the number of items. You can append/push to them, you can remove/pop/del items from them, you can have lists of different types of objects (e.g., [1,'e', [3]]), you can have recursive lists... and you can slice lists, which means getting a new list...
3
35
0
What are the differences between these built-in Python data types: list, sequence and slice? As I see it, all three essentially represent what C++ and Java call array.
Difference between list, sequence and slice in Python?
1.2
0
0
36,747
2,920,619
2010-05-27T11:24:00.000
2
0
1
0
python,list,definition,sequence,slice
2,920,691
5
false
0
0
Strictly speaking, a slice is a type which represents a range of indices, e.g. a start, stop, and a step. A slice isn't a container type at all. You can use a slice to index an list, resulting in a new list which is a copy of a sublist of the original list. Lists differ from C++ arrays in that they're heterogenous; the...
3
35
0
What are the differences between these built-in Python data types: list, sequence and slice? As I see it, all three essentially represent what C++ and Java call array.
Difference between list, sequence and slice in Python?
0.07983
0
0
36,747
2,920,619
2010-05-27T11:24:00.000
75
0
1
0
python,list,definition,sequence,slice
2,921,465
5
false
0
0
You're mixing very different things in your question, so I'll just answer a different question You are now asking about one of the most important interface in Python: iterable - it's basically anything you can use like for elem in iterable. iterable has three descendants: sequence, generator and mapping. A sequence is...
3
35
0
What are the differences between these built-in Python data types: list, sequence and slice? As I see it, all three essentially represent what C++ and Java call array.
Difference between list, sequence and slice in Python?
1
0
0
36,747
2,921,847
2010-05-27T14:10:00.000
22
0
1
0
python,syntax,parameter-passing,iterable-unpacking,argument-unpacking
2,921,872
5
false
0
0
In a function call the single star turns a list into seperate arguments (e.g. zip(*x) is the same as zip(x1,x2,x3) if x=[x1,x2,x3]) and the double star turns a dictionary into seperate keyword arguments (e.g. f(**k) is the same as f(x=my_x, y=my_y) if k = {'x':my_x, 'y':my_y}. In a function definition it's the other wa...
2
728
0
What does the * operator mean in Python, such as in code like zip(*x) or f(**k)? How is it handled internally in the interpreter? Does it affect performance at all? Is it fast or slow? When is it useful and when is it not? Should it be used in a function declaration or in a call?
What does the star and doublestar operator mean in a function call?
1
0
0
239,262
2,921,847
2010-05-27T14:10:00.000
52
0
1
0
python,syntax,parameter-passing,iterable-unpacking,argument-unpacking
2,923,051
5
false
0
0
One small point: these are not operators. Operators are used in expressions to create new values from existing values (1+2 becomes 3, for example. The * and ** here are part of the syntax of function declarations and calls.
2
728
0
What does the * operator mean in Python, such as in code like zip(*x) or f(**k)? How is it handled internally in the interpreter? Does it affect performance at all? Is it fast or slow? When is it useful and when is it not? Should it be used in a function declaration or in a call?
What does the star and doublestar operator mean in a function call?
1
0
0
239,262
2,922,548
2010-05-27T15:38:00.000
1
0
1
0
python,sockets,file-descriptor
2,922,605
2
false
0
0
Why do you want to load this into memory using mmap? If you are on a unix variant, you can create a unix socket which is a file descriptor which can be used just like any other socket. A socket and a memory-mapped file are two distinct entities - it is probably not a good idea to try and mix them. Perhaps it would be h...
1
0
0
I'm trying to manually create the file descriptor associated with a socket in python and then loaded directly into memory with mmap. Create a file into memory with mmap is simple, but I can not find a way to associate the file with a socket. Thanks for your responses. The problem I have is I can not make more of a num...
change file descriptor for socket in python
0.099668
0
1
2,393
2,924,231
2010-05-27T19:28:00.000
0
0
0
0
python,sqlite,browser
2,979,467
8
false
0
0
You question is a little broad. I'll try to cover as much as I can. First, what I understood and my assumptions. In your situation, the sqlite database is just a data store. Only one process (unless your application is multiprocess) will be accessing it so you won't need to worry about locking issues. The application ...
1
5
0
I am in the planning stages of rewriting an Access db I wrote several years ago in a full fledged program. I have very slight experience coding, but not enough to call myself a programmer by far. I'll definitely be learning as I go, so I'd like to keep everything as simple as possible. I've decided on Python and SQL...
Python/Sqlite program, write as browser app or desktop app?
0
1
0
5,638
2,924,736
2010-05-27T20:40:00.000
0
0
0
0
python,cgi
2,924,798
3
false
0
0
I guess the IP should be static so do you really need to look it up more than once? You need to specify the domain name so that the webserver knows which host configuration to use if you don't have a dedicated IP or your host is the default for that webserver
1
0
0
I have domain on a shared hosting provider. How do I find the direct IP address of my domain using Python? Is it possible to post to a script on my domain using the IP address and not the website itself? Thanks.
IP address of domain on shared host
0
0
1
725
2,924,781
2010-05-27T20:46:00.000
2
0
0
0
python,pyqt4,py2exe,qwebview
2,925,711
1
false
1
1
Only png support is native, jpg (and others) is supplied via plugins. Don't recall the exact paths (and I don't know your platform) but search for the PyQt plugins folder and: Copy the plugins folder to: $yourprogram/PyQt4/plugins (along with qt.conf) Edit qt.conf, and change prefix to $yourprogram/PyQt4 You might al...
1
1
0
I have an application that displays some HTML in a QWebview, which references images on the local file system. This works fine directly running the python. When compiling via py2exe, the images no longer load. Google doesn't seem to know the answer, any ideas?
Images not loading in QWebview in PyQt4 in py2exe
0.379949
0
0
1,402
2,925,230
2010-05-27T21:48:00.000
1
0
1
0
python,datetime,time,formatting
2,925,269
8
false
1
0
I know it's pretty cheap, but you could just discard the first character if it's a zero :)
1
29
0
I'm still a bit slow with Python, so I haven't got this figured out beyond what's obviously in the docs, etc. I've worked with Django a bit, where they've added some datetime formatting options via template tags, but in regular python code how can I get the 12-hour hour without a leading zero? Is there a straightforw...
Get "2:35pm" instead of "02:35PM" from Python date/time?
0.024995
0
0
13,086
2,926,106
2010-05-28T01:17:00.000
1
0
0
0
python,web-applications,temporary-files
2,926,124
2
false
0
0
Server-side web scripts have no access to the client other than through requests. If you can somehow break through the browser's protection settings to get JavaScript, Java, or Flash to read the contents of the client then you stand a fighting chance. But doing so will make many people angry and is generally considered...
1
0
0
I wanted to know if there was a way I can get my python script located on a shared web hosting provider to read the contents of a folder on my desktop and list out the contents? Can this be done using tempfiles?
Display folder contents on webpage using Python
0.099668
0
0
536
2,926,220
2010-05-28T01:56:00.000
0
1
0
0
python,streaming,webcam
2,926,268
3
false
1
0
Server-side web scripts have no access to the client other than through requests. You need to use JavaScript, Java, or Flash to access devices that the browser (and consequently user) allows them to.
2
2
0
Can a python script on my server access the webcam and audio input of a user as easily and as well as a Flash plugin can?
Python access webcam and audio input
0
0
0
2,165
2,926,220
2010-05-28T01:56:00.000
2
1
0
0
python,streaming,webcam
2,926,270
3
false
1
0
No: the "plugin" you mention runs in the user's browser, your server-side script (Python or otherwise) runs on the server, a completely different proposition. This relates to your other recent question about a server-side script accessing information on your desktop: your client machine tends to be very protected agai...
2
2
0
Can a python script on my server access the webcam and audio input of a user as easily and as well as a Flash plugin can?
Python access webcam and audio input
0.132549
0
0
2,165
2,927,543
2010-05-28T08:22:00.000
1
1
0
0
python,rss
2,927,551
2
false
0
0
Of course. BeautifulSoup, lxml, urllib2, urlgrabber.
1
0
0
I am trying to create a directory with news articles collected from an rss feed, meaning that whenever there is a link to an article within the rss feed, I would like for it to be downloaded in a directory with the title of the specific article as the filename as as a text file. Is that something Python can help me do ...
Downloading from links in an rss feed
0.099668
0
1
442
2,930,211
2010-05-28T15:17:00.000
0
0
0
0
c#,python,sockets
2,965,960
2
true
1
0
The easier way on my use case was send files using HTTP because with python i have additionaly running django.
1
1
0
i would like to know, what is the best way to send files between python and C# and vice versa. I have my own protocol which work on socket level, and i can send string and numbers in both ways. Loops works too. With this i can send pretty much anything, like package of users id, if it is simple data. But soon i will st...
Send files between python+django and C#
1.2
0
1
347
2,932,007
2010-05-28T19:46:00.000
0
0
0
0
python,linux,administration,func
3,130,135
4
false
1
0
It really depends what you're intending to do, as the question is a little vague. The other answers cover the tools available; choosing one over the other comes down to purpose. Are you intending to manage servers, and services on those servers? If so, try Puppet, CFEngine, or some other tool for managing server conf...
1
0
0
We're writing a web-based tool to configure our services provided by multiple servers. This includes interfaces configuration, dhcp configs etc. etc. Having configs in database and views that generate proper output, how to send it/make it available for servers? I'm thinking about sending it through scp and invoking rel...
Methods of sending web-generated config files to servers and restarting services
0
0
1
226
2,933,262
2010-05-29T00:28:00.000
0
0
0
0
python,xml
2,933,332
8
false
0
0
If you're set on using minidom, just scan back in the file and remove the first line after writing all the XML you need.
2
12
0
when using Python's stock XML tools such as xml.dom.minidom for XML writing, a file would always start off like <?xml version="1.0"?> [...] While this is perfectly legal XML code, and it's even recommended to use the header, I'd like to get rid of it as one of the programs I'm working with has problems here. I can't se...
How to write an XML file without header in Python?
0
0
1
9,270
2,933,262
2010-05-29T00:28:00.000
0
0
0
0
python,xml
2,933,289
8
false
0
0
Purists may not like to hear this, but I have found using an XML parser to generate XML to be overkill. Just generate it directly as strings. This also lets you generate files larger than you can keep in memory, which you can't do with DOM. Reading XML is another story.
2
12
0
when using Python's stock XML tools such as xml.dom.minidom for XML writing, a file would always start off like <?xml version="1.0"?> [...] While this is perfectly legal XML code, and it's even recommended to use the header, I'd like to get rid of it as one of the programs I'm working with has problems here. I can't se...
How to write an XML file without header in Python?
0
0
1
9,270
2,933,434
2010-05-29T01:49:00.000
1
1
1
0
python,compiler-construction,project
12,135,232
2
false
0
0
Some other tools you might investigate to speed up python are Cython, which requires type specification of all variables in the relevant method and then statically compiles the method Numba, which requires LLVM but is JIT (methods must be decorated with argument types for compilation to occur).
1
11
0
I'm currently aware of the following Python JIT compilers: Psyco, PyPy and Unladen Swallow. Basically, I'd like to ask for your personal experiences on the strengths and weaknesses of these compilers - and if there are any others worth looking into. Thanks in advance, Az
Strengths and weaknesses of JIT compilers for Python
0.099668
0
0
5,073
2,933,601
2010-05-29T03:04:00.000
3
0
1
1
python,terminal,stream
2,933,610
2
true
0
0
Open a pipe, then fork off a terminal running cat reading from the read end of the pipe, and write into the write end of the pipe.
1
3
0
I need output different information to different terminal instances instead of print them in same output stream, say std.err or std.out. for example: I have 5 kinds of information say A-E need to be displayed on different terminal windows on same desktop, looks like [terminal 1] <- for displaying information A [termin...
how i can open different linux terminal to output differnt kinds of debug information in python?
1.2
0
0
1,349
2,933,796
2010-05-29T04:25:00.000
2
0
0
0
python,model-view-controller,sqlalchemy,dns,controllers
2,934,084
1
true
1
0
Controllers are meant to encapsulate features for your convienience. Not to bind your hands. If you want to join, simply join. Use the controller that you think is logically fittest to make the query.
1
1
0
When using SQL Alchemy for abstracting your data access layer and using controllers as the way to access objects from that abstraction layer, how should joins be handled? So for example, say you have an Orders controller class that manages Order objects such that it provides getOrder, saveOrder, etc methods and likewis...
SQL Alchemy MVC and cross controller joins
1.2
1
0
430
2,934,435
2010-05-29T09:02:00.000
1
0
0
1
python,macos,wxpython,pyobjc
2,958,571
2
true
0
1
Can you create a hidden window that is offscreen somewhere? It is a hack, but I remember having to do a lot of hacks to make my wxPython-based application work correctly on Mac OS X. Note:You'll have to disable the close button and set up that hidden window so that it doesn't show up in the Window menu. Aside:Have you ...
1
5
0
I am writing a wxPython application that remains open after closing all of its windows - so you can still drag & drop new files onto the OSX dock icon (I do this with myApp.SetExitOnFrameDelete(False)). Unfortunately if I close all the windows, the OSX menubar will only contain a "Help" menu. I would like to add at lea...
How to change the OSX menubar in wxPython without any opened window?
1.2
0
0
1,471
2,935,631
2010-05-29T15:35:00.000
1
0
0
1
python,google-app-engine,task-queue
2,935,659
2
true
1
0
The development server won't run tasks automatically, you have to set them off yourself. It's a design feature, so you can see what happens when you run them, instead of them running at any point. Essentially, there's nothing wrong with your application, it's a feature of development server.
1
1
0
I was playing with Goole App Engine Task Queue API to learn how to use it. But I couldn't make it trigger locally. My application is working like a charm when I upload to Google servers. But it doesn't trigger locally. All I see from the admin is the list of the tasks. But when their ETA comes, they just pass it. It's ...
Task Queue stopped working
1.2
0
0
391
2,935,836
2010-05-29T16:46:00.000
1
0
1
1
python,multithreading,command-line,ipc,interprocess
2,935,858
4
false
0
0
Perhaps try using sockets for communication?
2
14
0
I'd like to prevent multiple instances of the same long-running python command-line script from running at the same time, and I'd like the new instance to be able to send data to the original instance before the new instance commits suicide. How can I do this in a cross-platform way? Specifically, I'd like to enable t...
can a python script know that another instance of the same script is running... and then talk to it?
0.049958
0
0
3,867
2,935,836
2010-05-29T16:46:00.000
0
0
1
1
python,multithreading,command-line,ipc,interprocess
2,936,096
4
false
0
0
Sounds like your best bet is sticking with a pid file but have it not only contain the process Id - have it also include the port number that the prior instance is listening on. So when starting up check for the pid file and if present see if a process with that Id is running - if so send your data to it and quit othe...
2
14
0
I'd like to prevent multiple instances of the same long-running python command-line script from running at the same time, and I'd like the new instance to be able to send data to the original instance before the new instance commits suicide. How can I do this in a cross-platform way? Specifically, I'd like to enable t...
can a python script know that another instance of the same script is running... and then talk to it?
0
0
0
3,867
2,936,384
2010-05-29T19:48:00.000
0
0
0
0
python,web-applications,printing
2,936,475
2
false
1
0
If your Python webapp is running inside a browser on the client machine, I don't see any other way than manually for the user. Some workarounds you might want to investigate: if you web app is installed on the client machine, you will be able to connect directly to the printer, as you have access to the underlying OS ...
1
0
0
Is it possible for my python web app to provide an option the for user to automatically send jobs to the locally connected printer? Or will the user always have to use the browser to manually print out everything.
python web script send job to printer
0
0
1
1,545
2,937,114
2010-05-30T00:43:00.000
-6
0
1
0
python,if-statement,sequence,sequences
2,937,150
7
false
0
0
Why are you doing this? The normal way here is to require a certain type of thing (A sequence or a number or a file-like object, etc.) and then use it without checking anything. In Python, we don't typically use classes to carry semantic information but simply use the methods defined (this is called "duck typing"). We ...
1
82
0
In python is there an easy way to tell if something is not a sequence? I tried to just do: if x is not sequence but python did not like that
Python: check if an object is a sequence
-1
0
0
47,990
2,937,619
2010-05-30T05:06:00.000
2
0
0
0
python,sql,r,large-files,large-data-volumes
2,942,419
8
false
0
0
When you say "accumulating" then solution (2) looks most suitable to problem. After initial load up to database you only update database with new files (daily, weekly? depends how often you need this). In cases (1) and (3) you need to process files each time (what was stated earlier as most time/resources-consuming), u...
4
32
0
I have large amounts of data (a few terabytes) and accumulating... They are contained in many tab-delimited flat text files (each about 30MB). Most of the task involves reading the data and aggregating (summing/averaging + additional transformations) over observations/rows based on a series of predicate statements, and...
large amount of data in many text files - how to process?
0.049958
1
0
5,360
2,937,619
2010-05-30T05:06:00.000
4
0
0
0
python,sql,r,large-files,large-data-volumes
2,937,664
8
false
0
0
With terabytes, you will want to parallelize your reads over many disks anyway; so might as well go straight into Hadoop. Use Pig or Hive to query the data; both have extensive support for user-defined transformations, so you should be able to implement what you need to do using custom code.
4
32
0
I have large amounts of data (a few terabytes) and accumulating... They are contained in many tab-delimited flat text files (each about 30MB). Most of the task involves reading the data and aggregating (summing/averaging + additional transformations) over observations/rows based on a series of predicate statements, and...
large amount of data in many text files - how to process?
0.099668
1
0
5,360
2,937,619
2010-05-30T05:06:00.000
1
0
0
0
python,sql,r,large-files,large-data-volumes
2,937,660
8
false
0
0
Yes. You are right! I/O would cost most of your processing time. I don't suggest you to use distributed systems, like hadoop, for this task. Your task could be done in a modest workstation. I am not an Python expert, I think it has support for asynchronous programming. In F#/.Net, the platform has well support for tha...
4
32
0
I have large amounts of data (a few terabytes) and accumulating... They are contained in many tab-delimited flat text files (each about 30MB). Most of the task involves reading the data and aggregating (summing/averaging + additional transformations) over observations/rows based on a series of predicate statements, and...
large amount of data in many text files - how to process?
0.024995
1
0
5,360
2,937,619
2010-05-30T05:06:00.000
14
0
0
0
python,sql,r,large-files,large-data-volumes
2,937,630
8
true
0
0
(3) is not necessarily a bad idea -- Python makes it easy to process "CSV" file (and despite the C standing for Comma, tab as a separator is just as easy to handle) and of course gets just about as much bandwidth in I/O ops as any other language. As for other recommendations, numpy, besides fast computation (which you...
4
32
0
I have large amounts of data (a few terabytes) and accumulating... They are contained in many tab-delimited flat text files (each about 30MB). Most of the task involves reading the data and aggregating (summing/averaging + additional transformations) over observations/rows based on a series of predicate statements, and...
large amount of data in many text files - how to process?
1.2
1
0
5,360
2,938,405
2010-05-30T11:29:00.000
5
0
1
0
python,multithreading
2,938,465
3
false
0
0
Your question cannot be answered in a general way, as good usage of threading always depends on concrete problem to be solved. You also do not tell us, which Python version you are using, so I assume you use the "default" CPython and not IronPython or something like that. To give you some hints and ideas to further thi...
1
4
0
I'm quite new to threading in Python and have a couple of beginner questions. When starting more than say fifty threads using the Python threading module I start getting MemoryError. The threads themselves are very slim and not very memory hungry, so it seems like it is the overhead of the threading that causes the mem...
Caveats to be aware of when using threading in Python?
0.321513
0
0
1,096
2,938,757
2010-05-30T13:14:00.000
1
1
1
0
python,encryption
2,939,776
2
false
0
0
You can read the complete file into a string, encrypt it, write the encrypted string in a new file. If the file is too large, you can read in chunks. Every time you .read from a file, you get a string (in Python < 3.0).
1
6
0
Is there a way to encrypt files (.zip, .doc, .exe, ... any type of file) with Python? I've looked at a bunch of crypto libraries for Python including pycrypto and ezpycrypto but as far as I see they only offer string encryption.
File encryption with Python
0.099668
0
0
972
2,938,874
2010-05-30T13:51:00.000
0
0
0
0
python,grid,resize,pyqt4,qwebview
6,977,293
2
false
0
1
in the dialog class's resizeEvent, one that extends QDialog, call webView->setGeometry, and this->resize, this->update. hint: check if size changed via the QResizeEvent *ptr
1
0
0
I have a QWebview in a grid layout, along with other widgets. When the user resizes the window, the QWebview doesn't resize, but the other widgets do. How can I make the QWebview resize correctly?
PyQT4 QWebView not resizing correctly
0
0
0
1,113
2,939,224
2010-05-30T15:30:00.000
4
0
0
0
python,tkinter,media,pyaudio,audio-player
2,939,414
3
false
0
1
Probably you have to use threads for that. You have to play your audio file in a different thread than the gui mainloop so that the GUI keeps responding user input. IMHO, wxpython is not so complicated and has some utility functions that would help to do what you want. Check the wxpython demo, you have several examples...
1
0
0
I'm developing a media player. Right now it's a simple window with a button to load .wav files. The problem is I would like to implement a pause button now. But, when playing a audio file the GUI isn't accessible again (no buttons can be pushed) till the file is done playing. How can I make the GUI dynamic while an aud...
Python/Tkinter Audio Player
0.26052
0
0
3,328