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,939,513
2010-05-30T16:54:00.000
0
0
1
0
python,list,set,intersection
2,939,529
4
false
0
0
I assume one dimension in your list is assumed e.g. [9,8,7,6,5] are heights at x1,x2,x3,x4,x5 right? in that case how your list will represent curves like y=0 ? In any case I don't think there can be any shortcut for calculating intersection of generic or random curves, best solution is to do a efficient search.
1
1
0
I have two lists in python and I want to know if they intersect at the same index. Is there a mathematical way of solving this? For example if I have [9,8,7,6,5] and [3,4,5,6,7] I'd like a simple and efficient formula/algorithm that finds that at index 3 they intersect. I know I could do a search just wondering if there is a better way. I know there is a formula to solve two lines in y = mx + b form by subtracting them from each other but my "line" isn't truly a line because its limited to the items in the list and it may have curves. Any help is appreciated.
set / line intersection solution
0
0
0
963
2,941,021
2010-05-31T01:51:00.000
2
0
0
0
python,google-app-engine,session,login
2,941,171
2
true
1
0
Under Application Settings in the App Engine dashboard, you can choose either 1 day, 1 week, or 2 week cookie expiration, assuming you're using the Users API. I don't believe the cookie should ever be set to expire when the browser is closed, unless the user's browser setting is causing this behavior. I can certainly stay logged in to my applications when restarting my browser.
1
0
0
...Like Django's session or cookies Does anyone have a simple way of allowing this?
How to Not Force Login After Users Close Their Browser on gae
1.2
0
0
174
2,942,375
2010-05-31T08:47:00.000
0
0
1
0
python,arrays,data-structures,dictionary
2,943,067
2
false
0
0
You might try using std::map. Boost.Python provides a Python wrapping for std::map out-of-the-box.
1
3
1
I bumped into a case where I need a big (=huge) python dictionary, which turned to be quite memory-consuming. However, since all of the values are of a single type (long) - as well as the keys, I figured I can use python (or numpy, doesn't really matter) array for the values ; and wrap the needed interface (in: x ; out: d[x]) with an object which actually uses these arrays for the keys and values storage. I can use a index-conversion object (input --> index, of 1..n, where n is the different-values counter), and return array[index]. I can elaborate on some techniques of how to implement such an indexing-methods with reasonable memory requirement, it works and even pretty good. However, I wonder if there is such a data-structure-object already exists (in python, or wrapped to python from C/++), in any package (I checked collections, and some Google searches). Any comment will be welcome, thanks.
python dictionary with constant value-type
0
0
0
1,303
2,943,071
2010-05-31T11:03:00.000
0
1
1
1
python,windows-7,path
2,943,171
3
false
0
0
You can check the currently present enviroment variables with the "set" command on the command line. For python to work you need at least PYTHONPATH pointing to your python libs and the path to python.exe should be included in your PATH variable.
2
0
0
This is a weird bug. I know it's something funky going on with my PATH variable, but no idea how to fix it. If I have a script C:\Test\test.py and I execute it from within IDLE, it works fine. If I open up Command Prompt using Run>>cmd.exe and navigate manually it works fine. But if I use Windows 7's convenient Right Click on folder >> Command Prompt Here then type test.py it fails with import errors. I also cannot just type "python" to reach a python shell session if I use the latter method above. Any ideas? Edit: printing the python path for the command prompt that works yields the correct paths. Printing it on the non-working "Command prompt here" yields: Environment variable python not defined".
Python doesn't work properly when I execute a script after using Right Click >> Command Prompt Here
0
0
0
2,823
2,943,071
2010-05-31T11:03:00.000
1
1
1
1
python,windows-7,path
2,943,111
3
false
0
0
I don't use Windows much, but maybe when you open Right Click -> Command Prompt, the PATH is different from navigate manually. First try to print your PATH (oh I have no ideal how to do this) and see if it different in 2 situation.
2
0
0
This is a weird bug. I know it's something funky going on with my PATH variable, but no idea how to fix it. If I have a script C:\Test\test.py and I execute it from within IDLE, it works fine. If I open up Command Prompt using Run>>cmd.exe and navigate manually it works fine. But if I use Windows 7's convenient Right Click on folder >> Command Prompt Here then type test.py it fails with import errors. I also cannot just type "python" to reach a python shell session if I use the latter method above. Any ideas? Edit: printing the python path for the command prompt that works yields the correct paths. Printing it on the non-working "Command prompt here" yields: Environment variable python not defined".
Python doesn't work properly when I execute a script after using Right Click >> Command Prompt Here
0.066568
0
0
2,823
2,943,516
2010-05-31T12:30:00.000
5
0
0
0
python,quantlib
2,949,806
3
false
0
0
They're in the QuantLib-SWIG distribution (you probably got that from the QuantLib site already.) Once you unpack the tarball (or the zip archive) they're in the Python\examples folder.
1
13
0
Does anyone know of any good quantlib examples for Python? I cant seem to find any anywhere...
Python quantlib examples?
0.321513
0
0
6,665
2,943,862
2010-05-31T13:37:00.000
3
0
0
0
python,xml,tags,yaml
2,955,385
4
false
0
0
The difference between XML and YAML is significant enough to warrant a redesign of the schema you are using to store your data. You should write a script to parse your XML records and output YAML formatted data. There are some methods out there to convert any generic XML into YAML, but the results are far less usable than a method designed specifically for your schema.
1
10
0
is there any library or way exist from which I can convert my xml records to yaml format ?
is there anything exist to convert xml -> yaml directly?
0.148885
0
1
6,025
2,945,074
2010-05-31T17:30:00.000
0
0
0
0
python,networking,communication
2,945,291
2
false
0
0
You could use wireshark from wireshark.org to sniff the network traffic (or any other packet sniffer).
1
2
0
lets say you run third party program on your computer whitch create a process named example.exe how do i determinate if this process is running and how many windows does he open? How do i intercept network communication between this windows and server? my goal is to create an app whitch will be monitoring network trafic between example.exe and its home server in order to analyze data and save to database, and finally simulate user interaction to get more relevant data
python intercepting communication
0
0
1
620
2,945,615
2010-05-31T19:32:00.000
0
0
0
0
python,django,routes,pylons
2,945,937
1
true
1
0
Could you be more specific? If you want to adapt a django urlconf to routes at runtime it would be really tricky if not impossible and would require having a django settings.py present and an env variable pointing to it. Otherwise translating a django urlconf to routes manually is doable. Routes is as flexible as django urlconfs when it comes to defining urlpatterns.
1
2
0
Can the Django urls.py system be turned into Pylon's Routes?
Can the Django urls.py system be turned into Pylon's Routes?
1.2
0
0
202
2,946,183
2010-05-31T22:06:00.000
2
0
0
1
python,google-app-engine,backup
15,256,477
4
false
1
0
There is now a backup option available in the dashboard. See "datastore admin".
1
14
0
So, you build a great shiny cloudy 2.0 website on top of AppEngine, with thousands upon thousands of images saved into the datastore and gigs of data at the blobstore. How do you backup them?
How to backup an AppEngine site?
0.099668
0
0
2,873
2,946,746
2010-06-01T01:00:00.000
1
0
1
0
python,windows,registry,privileges
2,946,772
4
false
0
0
Most straightforward way is try to change the key at the beginning, maybe to a stub value - if that fails, catch the error and tell the user.
1
4
0
I'm writing a little program as a self-learning project in Python 3.x. My idea is for the program to allow two fields of text entry to the user, and then plug the user's input into the value of two specific registry keys. Is there a simple way to make it check if the current user can access the registry? I'd rather it cleanly tell the user that he/she needs administrator privileges than for the program to go nuts and crash because it's trying to access a restricted area. I'd like it to make this check as soon as the program launches, before the user is given any input options. What code is needed for this? Edit: in case it isn't obvious, this is for the Windows platforms.
Python - checking if a user has administrator privileges
0.049958
0
0
12,230
2,947,049
2010-06-01T02:54:00.000
6
0
0
0
python-imaging-library
7,326,477
1
false
0
0
PIL won't automatically do this, but you could easily do it yourself using the getsize method in the ImageFont module. That is, if the text is too big, just split it so that it's not, and put the rest on the next line. (You may want to do this recursively in case the text spans multiple lines.)
1
2
0
i have a word that will be putted on a image but the problem is that the word continues even though the word exceeds the width of the image is there anyway that the word shift's down if the word exceeds the width of the image or on a certain point the word shift's down if it exceeds the given point
python imaging library draw text new line how to?
1
0
0
1,435
2,947,172
2010-06-01T03:49:00.000
8
0
0
0
python,sql,orm,sqlalchemy
2,947,182
2
true
0
0
ORMs are very popular, for several reasons -- e.g.: some people would rather not learn SQL, ORMs can ease porting among different SQL dialects, they may fit in more smoothly with the mostly-OOP style of applications, indeed might even ease some porting to non-SQL implementations (e.g, moving a Django app to Google App Engine would be much more work if the storage access layer relied on SQL statements -- as it relies on the ORM, that reduces, a bit, the needed porting work). SQLAlchemy is the most powerful ORM I know of for Python -- it lets you work at several possible levels, from a pretty abstract declarative one all the way down to injecting actual SQL in some queries where your profiling work has determined it makes a big difference (I think most people use it mostly at the intermediate level where it essentially mediates between OOP and relational styles, just like other ORMs). You haven't asked for my personal opinion in the matter, which is somewhat athwart of the popular one I summarized above -- I've never really liked "code generators" of any kind (they increase your productivity a bit when everything goes smoothly... but you can pay that back with interest when you find yourself debugging problems [[including performance bottlenecks]] due to issues occurring below the abstraction levels that generators strive to provide). When I get a chance to use a good relational engine, such as PostgreSQL, I believe I'm overall more productive than I would be with any ORM in between (incuding SQLAlchemy, despite its many admirable qualities). However, I have to admit that the case is different when the relational engine is not all that good (e.g., I've never liked MySQL), or when porting to non-relational deployments is an important consideration. So, back to your actual question, I do think that, overall, investing time in mastering SQLAlchemy is a good idea, and time well-spent.
2
1
0
Should I invest a lot of time trying to figure out an ORM style implementation, or is it still common to just stick with standard SQL queries in python/pylons/sqlalchemy?
Transitioning from php to python/pylons/SQLAlchemy -- Are ORMs the standard now?
1.2
1
0
1,032
2,947,172
2010-06-01T03:49:00.000
1
0
0
0
python,sql,orm,sqlalchemy
2,947,191
2
false
0
0
If you have never use an ORM like SqlAlchemy before, I would suggest that you learn it - as long as you are learning the Python way. If nothing else, you will be better able to decide where/when to use it vs plain SQL. I don't think you should have to invest a lot of time on it. Documentation for SQLAlchemy is decent, and you can always ask for help if you get stuck.
2
1
0
Should I invest a lot of time trying to figure out an ORM style implementation, or is it still common to just stick with standard SQL queries in python/pylons/sqlalchemy?
Transitioning from php to python/pylons/SQLAlchemy -- Are ORMs the standard now?
0.099668
1
0
1,032
2,947,211
2010-06-01T04:04:00.000
18
0
1
0
python,cuda,opencl
2,947,307
8
false
0
0
I believe that, with PyCUDA, your computational kernels will always have to be written as "CUDA C Code". PyCUDA takes charge of a lot of otherwise-tedious book-keeping, but does not build computational CUDA kernels from Python code.
1
36
0
I guess the question speaks for itself. I'm interested in doing some serious computations but am not a programmer by trade. I can string enough python together to get done what I want. But can I write a program in python and have the GPU execute it using CUDA? Or do I have to use some mix of python and C? The examples on Klockner's (sp) "pyCUDA" webpage had a mix of both python and C, so I'm not sure what the answer is. If anyone wants to chime in about Opencl, feel free. I heard about this CUDA business only a couple of weeks ago and didn't know you could use your video cards like this.
Can I program Nvidia's CUDA using only Python or do I have to learn C?
1
0
0
13,127
2,947,817
2010-06-01T06:58:00.000
2
0
0
0
python,function,button,ttk
11,642,028
2
false
0
1
Markus, yes, that's the right solution, but it is not because you can't use multi-argument commands in widget callouts. Consider, in your original code, ...command=loadModelTree(treeModel)... is an invocation of the method. Lambda allows you to abstract the command so you can have an arbitrary number of arguments without confusing the interpreter by invoking it, e.g., ...command=lambda arg1=myarg1, arg2=myarg2, arg3=myarg3: myCallout(arg1, arg2, arg3).... I hope that makes what is going on a bit clearer.
2
1
0
I'm making a small script in python with ttk and I have a problem where a function runs where it shouldn't. The button code looks as follows: btReload = ttk.Button(treeBottomUI, text="Reload", width=17, command=loadModelTree(treeModel)) btReload.pack(side="left") and the function is as this: def loadModelTree(tree): print ("Loading models...") allModels = os.listdir(confModPath) for chunk in allModels: ... For some reason, the function runs without the button being pressed. Why?
Python ttk.Button -command, runs without button being pressed
0.197375
0
0
3,407
2,947,817
2010-06-01T06:58:00.000
1
0
0
0
python,function,button,ttk
2,947,926
2
false
0
1
Well, as I found the answer, I'll answer my own question. It appers that ttk.button commands does not support sending arguments to functions so the work around is to do as follows: btReload = ttk.Button(treeBottomUI, text="Reload", width=17, command=lambda i=treeModel: loadModelTree(i)) btReload.pack(side="left") Simple as pie!
2
1
0
I'm making a small script in python with ttk and I have a problem where a function runs where it shouldn't. The button code looks as follows: btReload = ttk.Button(treeBottomUI, text="Reload", width=17, command=loadModelTree(treeModel)) btReload.pack(side="left") and the function is as this: def loadModelTree(tree): print ("Loading models...") allModels = os.listdir(confModPath) for chunk in allModels: ... For some reason, the function runs without the button being pressed. Why?
Python ttk.Button -command, runs without button being pressed
0.099668
0
0
3,407
2,948,455
2010-06-01T09:09:00.000
2
1
0
1
python
2,949,014
2
false
0
0
Just for your information: this is much self-descriptive to use multiplication when you set up timers, for example alarm(24 * 60 * 60) for 24 hours, instead of alarm(86400) for the same period. Hope this will help keep your code clean and easy-maintainable :)
1
1
0
Starting a Perl script with alarm(3600) will make the script abort if it is still running after one hour (3600 seconds). Assume I want to set an upper bound on the running time of a Python script, what is the easiest way to achieve that?
Equivalent of alarm(3600) in Python
0.197375
0
0
362
2,950,971
2010-06-01T15:18:00.000
2
0
1
1
python,linux,windows,py2exe
8,840,967
6
false
0
0
I have tested py2exe inside of wine, and it does function. You'll need to install python in wine for it to work, or if you only use the standard libarary, you can bundle py2exe with py2exe from the windows machine and then use it in wine. Just keep in mind you need the same version of the ms visual C libraries in wine as were used to compile python or things won't work properly.
1
62
0
I have a Python script that I'd like to compile into a Windows executable. Now, py2exe works fine from Windows, but I'd like to be able to run this from Linux. I do have Windows on my development machine, but Linux is my primary dev platform and I'm getting kind of sick of rebooting into Windows just to create the .exe. Nor do I want to have to buy a second Windows license to run in a virtual machine such as VirtualBox. Any ideas? PS: I am aware that py2exe doesn't exactly compile the python file as much as package your script with the Python interpreter. But either way, the result is that you don't need Python installed to run the script.
Packaging a Python script on Linux into a Windows executable
0.066568
0
0
79,618
2,951,530
2010-06-01T16:29:00.000
0
0
0
0
python,printing,tkinter
3,214,960
3
false
0
1
I think your butting up to the limits of Tkinter. If not for the widgets, another method is to draw the same image on a PIL image-draw object as the two have similar APIs. A hacky workaround would be to programatically take a screen grab of the window area you want using ImageGrab in PIL. wxPython is a decent alternative. Personally I prefer Qt, it certainly has excellent printer support. Also the Graphics View framework is outstanding.
1
5
0
I am trying to print the contents of a python tkinter canvas. I have tried using the postscript method of canvas to create a postscript file, but I get a blank page. I know this is because I have embedded widgets, and these do not get rendered by the postscript method. Before I rewrite my program to create a more printer-friendly layout, can someone suggest a way to approach this problem? All of the programming books I have ever read approach the problem of sending output to a printer with a bit of hand-waving, something along the lines of: "It's a difficult problem that depends on interacting with the operating system." I also have a hard time finding resources about this because of all the pages related to printing to the screen. I am using Python 2.6, on Ubuntu 9.04.
Printing python tkinter output
0
0
0
5,306
2,951,982
2010-06-01T17:43:00.000
3
0
1
0
python,python-3.x,python-2.x
2,952,037
3
true
0
1
Python 2 and 3 are not that different. If you have learned Python 2 well, it will be a matter of minutes to get acquainted with Python 3. The official recommendation says that you should use Python 2.6 (the current version) and try to be forward-compatible. Python 3 is currently not an option for large projects as virtually none of the popular packages have been translated yet. But development of Python 2 and 3 will continue in parallel for a long time, so you won't lose much by not using Python 3. You can import many syntactical features of 3 (Unicode string literals, division, print function, absolute imports) using the __future__ module, and the standard library remains mostly the same. So I'd recommend using Python 2.
2
5
0
I'm going to start on a long (~1-year) programming project in Python. I want to use wxPython for my GUI (supports 2.6), but I also want to use 3.1 for the rest of the project (to start using the 3.x syntax). Is there any way for me to design a project that mixes 2.x and 3.x modules? Or should I just bite the bullet and use either 2.x (preferred, since I really want to learn wxPython) or 3.x throughout? Thanks, Mike
Can one Python project use both 2.x and 3.x code?
1.2
0
0
4,940
2,951,982
2010-06-01T17:43:00.000
2
0
1
0
python,python-3.x,python-2.x
3,026,057
3
false
0
1
mixing the ability to use wxPython (2.x) + with learning new syntax (3.x) Don't "mix". Write Python 2. Get it to work. Play with Python 3 separately. Don't "mix". When the various packages and modules are available in Python 3, use the 2to3 conversion to create Python 3. You'll find some small problems. Fix your Python 2 so that your package works in Python 2 and also works after the conversion. Then, you can drop support for Python 2 and focus on Python 3. Don't "mix".
2
5
0
I'm going to start on a long (~1-year) programming project in Python. I want to use wxPython for my GUI (supports 2.6), but I also want to use 3.1 for the rest of the project (to start using the 3.x syntax). Is there any way for me to design a project that mixes 2.x and 3.x modules? Or should I just bite the bullet and use either 2.x (preferred, since I really want to learn wxPython) or 3.x throughout? Thanks, Mike
Can one Python project use both 2.x and 3.x code?
0.132549
0
0
4,940
2,952,045
2010-06-01T17:56:00.000
12
0
1
0
python,import,module,standard-library,pythonpath
2,953,396
3
false
0
0
Don't. If you have accidentally chosen a standard library module name, change your module name to end the conflict.
1
16
0
I have a custom module in one of the directories in my PYTHONPATH with the same name as one of the standard library modules, so that when I import module_name, that module gets loaded. If I want to use the original standard library module, is there any way to force Python to import from the standard library rather than from the PYTHONPATH directory, short of renaming the custom module and changing every reference to point to the new name?
Force import module from Python standard library instead of PYTHONPATH default
1
0
0
7,037
2,952,443
2010-06-01T18:56:00.000
3
0
0
1
python,windows,process,kill,windows-error-reporting
2,952,969
2
true
0
0
Wouldn't it be easier to disable the error reporting feature?
2
3
0
I am looking for a means to kill a Windows exe program that, when being tested from a python script, crashes and presents a dialog to the user; as this program is invoked many times, and may crash repeatedly, this is not suitable. The problem dialog is the standard reporting of a Windows error: "Foo.exe has encountered a problem and needs to close. We are sorry for the inconvenience" and offers a Debug, Send Error Report, and Don't Send buttons. I am able to kill other forms of dialog resulting from crashes (e.g. a Debug build's assert failure dialog is OK.) I have tried taskkill.exe, pskill, and the terminate() function on the Popen object from the subprocess module that was used to invoke the .exe Has anyone encountered this specific issue, and found a resolution? I expect automating user input to select the window, and press the "Don't Send" button is one possible solution, but I would like something far simpler if possible
Robustly killing Windows programs stuck reporting 'problems'
1.2
0
0
565
2,952,443
2010-06-01T18:56:00.000
0
0
0
1
python,windows,process,kill,windows-error-reporting
2,952,456
2
false
0
0
If you were to use CreateProcessEx or a WinAPI specific function, you might be able to call TerminateProcess or TerminateThread to forcibly end the process.
2
3
0
I am looking for a means to kill a Windows exe program that, when being tested from a python script, crashes and presents a dialog to the user; as this program is invoked many times, and may crash repeatedly, this is not suitable. The problem dialog is the standard reporting of a Windows error: "Foo.exe has encountered a problem and needs to close. We are sorry for the inconvenience" and offers a Debug, Send Error Report, and Don't Send buttons. I am able to kill other forms of dialog resulting from crashes (e.g. a Debug build's assert failure dialog is OK.) I have tried taskkill.exe, pskill, and the terminate() function on the Popen object from the subprocess module that was used to invoke the .exe Has anyone encountered this specific issue, and found a resolution? I expect automating user input to select the window, and press the "Don't Send" button is one possible solution, but I would like something far simpler if possible
Robustly killing Windows programs stuck reporting 'problems'
0
0
0
565
2,952,957
2010-06-01T20:08:00.000
2
1
0
1
python,django,aptana
2,952,983
1
true
1
0
You should try adding --noreload to the runserver argument
1
2
0
I am developing a small testing website using Django 1.2 in Aptana Studio build 2.0.4.1268158907. I have a Django project that I test by running the command "runserver 8001" on my project. This command runs the project on a small server that comes with Django. However the problem arises that every time I run this command Aptana opens two instances of the process "python.exe". Upon terminating the command only one of these instances is ended. The other process continues to run and use memory. My server is not online, and the process doesn't seem to do anything that I can find. This happens every time i run the runserver command on my project and therefore more and more python.exe instances will open up through my development period. Any help discovering either the purpose of this extra python.exe or a way to prevent it from opening would be much appreciated.
Aptana Studio is opening but not ever closing a python.exe process
1.2
0
0
509
2,953,357
2010-06-01T21:09:00.000
1
0
1
0
python,regex
2,953,374
2
false
0
0
The {} are odd here, they are not meta characters when used this way, what is there purpose because at the moment they are attempting to match a literal { and the match fails. Replace them with normal parenthesis and it will work
1
0
0
I'm trying to match rc-update -s output in python. m = re.match(r"^\s*(\w+)\s*\|{\s*(\w+)\s*}*$", " network | level1 level2 leveln ") but m is always None the hard part for me is getting the regex to match the n levels. I thought that using {}* would match the n levels, but as soon as I add the {} nothing matches. thanks.
regex help using repreated groups
0.099668
0
0
74
2,953,834
2010-06-01T22:29:00.000
-4
0
1
1
python,path,string-literals
60,505,487
6
false
0
0
Use PowerShell In Windows, you can use / in your path just like Linux or macOS in all places as long as you use PowerShell as your command-line interface. It comes pre-installed on Windows and it supports many Linux commands like ls command. If you use Windows Command Prompt (the one that appears when you type cmd in Windows Start Menu), you need to specify paths with \ just inside it. You can use / paths in all other places (code editor, Python interactive mode, etc.).
1
230
0
What is the best way to represent a Windows directory, for example "C:\meshes\as"? I have been trying to modify a script but it never works because I can't seem to get the directory right, I assume because of the '\' acting as escape character?
Windows path in Python
-1
0
0
481,405
2,954,036
2010-06-01T23:25:00.000
6
0
0
0
php,python,django,drupal
2,956,035
7
true
1
0
I've built several sites on Drupal and Django, my conclusion is: if you need to create something similar to the standard drupal (or Ubercart) feature-set, you don't have much time for development, and you don't expect hight load pressure on a site - you should pick Drupal. But if you do need to create something more or less custom (no drupal modules already available) you should go with Django - it is quicker and more pleasurable to implement custom complex features using Django. For example if my goal is to implement a second stackoverflow, I'll prefer Django because it will be extremely complicated to implement this badge-based rating system with Drupal. P.S. Studying Python (and Django) is an investment in your future, I think. You'll never be able to implement something similar to DropBox using drupal and php, although it could be implemented with java - but java is not so good from development speed perspective.
5
5
0
I want to learn and use Drupal or Django for the following: dynamic web sites, medium database, multi-level users, paypal integration, content managment, speed (developing), security I like MVC, ORM and object-oriented prg. Which is better to jump into ? Which one is more mature, powerful, understandable, object-oriented and easier to use by the time ? What about Python Spring ... Also, which of these 3 are better documented, are better for a cv and have more extensions? Known languages: php, java, mysql Thank you !
Django or Drupal, which one should I use that suits best my needs?
1.2
0
0
1,475
2,954,036
2010-06-01T23:25:00.000
2
0
0
0
php,python,django,drupal
2,954,057
7
false
1
0
Jump into what you like or what attracts you most after getting a little overview of the capabilities and constraints. I never worked with drupal, but I can recommend django.
5
5
0
I want to learn and use Drupal or Django for the following: dynamic web sites, medium database, multi-level users, paypal integration, content managment, speed (developing), security I like MVC, ORM and object-oriented prg. Which is better to jump into ? Which one is more mature, powerful, understandable, object-oriented and easier to use by the time ? What about Python Spring ... Also, which of these 3 are better documented, are better for a cv and have more extensions? Known languages: php, java, mysql Thank you !
Django or Drupal, which one should I use that suits best my needs?
0.057081
0
0
1,475
2,954,036
2010-06-01T23:25:00.000
2
0
0
0
php,python,django,drupal
2,954,198
7
false
1
0
Consider your deployment. Pretty much every host will support Drupal. If you go with Django, you will need to select a host that supports fast_cgi or wsgi
5
5
0
I want to learn and use Drupal or Django for the following: dynamic web sites, medium database, multi-level users, paypal integration, content managment, speed (developing), security I like MVC, ORM and object-oriented prg. Which is better to jump into ? Which one is more mature, powerful, understandable, object-oriented and easier to use by the time ? What about Python Spring ... Also, which of these 3 are better documented, are better for a cv and have more extensions? Known languages: php, java, mysql Thank you !
Django or Drupal, which one should I use that suits best my needs?
0.057081
0
0
1,475
2,954,036
2010-06-01T23:25:00.000
3
0
0
0
php,python,django,drupal
2,955,877
7
false
1
0
Drupal and Django doesn't make for a good comparison, as they are quite different. If all you need is a simple website with a CMS and Paypal, I would go for Drupal. Drupal's strength compared Django is it's many modules (modular system), which most of the time can get you where you want. Drupal is also extremely flexible, and you can change almost anything from within your own code, and there is a huge demand for Drupal developers. You can also let site builders create content, display content and much from from within the AI. Django on the other hand, is more simple and structured. It's based a lot more on code, making it fast and easy to develop something, but hard for non coders to change certain things. For sites that require a lot of custom coding, I usually prefer working with Django. Python is also a more structured programming language than PHP (IMO), and it's easier to make more maintainable code.
5
5
0
I want to learn and use Drupal or Django for the following: dynamic web sites, medium database, multi-level users, paypal integration, content managment, speed (developing), security I like MVC, ORM and object-oriented prg. Which is better to jump into ? Which one is more mature, powerful, understandable, object-oriented and easier to use by the time ? What about Python Spring ... Also, which of these 3 are better documented, are better for a cv and have more extensions? Known languages: php, java, mysql Thank you !
Django or Drupal, which one should I use that suits best my needs?
0.085505
0
0
1,475
2,954,036
2010-06-01T23:25:00.000
0
0
0
0
php,python,django,drupal
2,956,336
7
false
1
0
I've been developing with Django for more than 2 years and have built a couple of Drupal sites in the meantime (per client's specific request to use Drupal). My conclusions are the following: Even for a smaller site I would have done it quicker building it from scratch with django (or maybe even PHP) for a simple reason, writing code for me is faster than hunting through drupal's unorganized mess of menus and options, or hunting on the web for a module that implements hack X to enable feature Y. Migrating a site from development to production with Drupal is a big PITA. You can forget about using a VCS tool. All your work is in in the MySQL dump (including configurations, programming logic, views etc.), a few hacked up modules and the uploaded files.
5
5
0
I want to learn and use Drupal or Django for the following: dynamic web sites, medium database, multi-level users, paypal integration, content managment, speed (developing), security I like MVC, ORM and object-oriented prg. Which is better to jump into ? Which one is more mature, powerful, understandable, object-oriented and easier to use by the time ? What about Python Spring ... Also, which of these 3 are better documented, are better for a cv and have more extensions? Known languages: php, java, mysql Thank you !
Django or Drupal, which one should I use that suits best my needs?
0
0
0
1,475
2,954,412
2010-06-02T01:16:00.000
1
0
0
0
python,c,gtk
2,954,934
2
false
0
1
I believe the "show" signal (inherited from Widget) will do this.
1
0
0
Is there a signal that is emitted when a window/dialog is presented in GTK+? Example: when issuing this command to the GTK widget dialog: dialog.present() is there a resulting signal? Or is there any signal that denotes the "showing" of a window/dialog?
gtk+ signal emitted when window/dialog is "presented"
0.099668
0
0
317
2,954,696
2010-06-02T02:50:00.000
4
1
0
0
python,compression
2,954,788
2
true
0
0
What about using ctypes to call directly into fastlz.so (or .dll as the case may be)? It seems to have only 3 entry points, so wrapping them in ctypes should not be hard. Yes, SWIG or a custom C API wrapper should be almost as trivial, but ctypes lets you start experimenting right now even if you don't have a compiler (as long as you can get a working DLL/so of FastLZ for your platform)... hard to beat!-)
1
1
0
Looking to use FastLZ in Python, or something similar. Tried Google and didn't find anything. Wondering if there is another algorithm with similar performance available in Python?
Is there a python wrapper for a FastLZ implementation
1.2
0
0
565
2,956,904
2010-06-02T10:45:00.000
1
0
1
0
python,dojo
2,959,051
1
true
1
0
My Python team has been using Dojo on the client-side for a few years now, and we settled on CherryPy as our server-side about a year ago, and are pretty pleased with it. It's fairly minimal as web servers go, and enables us to customize the server behavior as needed. Initially we looked at Django and Turbogears as well, but we needed to do some things vis-a-vis user authentication, DB tuning, and templating that didn't really fit well in the "full stack" frameworks, so we've rolled our own stack instead. As for why Dojo and Python go well together, I can only speak for myself, but they seem to have a similar "feel" to me, so I can move from writing code on the server-side and client-side without having to make too much of a cognitive shift.
1
0
0
I've coming to be more interested in Dojo Toolkit which I find great, but are many Dojo users also using Python also? And why is it like that? I heard of Cherry Py (and why not Django?).
Are many Dojo Toolkit users also using Python?
1.2
0
0
516
2,957,588
2010-06-02T12:21:00.000
1
1
1
1
python
2,957,649
3
true
0
0
Many ways - In the case of windows, even a simple looping batch file would probably do - just have it start the script in a loop (whenever it crashes it would return to the shell and be restarted).
1
1
0
I have a python script and am wondering is there any way that I can ensure that the script run's continuously on a remote computer? Like for example, if the script crashes for whatever reason, is there a way to start it up automatically instead of having to remote desktop. Are there any other factors I have to be aware of? The script will be running on a window's machine.
running a python script on a remote computer
1.2
0
0
1,086
2,958,246
2010-06-02T13:42:00.000
0
0
1
1
python,batch-file
2,958,943
5
false
0
0
I'd simply create a lockfile in the local filesystem and exit if this exists already.
2
0
0
I am wondering, is there a way to change the name of a script so that it is not called "python.exe" in the tasklist. The reason I am asking is that I am trying to make a batch file that run's a python script. I want the batch file to check to see if the script is already running. if the script is already running then the batch file will do nothing. Thanks
Python script names in tasklist
0
0
0
872
2,958,246
2010-06-02T13:42:00.000
0
0
1
1
python,batch-file
2,958,673
5
false
0
0
This library does not work on Windows, and shouldn't be used in production code. Manipulation the argv array is a rather dirty hack. Generally I'd not try to identify processes by scanning the process table. This is not really reliable, as process names aren't guaranteed to be unique. Instead I'd spawn a simple server on localhost inside the python script. If started, the script can then try to connect to the server, and quit, if the server is already running. This approach can later on also be expanded to support any kind of IPC.
2
0
0
I am wondering, is there a way to change the name of a script so that it is not called "python.exe" in the tasklist. The reason I am asking is that I am trying to make a batch file that run's a python script. I want the batch file to check to see if the script is already running. if the script is already running then the batch file will do nothing. Thanks
Python script names in tasklist
0
0
0
872
2,959,503
2010-06-02T16:13:00.000
5
0
0
0
python,django,persistence
2,959,612
3
false
1
0
Why not still keep it in a database? Your remote REST store is all well and funky, but if you've got local data, there's nothing (unless there's spec saying so) to stop you storing some stuff in a local db. Doesn't have to be anything v glamorous - could be sqlite, or you could have some fun with redis, etc.
1
0
0
I'm building a website that doesn't require a database because a REST API "is the database". (Except you don't want to be putting site-specific things in there, since the API is used by mostly mobile clients) However there's a few things that normally would be put in a database, for example the "jobs" page. You have master list view, and the detail views for each job, and it should be easy to add new job entries. (not necessarily via a CMS, but that would be awesome) e.g. example.com/careers/ and example.com/careers/77/ I could just hardcode this stuff in templates, but that's no DRY- you have to update the master template and the detail template every time. What do you guys think? Maybe a YAML file? Or any better ideas? Thx
Best practice: How to persist simple data without a database in django?
0.321513
0
0
1,910
2,960,339
2010-06-02T18:14:00.000
18
0
1
1
python,linux,centos,pyodbc
51,455,094
19
false
0
0
Struggled with the same issue After running: sudo apt-get install unixodbc-dev I was able to pip install pyodbc
2
110
0
I am running Linux (2.6.18-164.15.1.el5.centos.plus) and trying to install pyodbc. I am doing pip install pyodbc and get a very long list of errors, which end in error: command 'gcc' failed with exit status 1 I looked in /root/.pip/pip.log and saw the following: InstallationError: Command /usr/local/bin/python -c "import setuptools; file='/home/build/pyodbc/setup.py'; execfile('/home/build/pyodbc/setup.py')" install --single-version-externally-managed --record /tmp/pip-7MS9Vu-record/install-record.txt failed with error code 1 Has anybody had a similar issue installing pyodbc?
Unable to install pyodbc on Linux
1
0
0
144,475
2,960,339
2010-06-02T18:14:00.000
4
0
1
1
python,linux,centos,pyodbc
50,872,039
19
false
0
0
A easy way to install pyodbc is by using 'conda'. As conda automatically installs required dependencies including unixodbc. conda --ugrade all (optional) then conda install pyodbc it will install following packages: libgfortran-ng: 7.2.0-hdf63c60_3 defaults mkl: 2018.0.3-1 defaults mkl_fft: 1.0.2-py36_0 conda-forge mkl_random: 1.0.1-py36_0 conda-forge numpy-base: 1.14.5-py36hdbf6ddf_0 defaults pyodbc: 4.0.17-py36_0 conda-forge unixodbc: 2.3.4-1 conda-forge
2
110
0
I am running Linux (2.6.18-164.15.1.el5.centos.plus) and trying to install pyodbc. I am doing pip install pyodbc and get a very long list of errors, which end in error: command 'gcc' failed with exit status 1 I looked in /root/.pip/pip.log and saw the following: InstallationError: Command /usr/local/bin/python -c "import setuptools; file='/home/build/pyodbc/setup.py'; execfile('/home/build/pyodbc/setup.py')" install --single-version-externally-managed --record /tmp/pip-7MS9Vu-record/install-record.txt failed with error code 1 Has anybody had a similar issue installing pyodbc?
Unable to install pyodbc on Linux
0.04208
0
0
144,475
2,960,481
2010-06-02T18:35:00.000
0
0
0
0
python,mysql
2,960,589
2
true
0
0
Use a SELECT... WHERE date <= NOW() && date >= ( NOW() - 90000 ) (90,000 is 25 hours, giving you a little leeway with the insert time), and then take the difference between the rows in python.
1
0
0
I have a table formatted similar to this: Date | ID | Value | Difference I need to get the difference between a record's value column, and the previous record's value column based off of the date. I.E 2 days ago | cow | 1 | Null Yesterday | cow | 2 | Null Today | cow | 3 | Null Yesterdays difference would be 1, and today's difference would be 1. basically, I need to get the previous record based off the date, I don't know the interval's between each record. I've been stumped on this for a while. I am using Mysql, and Python to do the majority of the calculations.
Get the previous date in Mysql
1.2
1
0
530
2,960,847
2010-06-02T19:15:00.000
2
0
1
0
python
2,961,280
1
false
0
0
There's a PyUnicode_AS_UNICODE macro. BTW: PyString_AS_STRING only works for string objects, returning a C string.
1
5
0
In python 2.x versions there is a function named as PyString_AS_STRING to convert a pyobject pointer to a string or char pointer. How can we achieve the same functionality in python 3?
Replacement for PyString_AS_STRING in python 3.x
0.379949
0
0
1,590
2,960,855
2010-06-02T19:16:00.000
0
0
1
0
python
2,960,944
4
false
0
0
Add all keys and associated values from both sets of data to a single dictionary. Get the items of the dictionary ans sort them. print out the answer. k1=[7, 2, 3, 5] v1=[10,11,12,26] k2=[0, 4] v2=[20, 33] d=dict(zip(k1,v1)) d.update(zip(k2,v2)) answer=d.items() answer.sort() keys=[k for (k,v) in answer] values=[v for (k,v) in answer] print keys print values Edit: This is for Python 2.6 or below which do not have any ordered dictionary.
1
1
1
I have the following 4 arrays ( grouped in 2 groups ) that I would like to merge in ascending order by the keys array. I can use also dictionaries as structure if it is easier. Has python any command or something to make this quickly possible? Regards MN # group 1 [7, 2, 3, 5] #keys [10,11,12,26] #values [0, 4] #keys [20, 33] #values # I would like to have [ 0, 2, 3, 4, 5, 7 ] # ordered keys [20, 11,12,33,26,33] # associated values
merging in python
0
0
0
125
2,960,864
2010-06-02T19:17:00.000
0
0
1
0
python,save
50,144,944
7
false
0
0
You can save it as a text file or a CVS file. People use Spyder for example to save variables but it has a known issue: for specific data types it fails to import down in the road.
1
115
0
I want to save all the variables in my current python environment. It seems one option is to use the 'pickle' module. However, I don't want to do this for 2 reasons: I have to call pickle.dump() for each variable When I want to retrieve the variables, I must remember the order in which I saved the variables, and then do a pickle.load() to retrieve each variable. I am looking for some command which would save the entire session, so that when I load this saved session, all my variables are restored. Is this possible? Edit: I guess I don't mind calling pickle.dump() for each variable that I would like to save, but remembering the exact order in which the variables were saved seems like a big restriction. I want to avoid that.
How to save all the variables in the current python session?
0
0
0
115,543
2,961,317
2010-06-02T20:22:00.000
39
0
0
0
python,django,post
2,961,413
1
true
1
0
If your request is post: request.method == 'POST' but the requested url contains a query string. e.g: /your-url?param1=value-one you can still take POST parameters through: request.POST.get("my-field", None) and query string parameters through: request.GET.get("param1") althrough, you pick up all parameters at once (POST and GET), through REQUEST: request.REQUEST['param1'] # comes from query string request.REQUEST['my-field'] # comes from request BODY (POST)
1
14
0
Please post example code when request.POST contain query string in django, because i think my django version is bugged. EDIT: You simple can't, query string is always in GET, and this was my problem.
Example when request.POST contain query string in django
1.2
0
0
21,210
2,961,402
2010-06-02T20:36:00.000
1
0
0
0
php,python,django
2,961,525
4
false
1
0
No. You can only do a LOT better. Awesome, popular. Supported by best hosters like Mediatemple. No. You can just change 'mysql' to 'postgresql' or 'sqlite' in your settings.py. NO! Python would never give you the right to mix up everything in one file and make the shittest shit in the world. Templates, static server. Django is a Model-Template-View framework, great for any applications, from small to huge. PHP works fine only with small apps. Yeah, PHP == Personal Home Page, lol. P.S. Also you can minify your CSS and JS. And compile to one single file (one js, one css). All with django-assets. And yeah, there's a lot more reusable Django apps (for registration, twi/facebook/openid auth, oembed, other stuff). Just search Bitbucket and Github for "django". No need to reinvent a bicycle, like you do with PHP.
2
4
0
Here's my background: Decent experience with PHP/MySql. Beginner's experience with OOP Why I want to learn Python Django? I gave in, based on many searches on SO and reading over some of the answers, Python is a great, clean, and structured language to learn. And with the framework Django, it's easier to write codes that are shorter than with PHP Questions Can i do everything in Django as in PHP? Is Django a "big" hit in web development as PHP? I know Python is a great general-purpose language but I'm focused on web development and would like to know how Django ranks in terms of web development. With PHP, PHP and Mysql are VERY closely related, is there a close relation between Django and Mysql? In PHP, you can easily switch between HTML, CSS, PHP all in one script. Does Python offer this type of ease between other languages? Or how do I incorporate HTML, CSS, javascript along with Python?
How to transition from PHP to Python Django?
0.049958
0
0
3,852
2,961,402
2010-06-02T20:36:00.000
6
0
0
0
php,python,django
2,961,490
4
true
1
0
Can i do everything in Django as in PHP? Always Is Django a "big" hit in web development as PHP? Only time will tell. With PHP, PHP and Mysql are VERY closely related, is there a close relation between Django and Mysql? Django supports several RDBMS interfaces. MySQL is popular, so is SQLite and Postgres. In PHP, you can easily switch between HTML, CSS, PHP all in one script. That doesn't really apply at all to Django. Or how do I incorporate HTML, CSS, javascript along with Python? Actually do the Django tutorial. You'll see how the presentation (via HTML created by templates) and the processing (via Python view functions) fit together. It's not like PHP.
2
4
0
Here's my background: Decent experience with PHP/MySql. Beginner's experience with OOP Why I want to learn Python Django? I gave in, based on many searches on SO and reading over some of the answers, Python is a great, clean, and structured language to learn. And with the framework Django, it's easier to write codes that are shorter than with PHP Questions Can i do everything in Django as in PHP? Is Django a "big" hit in web development as PHP? I know Python is a great general-purpose language but I'm focused on web development and would like to know how Django ranks in terms of web development. With PHP, PHP and Mysql are VERY closely related, is there a close relation between Django and Mysql? In PHP, you can easily switch between HTML, CSS, PHP all in one script. Does Python offer this type of ease between other languages? Or how do I incorporate HTML, CSS, javascript along with Python?
How to transition from PHP to Python Django?
1.2
0
0
3,852
2,961,983
2010-06-02T22:08:00.000
0
0
1
0
python
45,991,093
7
false
0
0
The + operator concatenates lists and the starting value is [] an empty list.
1
35
0
A multidimensional list like l=[[1,2],[3,4]] could be converted to a 1D one by doing sum(l,[]). Can anybody please explain how that happens? A responder said that this technique could only be used to "flatten" a 2D list -- that it wouldn't work for higher multidimensional lists. But it does, if repeated. For example if A is a 3D-list, then sum(sum(A),[]),[]) will flatten A to a 1D list.
Convert multi-dimensional list to a 1D list in Python
0
0
0
82,942
2,962,194
2010-06-02T22:54:00.000
3
0
0
0
python,user-interface,wxpython,tkinter
2,962,443
5
false
0
1
The most beautiful one that I can suggest is PyQt (almost native), otherwise a good idea would be using directly IronPython that is native .net code. Anyway nothing beats tkinter for multi-platformness and packaging-friendliness.
4
3
0
I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable. The functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing/exotic things. Seems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that: Is easy to learn and maintain Can be cleanly packaged using py2exe or something similar Looks nice [Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute.
Python: Attractive, clean, packagable windows GUI library
0.119427
0
0
4,853
2,962,194
2010-06-02T22:54:00.000
1
0
0
0
python,user-interface,wxpython,tkinter
2,962,216
5
false
0
1
From using both wxPython and TKinter, I'd say wxPython looks nicer and is easy to learn. Although you said you are planning on using the program for Windows, it's worth mentioning that I've had problems with TKinter on Mac not working correctly.
4
3
0
I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable. The functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing/exotic things. Seems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that: Is easy to learn and maintain Can be cleanly packaged using py2exe or something similar Looks nice [Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute.
Python: Attractive, clean, packagable windows GUI library
0.039979
0
0
4,853
2,962,194
2010-06-02T22:54:00.000
1
0
0
0
python,user-interface,wxpython,tkinter
2,962,200
5
false
0
1
I've used wxPython in the past (For Mac/Windows deployments). It has worked good. And it looks nicer than Tk :)
4
3
0
I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable. The functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing/exotic things. Seems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that: Is easy to learn and maintain Can be cleanly packaged using py2exe or something similar Looks nice [Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute.
Python: Attractive, clean, packagable windows GUI library
0.039979
0
0
4,853
2,962,194
2010-06-02T22:54:00.000
3
0
0
0
python,user-interface,wxpython,tkinter
2,962,228
5
true
0
1
tkinter's major advantage (IMHO!) is that it comes with Python (at least on Windows). It looks ugly, and there's no progress bar or something like that (at least not builtin). Being a thin wrapper around Tk, its API doesn't feel very elegant or intuitive. However, there are quite a few good Tkinter resources on the web so learning it is not necessarily a pain. For any serious GUI attempts, I'd go for wxPython as well. I don't know about packaging, though. But I wouldn't expect any problems.
4
3
0
I need to create a simple windows based GUI for a desktop application that will be downloaded by end users. The application is written in python and will be packaged as an installer or executable. The functionality I need is simple - selecting from various lists, showing progress bars, etc. No animations, sprites, or other taxing/exotic things. Seems there are quite a few options for Python GUI libraries (Tk, QT, wxPython, Gtk, etc). What do you recommend that: Is easy to learn and maintain Can be cleanly packaged using py2exe or something similar Looks nice [Update] For what it's worth I ended up going with tkinter. It's fairly well documented, can be made to look nice (mainly, use native fonts), and most importantly ships with Python so there's nothing extra to worry about. wxpython also looked good, but the download was 10M or so, and I didn't want to add that extra weight to the packages I distribute.
Python: Attractive, clean, packagable windows GUI library
1.2
0
0
4,853
2,962,571
2010-06-03T00:28:00.000
13
0
1
0
python,graphics,pyopengl
2,962,599
2
true
0
1
With the caveat that I have done very little OpenGL programming myself, I believe that for the purposes of learning, PyOpenGL is a good choice. The main reason is that PyOpenGL, like most other OpenGL wrappers, is just that: a thin wrapper around the OpenGL API. One large benefit of PyOpenGL is that while in C you have to worry about calling the proper glVertex3{dfiX} command, Python allows you to just write glVertex3(x,y,z) without worrying about telling Python what type of argument you passed in. That might not sound like a big deal, but it's often much simpler to use Python's duck-typing instead of being overly concerned with static typing. The OpenGL methods are almost completely all wrapped into Python methods, so while you'll be writing in Python, the algorithms and method calls you'll use are identical to writing OpenGL in any other language. But since you're writing in Python, you'll have many fewer opportunities to make "silly" mistakes with proper pointer usage, memory management, etc. that would just eat up your time if you were to study the API in C or C++, for instance.
2
9
0
I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble? I know C++ gives better performance, but for just learning can I go wrong with PyOpenGL?
Is PyOpenGL a good place to start learning opengl programming?
1.2
0
0
3,573
2,962,571
2010-06-03T00:28:00.000
0
0
1
0
python,graphics,pyopengl
2,963,034
2
false
0
1
PyOpenGL I don't think it is a good choice. In my opinon in C/C++ it is easier to play around around with your OpenGL code - start with simple app, then add shader, then add some geometry functions, make a texture/geometry generator, build scene via CSG, etc. You know - to have fun, play around with code, experiment and learn something in process. I honestly just don't see myself doing this in python. Surely it is possible to do OpenGL programming in Python, but I see no reason to actually do it. Plus several OpenGL functions take memory pointers as arguments, and although there probably a class (or dozen of alternatives) for that case, I don't see a reason to use them when a traditional way of doing things is available in C/C++, especially when I think about amount of wrappers python code uses to pass vector or array of those into OpenGL function. It just looks like making things more complicated without a real reason to do that. Plus there is a noticeable performance drop, especially when you use "RAW" OpenGL. Besides, if you're going to make games, it is very likely that you'll have to use C++ or some other "non-python" language. P.S. I've done enough OpenGL programming, a lot of DirectX programming, but I specialize on C++, and use python only for certain algorithmic tests, tools and scripts.
2
9
0
I want to start learning OpenGL but I don't really want to have to learn another language to do it. I already am pretty proficient in python and enjoy the language. I just want to know how close it is to the regular api? Will I be able to pretty easily follow tutorials and books without too much trouble? I know C++ gives better performance, but for just learning can I go wrong with PyOpenGL?
Is PyOpenGL a good place to start learning opengl programming?
0
0
0
3,573
2,962,597
2010-06-03T00:33:00.000
1
0
0
1
python,windows,windows-services
2,962,625
1
true
0
0
Sorted, I had the service run a python script with win32api.GetUserName() as it's output.
1
1
0
Can python retrieve the name of the user that owns a windows service? I've had a fiddle with win32serviceutil but to no avail, nor can I find much documentation on it beyond starting and stopping services. Thanks!
Python retrieving windows service information
1.2
0
0
128
2,963,615
2010-06-03T05:59:00.000
9
0
1
0
java,python,ruby
2,965,919
3
true
1
0
This is not a question about Ruby, Python or Java, but more about a specific implementation of Ruby, Python or Java. There are Java implementations with extremely efficient threading implementations and there are Java implementations with extremely bad threading implementations. And the same is true for Ruby and Python, and really basically any language at all. Even languages like Erlang, where an inefficient threading implementation doesn't even make sense, sometimes have bad threading implementations. For example, if you use JRuby or Jython, then your Ruby and Python threads are Java threads. So, they are not only as efficient as Java threads, they are exactly the same as Java threads.
2
2
0
i wonder if the multi threading in python/ruby is equivalent to the one in java? by that i mean, is it as efficient? cause if you want to create a chat application that use comet technology i know that you have to use multi threading. does this mean that i can use python or ruby for that or is it better with java? thanks
multi threading python/ruby vs java?
1.2
0
0
5,035
2,963,615
2010-06-03T05:59:00.000
1
0
1
0
java,python,ruby
2,966,837
3
false
1
0
philosodad is not wrong to point out the constraint that the GIL presents. I won't speak for Ruby, but I am sure that it's safe to assume that when you refer to Python that you are in fact referring to the canonical cPython implementation. In the case of cPython, the GIL matters most if you want to parallelize computationally intensive operations implemented in Python (as in not in C extensions where the GIL can be released). However, when you are writing a non-intensive I/O-bound application such as a chat program, the efficiency of the threading implementation really just doesn't matter all that much.
2
2
0
i wonder if the multi threading in python/ruby is equivalent to the one in java? by that i mean, is it as efficient? cause if you want to create a chat application that use comet technology i know that you have to use multi threading. does this mean that i can use python or ruby for that or is it better with java? thanks
multi threading python/ruby vs java?
0.066568
0
0
5,035
2,964,108
2010-06-03T07:47:00.000
0
0
0
0
python,button,wxpython,toolbar,position
3,172,009
1
true
0
1
If you add the quit button last, it will be on the right side.
1
0
0
I'm making a toolbar using wxpython and I want to put the Quit button on the right side of it, I don't want to put them sequencially. Is it possible to define this position? Thanks in advance!
Is it possible to put a toolbar button on the right side of it using wxpython?
1.2
0
0
292
2,964,910
2010-06-03T10:08:00.000
6
0
1
0
python,ironpython
2,964,931
3
true
0
0
Yes, Python and IronPython are completely different applications that happen to implement (almost) the same language.
3
4
0
I am a total newbie in the Python world. I want to start to experiment with Python and IronPython and compare the results. Is it possible to install Python and IronPython on the same machine with interfering each other or is it better to do this in the virtual machine. Thx in advance.
Python and IronPython on same machine?
1.2
0
0
562
2,964,910
2010-06-03T10:08:00.000
1
0
1
0
python,ironpython
2,964,929
3
false
0
0
Should be no problem, they have different executable filenames also.
3
4
0
I am a total newbie in the Python world. I want to start to experiment with Python and IronPython and compare the results. Is it possible to install Python and IronPython on the same machine with interfering each other or is it better to do this in the virtual machine. Thx in advance.
Python and IronPython on same machine?
0.066568
0
0
562
2,964,910
2010-06-03T10:08:00.000
0
0
1
0
python,ironpython
2,966,944
3
false
0
0
Sure, you could even install different versions of cPython interpreter (2.5, 2.6, 3.0, etc).
3
4
0
I am a total newbie in the Python world. I want to start to experiment with Python and IronPython and compare the results. Is it possible to install Python and IronPython on the same machine with interfering each other or is it better to do this in the virtual machine. Thx in advance.
Python and IronPython on same machine?
0
0
0
562
2,966,618
2010-06-03T13:57:00.000
1
1
0
1
c++,python,code-generation
2,966,999
8
false
0
0
A few years ago I worked on a project to simplify interprocess shared memory management for large scale simulation systems. We used a related approach where the layout of data in shared memory was defined in XML files and a code generator, written in python, read the XML and spit out a set of header files defining structures and associated functions/operators/etc to match the XML description. At the time, I looked at several templating engines and, to my surprise, found it was easier and very straight-forward to just do it "by hand". As you read the XML, just populate a set of data structures that match your code. Header file objects contain classes and classes contain variables (which may be of other class types). Give each object a printSelf() method that iterates over its contents and calls printSelf() for each object it contains. It seems a little daunting at first but once you get started, it's pretty straight-forward. Oh, and one tip that helps with the generated code, add an indentation argument to printSelf() and increase it at each level. It makes the generated code much easier to read.
1
12
0
Can anyone point me to some documentation on how to write scripts in Python (or Perl or any other Linux friendly script language) that generate C++ code from XML or py files from the command line. I'd like to be able to write up some xml files and then run a shell command that reads these files and generates .h files with fully inlined functions, e.g. streaming operators, constructors, etc.
C++ code generation with Python
0.024995
0
0
23,299
2,967,194
2010-06-03T15:05:00.000
6
0
1
1
python,linux,file-io,file-permissions
17,250,611
17
false
0
0
I think it's r+, not rw. I'm just a starter, and that's what I've seen in the documentation.
4
841
0
What is the best way to open a file as read/write if it exists, or if it does not, then create it and open it as read/write? From what I read, file = open('myfile.dat', 'rw') should do this, right? It is not working for me (Python 2.6.2) and I'm wondering if it is a version problem, or not supposed to work like that or what. The bottom line is, I just need a solution for the problem. I am curious about the other stuff, but all I need is a nice way to do the opening part. The enclosing directory was writeable by user and group, not other (I'm on a Linux system... so permissions 775 in other words), and the exact error was: IOError: no such file or directory.
open() in Python does not create a file if it doesn't exist
1
0
0
1,119,129
2,967,194
2010-06-03T15:05:00.000
31
0
1
1
python,linux,file-io,file-permissions
2,967,244
17
false
0
0
Change "rw" to "w+" Or use 'a+' for appending (not erasing existing content)
4
841
0
What is the best way to open a file as read/write if it exists, or if it does not, then create it and open it as read/write? From what I read, file = open('myfile.dat', 'rw') should do this, right? It is not working for me (Python 2.6.2) and I'm wondering if it is a version problem, or not supposed to work like that or what. The bottom line is, I just need a solution for the problem. I am curious about the other stuff, but all I need is a nice way to do the opening part. The enclosing directory was writeable by user and group, not other (I'm on a Linux system... so permissions 775 in other words), and the exact error was: IOError: no such file or directory.
open() in Python does not create a file if it doesn't exist
1
0
0
1,119,129
2,967,194
2010-06-03T15:05:00.000
6
0
1
1
python,linux,file-io,file-permissions
2,967,395
17
false
0
0
What do you want to do with file? Only writing to it or both read and write? 'w', 'a' will allow write and will create the file if it doesn't exist. If you need to read from a file, the file has to be exist before open it. You can test its existence before opening it or use a try/except.
4
841
0
What is the best way to open a file as read/write if it exists, or if it does not, then create it and open it as read/write? From what I read, file = open('myfile.dat', 'rw') should do this, right? It is not working for me (Python 2.6.2) and I'm wondering if it is a version problem, or not supposed to work like that or what. The bottom line is, I just need a solution for the problem. I am curious about the other stuff, but all I need is a nice way to do the opening part. The enclosing directory was writeable by user and group, not other (I'm on a Linux system... so permissions 775 in other words), and the exact error was: IOError: no such file or directory.
open() in Python does not create a file if it doesn't exist
1
0
0
1,119,129
2,967,194
2010-06-03T15:05:00.000
4
0
1
1
python,linux,file-io,file-permissions
33,069,611
17
false
0
0
Put w+ for writing the file, truncating if it exist, r+ to read the file, creating one if it don't exist but not writing (and returning null) or a+ for creating a new file or appending to a existing one.
4
841
0
What is the best way to open a file as read/write if it exists, or if it does not, then create it and open it as read/write? From what I read, file = open('myfile.dat', 'rw') should do this, right? It is not working for me (Python 2.6.2) and I'm wondering if it is a version problem, or not supposed to work like that or what. The bottom line is, I just need a solution for the problem. I am curious about the other stuff, but all I need is a nice way to do the opening part. The enclosing directory was writeable by user and group, not other (I'm on a Linux system... so permissions 775 in other words), and the exact error was: IOError: no such file or directory.
open() in Python does not create a file if it doesn't exist
0.047024
0
0
1,119,129
2,968,127
2010-06-03T17:00:00.000
0
1
0
0
python,ldap
2,968,258
2
false
0
0
Your best bet would be to get authorization to access that field. You are circumventing the security of the database otherwise.
1
0
0
I'm interested in reproducing a particular python script. I have a friend who was accessing an ldap database, without authentication. There was a particular field of interest, we'll call it nin (an integer) for reference, and this field wasn't accessible without proper authentication. However, my friend managed to access this field through some sort of binary search (rather than just looping through integers) on the data; he would check the first digit, check if it was greater or less than the starting value, he would augment that until it returned a true value indicating existence, adding digits and continuing checking until he found the exact value of the integer nin. Any ideas on how he went about this? I've access to a similarly set up database.
Binary search of unaccesible data field in ldap from python
0
0
0
231
2,968,172
2010-06-03T17:06:00.000
1
0
0
0
c++,python,serialization
2,968,306
7
false
0
0
I would propose simply to use c arrays(via ctypes on the python side) and simply pull/push the raw data through an socket
2
3
1
I two programs running, one in Python and one in C++, and I need to share a two-dimensional array (just of decimal numbers) between them. I am currently looking into serialization, but pickle is python-specific, unfortunately. What is the best way to do this? Thanks Edit: It is likely that the array will only have 50 elements or so, but the transfer of data will need to occur very frequently: 60x per second or more.
How to share an array in Python with a C++ Program?
0.028564
0
0
2,433
2,968,172
2010-06-03T17:06:00.000
1
0
0
0
c++,python,serialization
2,968,375
7
false
0
0
Serialization is one problem while IPC is another. Do you have the IPC portion figured out? (pipes, sockets, mmap, etc?) On to serialization - if you're concerned about performance more than robustness (being able to plug more modules into this architecture) and security, then you should take a look at the struct module. This will let you pack data into C structures using format strings to define the structure (takes care of padding, alignment, and byte ordering for you!) In the C++ program, cast a pointer to the buffer to the corresponding structure type. This works well with a tightly-coupled Python script and C++ program that is only run internally.
2
3
1
I two programs running, one in Python and one in C++, and I need to share a two-dimensional array (just of decimal numbers) between them. I am currently looking into serialization, but pickle is python-specific, unfortunately. What is the best way to do this? Thanks Edit: It is likely that the array will only have 50 elements or so, but the transfer of data will need to occur very frequently: 60x per second or more.
How to share an array in Python with a C++ Program?
0.028564
0
0
2,433
2,968,381
2010-06-03T17:35:00.000
1
1
0
0
java,php,python,jython
2,968,495
5
false
1
0
Well: Java Server Pages (JSP) are "equivalent" to PHP, but using java classes. It's "equivalent" in that it's HTML with embedded java code, but not at all compatible to PHP syntax.
2
4
0
i wonder if there is a php equivalent to jython so you can use java classes with php? thanks
php equivalent to jython?
0.039979
0
0
494
2,968,381
2010-06-03T17:35:00.000
1
1
0
0
java,php,python,jython
2,968,418
5
false
1
0
I just googled php jvm and got a bunch of hits. Never tried any of them.
2
4
0
i wonder if there is a php equivalent to jython so you can use java classes with php? thanks
php equivalent to jython?
0.039979
0
0
494
2,968,809
2010-06-03T18:40:00.000
0
1
1
0
python,distribution,egg
3,063,352
2
true
0
0
What I ended up doing was: Ran PYTHONPATH=fullPathOfMyEgg in command line Was then able to do import someModuleInMyEgg from my Python code I'm not sure if this is the most standard or accepted way to do it, but it worked. If anyone has any comments or other methods, please feel free to add...
1
6
0
I've finally figured out how to create a Python egg and gotten it to work. Now... what do I do with it? How do I use it? How do I ensure that everything was correctly included? (Simple steps please... not just redirection to another site. I've googled, but it's confusing me, and I was hoping someone could explain it in a couple of simple bullet points or sentences.) Edit: I asked this question a couple of weeks ago, and I'm clarifying now in the hope of getting clearer answers... basically, I have an egg, I want to take it to another machine and be able to use it and import modules from it from my (other, unrelated) code. How do I do this?
I created a Python egg; now what?
1.2
0
0
612
2,969,593
2010-06-03T20:40:00.000
5
0
0
0
python,random,n-dimensional
2,969,618
4
true
0
0
Numpy has multidimensional equivalents to the functions in the random module The function you're looking for is numpy.random.normal
2
2
1
I'm trying to generate random numbers from a gaussian distribution. Python has the very useful random.gauss() method, but this is only a one-dimensional random variable. How could I programmatically generate random numbers from this distribution in n-dimensions? For example, in two dimensions, the return value of this method is essentially distance from the mean, so I would still need (x,y) coordinates to determine an actual data point. I suppose I could generate two more random numbers, but I'm not sure how to set up the constraints. I appreciate any insights. Thanks!
Generate n-dimensional random numbers in Python
1.2
0
0
5,620
2,969,593
2010-06-03T20:40:00.000
1
0
0
0
python,random,n-dimensional
2,969,634
4
false
0
0
You need to properly decompose your multi-dimensional distribution into a composition of one-dimensional distributions. For example, if you want a point at a Gaussian-distributed distance from a given center and a uniformly-distributed angle around it, you'll get the polar coordinates for the delta with a Gaussian rho and a uniform theta (between 0 and 2 pi), then, if you want cartesian coordinates, you of course do a coordinate transformation.
2
2
1
I'm trying to generate random numbers from a gaussian distribution. Python has the very useful random.gauss() method, but this is only a one-dimensional random variable. How could I programmatically generate random numbers from this distribution in n-dimensions? For example, in two dimensions, the return value of this method is essentially distance from the mean, so I would still need (x,y) coordinates to determine an actual data point. I suppose I could generate two more random numbers, but I'm not sure how to set up the constraints. I appreciate any insights. Thanks!
Generate n-dimensional random numbers in Python
0.049958
0
0
5,620
2,969,867
2010-06-03T21:19:00.000
117
0
0
0
python,matplotlib
29,524,883
5
false
0
0
If you don't want to change the spacing globally (by editing your rcParams), and want a cleaner approach, try this: ax.tick_params(axis='both', which='major', pad=15) or for just x axis ax.tick_params(axis='x', which='major', pad=15) or the y axis ax.tick_params(axis='y', which='major', pad=15)
1
86
1
I've increased the font of my ticklabels successfully, but now they're too close to the axis. I'd like to add a little breathing room between the ticklabels and the axis.
How do I add space between the ticklabels and the axes in matplotlib
1
0
0
89,545
2,970,207
2010-06-03T22:20:00.000
2
0
0
0
python,string,image,opencv,byte
2,980,849
2
false
0
1
I actually solved this problem and forgot to post the solution. Here's how I did it, though it may not be entirely robust: I analyzed the headers coming from the MJPEG of the network camera I was doing this to, then I just read from the stream 1 byte at a time, and, when I detected that the header of the next image was also in the bytestring, I cut the last 42 bytes off (since that's the length of the header). Then I had the bytes of the JPEG, so I simply created a new Cv Image by using the open(...) method and passing it the byte string wrapped in a StringIO class.
1
3
0
I am streaming some data down from a webcam. When I get all of the bytes for a full image (in a string called byteString) I want to display the image using OpenCV. Done fast enough, this will "stream" video from the webcam to an OpenCV window. Here's what I've done to set up the window: cvNamedWindow('name of window', CV_WINDOW_AUTOSIZE) And here's what I do when the byte string is complete: img = cvCreateImage(IMG_SIZE,PIXEL_DEPTH,CHANNELS) buf = ctypes.create_string_buffer(byteString) img.imageData = ctypes.cast(buf, ctypes.POINTER(ctypes.c_byte)) cvShowImage('name of window', img) cvWaitKey(0) For some reason this is producing an error: File "C:\Python26\lib\site-packages\ctypes_opencv\highgui_win32.py", line 226, in execute return func(*args, **kwargs) WindowsError: exception: access violation reading 0x015399E8 Does anybody know how to do what I'm trying to do / how to fix this crazy violation error?
from string of bytes to OpenCV's IplImage in Python?
0.197375
0
0
1,712
2,971,094
2010-06-04T02:15:00.000
2
0
0
0
python,netbeans
2,971,227
4
false
0
1
I haven't seen a built-in GUI builder for CPython. You could use Jython + Matisse (the built-in Netbeans Java-based GUI builder).
1
5
0
Is NetBeans recommended for developing a GUI for a Python app? Does it have a form/screen builder for Python apps, like Dabo?
Using NetBeans for Python GUI development
0.099668
0
0
11,421
2,971,198
2010-06-04T02:49:00.000
7
0
0
0
python,mysql,database,django,date
3,027,410
5
true
1
0
First, thanks for all your answers. None of them, as is, was a good solution for my problem, but, for your defense, I should add that I didn't give all the requirements. But each one help me think about my problem and some of your ideas are part of my final solution. So my final solution, on the DB side, is to use a varchar field (limited to 10 chars) and storing the date in it, as a string, in the ISO format (YYYY-MM-DD) with 00 for month and day when there's no month and/or day (like a date field in MySQL). This way, this field can work with any databases, the data can be read, understand and edited directly and easily by a human using a simple client (like mysql client, phpmyadmin, etc.). That was a requirement. It can also be exported to Excel/CSV without any conversion, etc. The disadvantage is that the format is not enforce (except in Django). Someone could write 'not a date' or do a mistake in the format and the DB will accept it (if you have an idea about this problem...). This way it's also possible to do all of the special queries of a date field relatively easily. For queries with WHERE: <, >, <=, >= and = work directly. The IN and BETWEEN queries work directly also. For querying by day or month you just have to do it with EXTRACT (DAY|MONTH ...). Ordering work also directly. So I think it covers all the query needs and with mostly no complication. On the Django side, I did 2 things. First, I have created a PartialDate object that look mostly like datetime.date but supporting date without month and/or day. Inside this object I use a datetime.datetime object to keep the date. I'm using the hours and minutes as flag that tell if the month and day are valid when they are set to 1. It's the same idea that steveha propose but with a different implementation (and only on the client side). Using a datetime.datetime object gives me a lot of nice features for working with dates (validation, comparaison, etc.). Secondly, I have created a PartialDateField that mostly deal with the conversion between the PartialDate object and the database. So far, it works pretty well (I have mostly finish my extensive unit tests).
1
8
0
In one of my Django projects that use MySQL as the database, I need to have a date fields that accept also "partial" dates like only year (YYYY) and year and month (YYYY-MM) plus normal date (YYYY-MM-DD). The date field in MySQL can deal with that by accepting 00 for the month and the day. So 2010-00-00 is valid in MySQL and it represent 2010. Same thing for 2010-05-00 that represent May 2010. So I started to create a PartialDateField to support this feature. But I hit a wall because, by default, and Django use the default, MySQLdb, the python driver to MySQL, return a datetime.date object for a date field AND datetime.date() support only real date. So it's possible to modify the converter for the date field used by MySQLdb and return only a string in this format 'YYYY-MM-DD'. Unfortunately the converter use by MySQLdb is set at the connection level so it's use for all MySQL date fields. But Django DateField rely on the fact that the database return a datetime.date object, so if I change the converter to return a string, Django is not happy at all. Someone have an idea or advice to solve this problem? How to create a PartialDateField in Django ? EDIT Also I should add that I already thought of 2 solutions, create 3 integer fields for year, month and day (as mention by Alison R.) or use a varchar field to keep date as string in this format YYYY-MM-DD. But in both solutions, if I'm not wrong, I will loose the special properties of a date field like doing query of this kind on them: Get all entries after this date. I can probably re-implement this functionality on the client side but that will not be a valid solution in my case because the database can be query from other systems (mysql client, MS Access, etc.)
How to deal with "partial" dates (2010-00-00) from MySQL in Django?
1.2
1
0
4,080
2,971,309
2010-06-04T03:25:00.000
0
0
0
0
python,django,netbeans,ide
2,971,775
3
false
1
0
Netbeans doesn't have a django plugin that I know of. Eclipse's pydev plugin is decent, I typically use any ol' editor and bpython. I've heard great things about wingware and intellij's new python ide is pretty good.
1
10
0
I use netbeans for all of my Linux development (C/C++, Php, Python, Symfony). I am now learning django, and wondered if I could use netbeans as the IDE. I cant seem to find a Django plugin for netbeans. Is there one?. If no when is one planned? Worst case scenario, I'll have to use another IDE (I really dont want to learn another IDE) - But, If so, what do you guys use for django development?
django and netbeans?
0
0
0
19,247
2,971,381
2010-06-04T03:46:00.000
3
0
1
0
python
2,975,327
4
false
0
0
is there a better way of doing this? Yes I was thinking of launching multiple threads since the I/O bound operations Don't. At the OS level, all the threads in a process are sharing a limited set of I/O resources. If you want real speed, spawn as many heavyweight OS processes as your platform will tolerate. The OS is really, really good about balancing I/O workloads among processes. Make the OS sort this out. Folks will say that spawning 3000 processes is bad, and they're right. You probably only want to spawn a few hundred at a time. What you really want is the following. A shared message queue in which the 3000 URI's are queued up. A few hundred workers which are all reading from the queue. Each worker gets a URI from the queue and gets the file. The workers can stay running. When the queue's empty, they'll just sit there, waiting for work. "every few minutes" you dump the 3000 URI's into the queue to make the workers start working. This will tie up every resource on your processor, and it's quite trivial. Each worker is only a few lines of code. Loading the queue is a special "manager" that's just a few lines of code, also.
1
10
0
I have a situation where I'm downloading a lot of files. Right now everything runs on one main Python thread, and downloads as many as 3000 files every few minutes. The problem is that the time it takes to do this is too long. I realize Python has no true multi-threading, but is there a better way of doing this? I was thinking of launching multiple threads since the I/O bound operations should not require access to the global interpreter lock, but perhaps I misunderstand that concept.
How to maximize performance in Python when doing many I/O bound operations?
0.148885
0
0
5,176
2,972,696
2010-06-04T08:58:00.000
0
0
1
0
python,eclipse,eclipse-plugin,pydev
3,211,758
2
true
0
1
I had no luck with this. Eventually I had to download it through Eclipse download manager and it worked. I guess they have some issues with the automatic plugin functionality.
1
2
0
I have downloaded the zip archive (my only option) and installed it as suggested by unzipping into the dropin folder. When I try to start a project the problem occurs: "Plug-in org.python.pydev was unable to load class org.python.pydev.ui.wizard.project.PythonProjectWizard" I've googled and the only suggestion is to re-download and re-install as it might be a corrupted install. Done that, no good. Any more suggestions? Seems PyDev have a lot of troubles getting the zip alternative to work... (judging by other similar posts) This is regardless of Eclipse version. I run under WinXP.
PyDev problem staring project
1.2
0
0
3,435
2,973,591
2010-06-04T11:21:00.000
0
0
0
0
python,ajax,django,comet,chat
2,973,756
2
false
1
0
ajax is the best here what you will need: 1) server view that will return recent messages 2) client-side caller by timer (I prefer jQuery and its timers plugin) and success handler, that will populate the chat window
1
2
0
I need to create a chat similar to facebook chat. I am thinking to create a simple application Chat and then using ajax polling ( to send request every 2-3 seconds ). Is this a good approach ?
Django chat with ajax polling
0
0
0
3,357
2,974,781
2010-06-04T13:59:00.000
4
0
1
0
python,sockets,twisted
2,974,890
4
false
0
0
Twisted is a concurrency framework. It allows you to juggle multiple tasks in one application without using threads/processes. It does this using an event driven asynchronous system and is especially good with networking applications. Asynchronous code generally tends to be a little 'different' from normal stuff since the flow is not explicit and things happen based on external events. This can be confusing but it works. Twisted is arguably the most mature Python async concurrency library so if that's what you're planning to do, twisted is a good thing to bet on. "Simple sockets" as you put them are communication primitives and not really comparable to twisted. What are you trying to do?
1
7
0
I keep hearing all this hype about Twisted for python, but i just find it plain confusing. What do you think is more simple to use? Simple sockets or implementing twisted ?
Is twisted any good?
0.197375
0
0
5,395
2,975,473
2010-06-04T15:19:00.000
2
0
1
0
python,import,cross-platform
2,975,495
1
true
0
0
You use import to include the function in other programs. Just say import mymodule where the code is located in file mymodule.py. Then say mymodule.fib to use the function. To answer your second question: The syntax print "any string" is acceptable in Python 2, but is no longer allowed in Python 3.
1
0
0
i've a small user defined function in python, say fib(n), how do i use that in other programs or modules? def fib(n): should i use import or is there any other feature? Also i'm learning python in eclipse IDE, it wont support print "any string" but i'm forced to use like, print("string") in python manual online, its given its cross platform and same syntax, but why like above?
include udf in python?
1.2
0
0
136
2,975,624
2010-06-04T15:39:00.000
37
1
0
1
python,service,cron
2,975,852
12
false
0
0
If you've already started the process, and don't want to kill it and restart under nohup, you can send it to the background, then disown it. Ctrl+Z (suspend the process) bg (restart the process in the background disown %1 (assuming this is job #1, use jobs to determine)
2
145
0
I have Python script bgservice.py and I want it to run all the time, because it is part of the web service I build. How can I make it run continuously even after I logout SSH?
How to run a script in the background even after I logout SSH?
1
0
0
252,941
2,975,624
2010-06-04T15:39:00.000
7
1
0
1
python,service,cron
69,754,988
12
false
0
0
Alternate answer: tmux ssh into the remote machine type tmux into cmd start the process you want inside the tmux e.g. python3 main.py leaving the tmux session by Ctrl+b then d It is now safe to exit the remote machine. When you come back use tmux attach to re-enter tmux session. If you want to start multiple sessions, name each session using Ctrl+b then $. then type your session name. to list all session use tmux list-sessions to attach a running session use tmux attach-session -t <session-name>.
2
145
0
I have Python script bgservice.py and I want it to run all the time, because it is part of the web service I build. How can I make it run continuously even after I logout SSH?
How to run a script in the background even after I logout SSH?
1
0
0
252,941
2,976,446
2010-06-04T17:36:00.000
6
0
0
0
python,logitech,g15
2,976,466
2
false
0
1
I believe the G15 comes with an SDK. You could use that along with the ctypes module to call into the supplied DLLs. Otherwise, I imagine you'd have to use something like Swig or Boost.Python to make a Python module for the G15 from the SDK.
1
3
0
I have a Logitech G15 keyboard. It has a screen. Can i program this? I googled it but the one site i found didn't work.. It seems like it is possible, but i cannot grasp how. Thanks! This site is truly great.
Is Python programming for Logitech G15 possible?
1
0
0
977
2,976,803
2010-06-04T18:37:00.000
2
0
0
0
.net,winforms,ironpython,ironpython-studio
2,978,656
1
true
0
1
There's no fix for this and there's likely not to be one because IronPython Studio isn't supported anymore. DataGridView.BeginInit is implemented explicitly and IronPython Studio is based upon IronPython 1.1. You might be able to work around with it by changing that to "ISupportInitialize.BeginInit(self._DataGridView1)" after importing ISupportInitialize but I doubt it'll survive round tripping through the designer. If you wanted to fix this yourself the source for IronPython Studio is available and you could try modifying the winforms designer code to notice the explicit interface implementation call and emit this code instead. That's likely just fixing IronPython's CodeDom generator. But really I'd advise you to move to IronPython Tools and WPF. Generating code for the WinForms designer doesn't really work that well with IronPython and WPF is much more suitable. An alternate plan would be to generate the WinForm w/ the designer in C# and subclass it from Python.
1
1
0
By just adding a datagridview in IronPython Studio it triggers a "DataGridView' object has no attribute 'BeginInit'". Is there a fix for this? The errors are gone if the lines self._DataGridView1.BeginInit() and self._DataGridView1.EndInit() are deleted, but that's not what it should be done to fix that
Adding a DataGridView in IronPython Studio Winforms gets a "'DataGridView' object has no attribute 'BeginInit'"
1.2
0
0
773
2,977,779
2010-06-04T21:01:00.000
1
0
0
0
python,xml
2,977,799
2
false
0
0
The safest way to add nodes to an XML document is to load it into a DOM, add the nodes programmatically and write it out again. There are several Python XML libraries. I have used minidom, but I have no reason to recommend it specifically over the others.
1
4
0
I wonder if it is better add an element by opening file, search 'good place' and add string which contains xml code. Or use some library... i have no idea. I know how can i get nodes and properties from xml through for example lxml but what's the simpliest and the best way to add?
add xml node to xml file with python
0.099668
0
1
4,733
2,977,824
2010-06-04T21:11:00.000
2
0
0
0
python,django,user-profile
2,978,805
2
false
1
0
If you do not want to modify/inherit from the original User model I'd say it's totally ok if the method is added to your UserProfile!
1
1
0
I've implemented a UserProfile model (as the Django 1.2 docs say is the proper way to save additional data about a User) which has a 'remaining_vacation_hours' field. In our current system, when a user fills out a Time Off Request, the remaining hours available should be checked to see that they have enough vacation to use, or otherwise be warned that they are asking for more than they have. Of course, vacation hours are annually replenished, so it would be appropriate for the system to check if the user would have additional vacation accrued for the dates they're asking off. Simply creating a get_remaining_vacation_hours() method would suffice, because other calculations or business logic that might need to be added in the future could be added to or called from that method. My question is, does it sound correct that the get_remaining_vacation_hours() method be added to the UserProfile model? It seems to make sense, but I wanted to verify with the community that I wasn't overlooking a better practice for this type of thing. Any ideas or suggestions are welcome.
Proper way to define "remaining time off" for a Django User
0.197375
0
0
218
2,978,801
2010-06-05T01:53:00.000
5
1
0
1
python,ruby
2,979,717
6
false
0
0
Personally, I find the documentation for Python is much better than that for Ruby. The Docs for Ruby are full of cryptic examples that are terse, short, and just not very helpful. On the other hand, docs for Python exist everywhere, but more importantly, in a useful, helpful form.
6
1
0
if i want to script a mini-application (in the Terminal) in mac and windows, which one is preferred: ruby or python? or is there no major difference just a matter of taste? cause i know python definetely is a good scripting language. thanks
ruby or python more suitable for scripting in all OSes?
0.16514
0
0
551
2,978,801
2010-06-05T01:53:00.000
2
1
0
1
python,ruby
2,978,961
6
false
0
0
I believe python and ruby (since at least OS X 10.4) came pre-installed on Mac, that is a convenience. There are easy installers for Windows. On Linux of course your mileage may vary. As much as i like python myself, don't think one is better than the other for your purpose.
6
1
0
if i want to script a mini-application (in the Terminal) in mac and windows, which one is preferred: ruby or python? or is there no major difference just a matter of taste? cause i know python definetely is a good scripting language. thanks
ruby or python more suitable for scripting in all OSes?
0.066568
0
0
551
2,978,801
2010-06-05T01:53:00.000
2
1
0
1
python,ruby
2,979,070
6
false
0
0
Python is perhaps a little more common, and arguably more mature, so on that basis alone, it may be worth choosing Python. That said, both are available by default on Mac OS X, and neither are available on Windows by default, so in this case it really does not matter.
6
1
0
if i want to script a mini-application (in the Terminal) in mac and windows, which one is preferred: ruby or python? or is there no major difference just a matter of taste? cause i know python definetely is a good scripting language. thanks
ruby or python more suitable for scripting in all OSes?
0.066568
0
0
551
2,978,801
2010-06-05T01:53:00.000
2
1
0
1
python,ruby
2,979,691
6
false
0
0
I would suggest to go for Python over Ruby on Windows unless you are willing to port some gems as a few (no I cannot say what percentage) of the gems use unix/mac specific stuff (example from ENV[OSTYPE] to wget to unix processes) that I have seen break on windows.
6
1
0
if i want to script a mini-application (in the Terminal) in mac and windows, which one is preferred: ruby or python? or is there no major difference just a matter of taste? cause i know python definetely is a good scripting language. thanks
ruby or python more suitable for scripting in all OSes?
0.066568
0
0
551
2,978,801
2010-06-05T01:53:00.000
0
1
0
1
python,ruby
3,028,950
6
false
0
0
Both are excelent options, you won't go wrong no matter which one you chose. You should check out the availability of libraries for the task at hand and also how helpful the community is. The Python community is humongous and seems friendlier to me. Rubists seem to have some anger management issues.
6
1
0
if i want to script a mini-application (in the Terminal) in mac and windows, which one is preferred: ruby or python? or is there no major difference just a matter of taste? cause i know python definetely is a good scripting language. thanks
ruby or python more suitable for scripting in all OSes?
0
0
0
551
2,978,801
2010-06-05T01:53:00.000
5
1
0
1
python,ruby
2,978,809
6
true
0
0
Matter of taste, really. They each have a pretty good set of libraries and are cross-platform, so it'll be a matter of which one you prefer to code in.
6
1
0
if i want to script a mini-application (in the Terminal) in mac and windows, which one is preferred: ruby or python? or is there no major difference just a matter of taste? cause i know python definetely is a good scripting language. thanks
ruby or python more suitable for scripting in all OSes?
1.2
0
0
551
2,979,402
2010-06-05T06:20:00.000
3
0
0
0
ironpython
3,000,668
3
false
1
0
I'm doing web development for a German firm using Django on the server side and Silverlight with IronPython on the client. We're an all Python development company so being able to do "full stack" development with Python is great (although it was originally the customer who specified Silverlight).
1
5
0
I've been toying with the idea of adding IronPython for extending a scientific application I support. Is this a good or horrible idea? Are there any good examples of IronPython being used in a production application. I've seen Resolver, which is kind of cute. Are there any other apps out there? What I don't get is this. Is it any easier to use IronPython than to just use something like code DOM to create script like extensibility in your application? Anyone have some horror stories or tales of glorious success with IronPython / IronRuby?
Anyone using IronPython in a production application?
0.197375
0
0
1,311
2,979,697
2010-06-05T08:31:00.000
0
0
0
0
python,geometry,tkinter
2,979,705
4
false
0
1
I'd start with identifying the concentrations of the spots in the plane. Find the centers of those agglomerations and assign them each unique color. Then for other spots you could simply calculate the color using the linear principle. For example, if one center is red and the other is yellow, a point somewhere in the middle would become orange. I'd probably use some exponential function instead of a linear principle. This will keep the point groups more or less of the same color only giving a noticeable color change to far away points, or, to be more exact, to far away and somewhere in between points.
2
4
0
I have a dense set of points in the plane. I want them colored so that points that are close to each other have the same color, and a different color if they're far away. For simplicity assume that there are, say, 5 different colors to choose from. Turns out I've not the slightest idea how to do that .. I'm using Tkinter with Python, by the way
Coloring close points
0
0
0
270