Q_CreationDate
stringlengths
23
23
Title
stringlengths
11
149
Question
stringlengths
25
6.53k
Answer
stringlengths
15
5.1k
Score
float64
-1
1.2
Is_accepted
bool
2 classes
N_answers
int64
1
17
Q_Id
int64
0
6.76k
2009-04-29 08:28:24.667
How to create IDLE -like functionality to WinForms application
I'd like to add "IDLE-like functionality" to C# WinForms application, but I don't quite have an idea how to do that and couldn't find anything useful with Google. So basically I want interactive command line interface, where user could enter some Python code and execute it (not just expressions, should be possible to d...
IronRuby comes with a command line interpreter. Doesn't IronPython also have one? If so, the source code would be a good start :) Oh, and if it doesn't, be sure to look at the IronRuby interpreter, because both languages are based on the DLR and are therefore similar enough to learn from both.
0
false
1
153
2009-04-29 11:31:06.270
Notifying container object: best practices
I have two classes: Account and Operator. Account contains a list of Operators. Now, whenever an operator (in the list) receives a message I want to notify Account object to perform some business logic as well. I think of three alternatives on how to achieve this: 1) Hold a reference within Operator to the container [A...
You're over-thinking this. Seriously. Python isn't C++; your concerns are non-issues in Python. Just write what makes sense in your problem domain. " Not absolutely good because of circular references." Why not? Circularity is of no relevance here at all. Bidirectional relationships are great things. Use them. P...
1.2
true
2
154
2009-04-29 11:31:06.270
Notifying container object: best practices
I have two classes: Account and Operator. Account contains a list of Operators. Now, whenever an operator (in the list) receives a message I want to notify Account object to perform some business logic as well. I think of three alternatives on how to achieve this: 1) Hold a reference within Operator to the container [A...
There is no "one-size-fits-all" solution for the Observer pattern. But usually, it's better to define an EventManager object where interested parties can register themselves for certain events and post these events whenever they happen. It simply creates less dependencies. Note that you need to use a global EventManage...
0.240117
false
2
154
2009-04-30 05:03:05.993
What is the best way to access stored procedures in Django's ORM
I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it?
I guess the improved raw sql queryset support in Django 1.2 can make this easier as you wouldn't have to roll your own make_instance type code.
0
false
2
155
2009-04-30 05:03:05.993
What is the best way to access stored procedures in Django's ORM
I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it?
Don't. Seriously. Move the stored procedure logic into your model where it belongs. Putting some code in Django and some code in the database is a maintenance nightmare. I've spent too many of my 30+ years in IT trying to clean up this kind of mess.
0.336246
false
2
155
2009-05-01 03:24:53.257
Biggest python projects
What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams. It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller. Are there some huge companies that devel...
Python is very powerful language, Many big and the very high ranked websites are built on python.. Some big products of python are:- Google (extensively used) Youtube (extensively used) Disqus Eventbrite Pinterest Reddit Quora Mozilla Asana (extensively used) Dropbox (started with python, stayed with python) Even...
0.296905
false
3
156
2009-05-01 03:24:53.257
Biggest python projects
What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams. It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller. Are there some huge companies that devel...
Our project is over 30,000 lines of Python. That's probably small by some standards. But it's plenty big enough to fill my little brain. The application is mentioned in our annual report, so it's "strategic" in that sense. We're not a "huge" company, so we don't really qualify. A "huge company" (Fortune 1000?) does...
0.673066
false
3
156
2009-05-01 03:24:53.257
Biggest python projects
What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams. It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller. Are there some huge companies that devel...
Among many other Python-centered companies, beyond the ones already mentioned by Unknown, I'd mention big pharma firms such as Astra-Zeneca, film studios such as Lucasfilm, and research places such as NASA, Caltech, Lawrence Livermore NRL. Among the sponsors of Pycon Italia Tre (next week in Firenze, IT -- see www.pyco...
0.995055
false
3
156
2009-05-04 08:59:20.273
How can I check if an ip is in a network in Python?
Given an ip address (say 192.168.0.1), how do I check if it's in a network (say 192.168.0.0/24) in Python? Are there general tools in Python for ip address manipulation? Stuff like host lookups, ip adddress to int, network address with netmask to int and so on? Hopefully in the standard Python library for 2.5.
#This works properly without the weird byte by byte handling def addressInNetwork(ip,net): '''Is an address in a network''' # Convert addresses to host order, so shifts actually make sense ip = struct.unpack('>L',socket.inet_aton(ip))[0] netaddr,bits = net.split('/') netaddr = struct.unpack('>L',soc...
0.029146
false
1
157
2009-05-05 02:52:08.900
What's the best way to record the type of every variable assignment in a Python program?
Python is so dynamic that it's not always clear what's going on in a large program, and looking at a tiny bit of source code does not always help. To make matters worse, editors tend to have poor support for navigating to the definitions of tokens or import statements in a Python file. One way to compensate might be t...
What if you monkey-patched object's class or another prototypical object? This might not be the easiest if you're not using new-style classes.
0.101688
false
1
158
2009-05-05 16:22:53.010
Network-aware wx.FileDialog
I'm using wx.FileDialog in a wxPython 2.8.8.0 application, under Xubuntu 8.10.. My problem is that this dialog isn't network-aware, so I can't browse Samba shares. I see that this problem plagues other applications too (Firefox, Audacious...) so I'd like to ask where I could find informations on how to make it work. Is...
Robin Dunn himself told me that It's using the "native" GTK file dialog, just like the other apps, so there isn't anything that wx can do about it. So as a workaround I ended up installing gvfs-fuse and browsing the network through $HOME/.gvfs.. A bit klunky but it works.
1.2
true
1
159
2009-05-05 17:01:44.240
Catch only some runtime errors in Python
I'm importing a module which raises the following error in some conditions: RuntimeError: pyparted requires root access I know that I can just check for root access before the import, but I'd like to know how to catch this spesific kind of error via a try/except statement for future reference. Is there any way to d...
I know that I can just check for root access before the import, but I'd like to know how to catch this spesific kind of error via a try/except statement for future reference. Is there any way to differentiate between this RuntimeError and others that might be raised? If the error is caused by a specific condition, the...
1.2
true
1
160
2009-05-05 20:14:11.267
how to get the n-th record of a datastore query
Suppose that I have the model Foo in GAE and this query: query = Foo.all().order('-key') I want to get the n-th record. What is the most efficient way to achieve that? Will the solution break if the ordering property is not unique, such as the one below: query = Foo.all().order('-color') edit: n > 1000 edit 2: I want ...
There is no efficient way to do this - in any DBMS. In every case, you have to at least read sequentially through the index records until you find the nth one, then look up the corresponding data record. This is more or less what fetch(count, offset) does in GAE, with the additional limitation of 1000 records. A better...
1.2
true
1
161
2009-05-05 22:56:01.067
Unit testing for D-Bus and HAL?
How does one test a method that does some interactions with the local D-Bus (accessing a HAL object)? Results of tests will differ depending on the system that the test is run on, so I don't know how to provide the method reliable input. I'm working in Python, by the way.
If you can not mock the environment then it's probably impossible for you to write the test. If your access to HAL/D-Bus is via an object and you provide a mock instance to your test then it should be possible to emulate the necessary inputs to your test from the mock implementation.
1.2
true
1
162
2009-05-07 07:45:26.073
How to run a script without being in the tasktray?
I have a scheduled task which runs a python script every 10 min so it turns out that a script pops up on my desktop every 10 min how can i make it invincible so my script will work in the background ? I've been told that pythonw will do the work, but I cant figure out how to use it any help ? thanks
Set the scheduled task to start the script as minimized.
0
false
2
163
2009-05-07 07:45:26.073
How to run a script without being in the tasktray?
I have a scheduled task which runs a python script every 10 min so it turns out that a script pops up on my desktop every 10 min how can i make it invincible so my script will work in the background ? I've been told that pythonw will do the work, but I cant figure out how to use it any help ? thanks
I've been told that pythonw will do the work, but I cant figure out how to use it Normally you just have to rename the file extension to .pyw. Then it will be executed by pythonw.
0.545705
false
2
163
2009-05-07 20:55:48.750
datastore transaction restrictions
in my google app application, whenever a user purchases a number of contracts, these events are executed (simplified for clarity): user.cash is decreased user.contracts is increased by the number contracts.current_price is updated. market.no_of_transactions is increased by 1. in a rdms, these would be placed within t...
After a through research, I have found that a distributed transaction layer that provides a solution to the single entity group restriction has been developed in userland with the help of some google people. But so far, it is not released and is only available in java.
1.2
true
1
164
2009-05-08 18:23:39.907
Tokenizing left over data with lex/yacc
Forgive me, I'm completely new to parsing and lex/yacc, and I'm probably in way over my head, but nonetheless: I'm writing a pretty basic calculator with PLY, but it's input might not always be an equation, and I need to determine if it is or not when parsing. The extremes of the input would be something that evaluates...
I typically use a separate 'command reader' to obtain a complete command - probably a line in your case - into a host variable string, and then arrange for the lexical analyzer to analyze the string, including telling me when it didn't reach the end. This is hard to set up, but make some classes of error reporting eas...
0
false
2
165
2009-05-08 18:23:39.907
Tokenizing left over data with lex/yacc
Forgive me, I'm completely new to parsing and lex/yacc, and I'm probably in way over my head, but nonetheless: I'm writing a pretty basic calculator with PLY, but it's input might not always be an equation, and I need to determine if it is or not when parsing. The extremes of the input would be something that evaluates...
There is a built-in error token in yacc. You would normally do something like: line: goodline | badline ; badline : error '\n' /* Error-handling action, if needed */ goodline : equation '\n' ; Any line that doesn't match equation will be handled by badline. You might want to use yyerrok in the error handling action t...
1.2
true
2
165
2009-05-08 22:41:21.693
Piping Batch File output to a Python script
I'm trying to write a python script (in windows) that runs a batch file and will take the command line output of that batch file as input. The batch file runs processes that I don't have access to and gives output based on whether those processes are successful. I'd like to take those messages from the batch file and u...
Try subprocess.Popen(). It allows you to redirect stdout and stderr to files.
0.135221
false
1
166
2009-05-11 12:24:35.110
How to write a vb.net code to compile C/C++ programs?
I'm trying to make a vb.net application that has got 2 textboxes, 7 radio buttons and 2 buttons(one named compile and the other 'run'). How can I load the content of a C/C++(or any programming language) file into the 1st textbox and on clicking the compile button, i should be able to show the errors or the C/C++ progra...
Compiling can be done by calling cl.exe which comes with Visual Studio. Of course you could also use GCC instead.
0.201295
false
1
167
2009-05-11 14:55:46.930
Python M2Crypto EC Support
M2Crypto provides EC support for ECDSA/ECDH. I have installed OpenSSL 0.9.8i which contains support for EC. However when I run "from M2Crypto import EC,BIO" I get error saying EC_init() failed. So I added debug to print m2.OPENSSL_VERSION_TEXT value. It gets printed as "OpenSSL 0.9.7 19 Feb 2003". This version of OpenS...
Possibly its looking up shared libs libssl.so and libcrypto.so and finding the old ones in /usr/lib if you add the new_path to the top of /etc/ld.so.conf so it gets searched first it would work. But this might break other OpenSSL applications expecting old OpenSSL.
0
false
1
168
2009-05-12 03:20:00.953
How do I check if a disk is in a drive using python?
Say I want to manipulate some files on a floppy drive or a USB card reader. How do I check to see if the drive in question is ready? (That is, has a disk physically inserted.) The drive letter exists, so os.exists() will always return True in this case. Also, at this point in the process I don't yet know any file nam...
You can compare len(os.listdir("path")) to zero to see if there are any files in the directory.
0.265586
false
1
169
2009-05-12 23:29:12.147
Running django on OSX
I've just completed the very very nice django tutorial and it all went swimmingly. One of the first parts of the tutorial is that it says not to use their example server thingie in production, my first act after the tutorial was thus to try to run my app on apache. I'm running OSX 10.5 and have the standard apache (whi...
Unless you are planning on going to production with OS X you might not want to bother. If you must do it, go straight to mod_wsgi. Don't bother with mod_python or older solutions. I did mod_python on Apache and while it runs great now, it took countless hours to set up. Also, just to clarify something based on what you...
0.470104
false
2
170
2009-05-12 23:29:12.147
Running django on OSX
I've just completed the very very nice django tutorial and it all went swimmingly. One of the first parts of the tutorial is that it says not to use their example server thingie in production, my first act after the tutorial was thus to try to run my app on apache. I'm running OSX 10.5 and have the standard apache (whi...
Yet another option is to consider using a virtual machine for your development. You can install a full version of whatever OS your production server will be running - say, Debian - and run your Apache and DB in the VM. You can connect to the virtual disk in the Finder, so you can still use TextMate (or whatever) on OSX...
0.201295
false
2
170
2009-05-16 12:01:37.463
Most Efficient Way to Find Whether a Large List Contains a Specific String (Python)
I have a file containing roughly all the words in English (~60k words, ~500k characters). I want to test whether a certain word I receive as input is "in English" (i.e. if this exact word is in the list). What would be the most efficient way to do this in Python? The trivial solution is to load the file into a list and...
You're basically testing whether a member is in a set or not, right? If so, and because you said you have lots of memory, why not just load all the words as keys in memcache, and then for every word, just check if it is present in memcache or not. Or use that data structure that is used by bash to autocomplete command ...
0.090455
false
2
171
2009-05-16 12:01:37.463
Most Efficient Way to Find Whether a Large List Contains a Specific String (Python)
I have a file containing roughly all the words in English (~60k words, ~500k characters). I want to test whether a certain word I receive as input is "in English" (i.e. if this exact word is in the list). What would be the most efficient way to do this in Python? The trivial solution is to load the file into a list and...
Two things: The Python 'mutable set' type has an 'add' method ( s.add(item) ), so you could go right from reading (a line) from your big file straight into a set without using a list as an intermediate data structure. Python lets you 'pickle' a data structure, so you could save your big set to a file and save the ti...
0.090455
false
2
171
2009-05-16 16:19:40.790
does someone know how to show content on screen (covering up any window) using Ruby or Python?
using Ruby or Python, does someone know how to draw on the screen, covering up any other window? Kind of like, press a key, and the program will show current weather or stock quote on the screen (using the whole screen as the canvas), and then press the key again, and everything restores to the same as before? (like ...
I would recommend PyGame.
0.135221
false
2
172
2009-05-16 16:19:40.790
does someone know how to show content on screen (covering up any window) using Ruby or Python?
using Ruby or Python, does someone know how to draw on the screen, covering up any other window? Kind of like, press a key, and the program will show current weather or stock quote on the screen (using the whole screen as the canvas), and then press the key again, and everything restores to the same as before? (like ...
You could use the systems dashboard (desktop widgets, or whatever it's called) API. In order to do that you need bindings to it for Python or Ruby. Alternatively you could use some generic gui toolkit or application framework and just create a frameless window with transparent background. Then you need to be sure that ...
1.2
true
2
172
2009-05-17 12:09:47.610
Admin privileges for script
how can i check admin-privileges for my script during running?
The concept of "admin-privileges" in our day of fine grained privilege control is becoming hard to define. If you are running on unix with "traditional" access control model, getting the effective user id (available in os module) and checking that against root (0) could be what you are looking for. If you know accessin...
0.740859
false
1
173
2009-05-17 19:00:20.693
Simple data storing in Python
I'm looking for a simple solution using Python to store data as a flat file, such that each line is a string representation of an array that can be easily parsed. I'm sure python has library for doing such a task easily but so far all the approaches I have found seemed like it would have been sloppy to get it to work a...
I'm looking for a simple solution using Python to store data as a flat file, such that each line is a string representation of an array that can be easily parsed. Is the data only ever going to be parsed by Python programs? If not, then I'd avoid pickle et al (shelve and marshal) since they're very Python specific. JS...
0.16183
false
1
174
2009-05-18 03:15:35.257
PyQt: splash screen while loading "heavy" libraries
My PyQt application that uses matplotlib takes several seconds to load for the first time, even on a fast machine (the second load time is much shorter as the DLLs are kept in memory by Windows). I'm wondering whether it's feasible to show a splash screen while the matplotlib library is being loaded. Where does the act...
Yes, loading the module takes place at the line where the import statement is. If you create your QApplication and show your splash screen before that, you should be able to do what you want -- also you need to call QApplication.processEvents() whenever you need the splash screen to update with a new message.
1.2
true
1
175
2009-05-20 01:22:36.397
How does MySQL's RENAME TABLE statment work/perform?
MySQL has a RENAME TABLE statemnt that will allow you to change the name of a table. The manual mentions The rename operation is done atomically, which means that no other session can access any of the tables while the rename is running The manual does not (to my knowedge) state how this renaming is accomplishe...
I believe MySQL only needs to alter metadata and references to the table's old name in stored procedures -- the number of records in the table should be irrelevant.
1.2
true
1
176
2009-05-25 12:16:07.597
show lyrics on ubuntu
I'm writing a little script for Ubuntu. My intention is to call rhythmbox lyrics plug-in with a global short-cut (configuring gnome) . I can call it from rhythmbox python console, but I don't know how to import rhythmbox built-in modules (eg. rhythmdb). Any ideas?
You can't import rhythmbox "built-in" modules from a standard python console. As far as I know they aren't real modules, they are just objects from the rhythmbox process exposed to plugins. So you can access them only if you are running your script from the rhythmbox process.
0.386912
false
2
177
2009-05-25 12:16:07.597
show lyrics on ubuntu
I'm writing a little script for Ubuntu. My intention is to call rhythmbox lyrics plug-in with a global short-cut (configuring gnome) . I can call it from rhythmbox python console, but I don't know how to import rhythmbox built-in modules (eg. rhythmdb). Any ideas?
in this case i guess you'll have to write the whole plugin yourself and , then listen to dbus for change of songs in rhythmbox , to detect which song is being played .
0
false
2
177
2009-05-25 18:05:23.203
Making a Python script executable chmod755?
My hosting provider says my python script must be made to be executable(chmod755). What does this mean & how do I do it? Cheers!
In addition to the other fine answers here, you should be aware that most FTP clients have a chmod command to allow you to set permissions on files at the server. You may not need this if permissions come across properly, but there's a good chance they do not.
0
false
1
178
2009-05-28 14:55:26.907
How to compare data of two tables transformed in SSIS package
A table has been ETLed to another table. My task is to verify the data between two tables programmatically. One of the difficulties I m facing rite now is: how to use the expression that I can get from, let s say, derived column task and verify with the source and destination. or in other words, how can I use the expr...
Set up a column which holds a CHECKSUM() of each row. Do a left outer join between the two tables . If you have any nulls for the right side, you have problems.
0.673066
false
1
179
2009-06-01 07:14:45.760
Packaging script source files in IronPython and IronRuby
Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find ...
IronPython 2.0 has a sample compiler called PYC on Codeplex.com/ironpython which can create DLL's (and applications if you need them too). IronPython 2.6 has a newer version of PYC under Tools\script. Cheers, Davy
0
false
2
180
2009-06-01 07:14:45.760
Packaging script source files in IronPython and IronRuby
Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find ...
You could add custom import hook that looks for embedded resources when an import is executed. This is slightly complex and probably not worth the trouble. A better technique would be to fetch all of the embedded modules at startup time, execute them with the ScriptEngine and put the modules you have created into the s...
0.135221
false
2
180
2009-06-03 13:19:54.927
How can I check for NaN values?
float('nan') represents NaN (not a number). But how do I check for it?
numpy.isnan(number) tells you if it's NaN or not.
1
false
1
181
2009-06-04 17:51:31.243
Recursive Function palindrome in Python
I need help writing a recursive function which detects whether a string is a palindrome. But i can't use any loops it must be recursive. Can anyone help show me how this is done . Im using Python.
If a string is zero or one letters long, it's a palindrome. If a string has the first and last letters the same, and the remaining letters (I think it's a [1: -1] slice in Python, but my Python is a bit rusty) are a palindrome, it's a palindrome. Now, write that as a palindrome function that takes a string. It will ca...
0.11086
false
2
182
2009-06-04 17:51:31.243
Recursive Function palindrome in Python
I need help writing a recursive function which detects whether a string is a palindrome. But i can't use any loops it must be recursive. Can anyone help show me how this is done . Im using Python.
Here's another viewpoint A palindromic string is Some letter, x. Some palindromic substrinng. The same letter, x, repeated. Also, note that you may be given a proper English sentence "Able was I ere I saw Elba." with punctuation. Your palindrome checker may have to quietly skip punctuation. Also, you may have to qu...
0.074076
false
2
182
2009-06-06 20:33:32.037
how can I add a QMenu and QMenuItems to a window from Qt Designer
Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this.
I have a single main window with a QGraphicsView and lots of QGraphicsItem objects. Each type of the Items have a different context menu. I find that not being able to create the contextMenu's, or at least the actions that are in them a serious limitation of QtDesigner. It means that I can create about 10% or so of t...
0.386912
false
3
183
2009-06-06 20:33:32.037
how can I add a QMenu and QMenuItems to a window from Qt Designer
Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this.
When you edit a QMainWindow you can right click the window and then choose "create menu bar". Or are you talking about a "context menu" aka "right click menu"?
1.2
true
3
183
2009-06-06 20:33:32.037
how can I add a QMenu and QMenuItems to a window from Qt Designer
Is there any reason why a QMenu cannot be added from the Qt Designer? I find it weird that you can add other widget types but not this.
Adding menu editing for every widget in the designer would probably make a very awkward and inconvenient UI. There's really no place you can visualize it on. If you're editing a QMainWindow you can edit the menu bar and its popups because there's a proper place for them to be displayed in.
0
false
3
183
2009-06-08 11:30:28.043
how to remove text between using python?
how to remove text between <script> and </script> using python?
If you're removing everything between <script> and </script> why not just remove the entire node? Are you expecting a resig-style src and body?
0
false
2
184
2009-06-08 11:30:28.043
how to remove text between using python?
how to remove text between <script> and </script> using python?
I don't know Python good enough to tell you a solution. But if you want to use that to sanitize the user input you have to be very, very careful. Removing stuff between and just doesn't catch everything. Maybe you can have a look at existing solutions (I assume Django includes something like this).
-0.04532
false
2
184
2009-06-09 00:29:59.137
python truncate after a hundreds?
How can truncate an input like 315.15321531321 I want to truncate all the values after the hundredths position so it becomes 315.15 how do i do that?
You have several options - you can round the number using round(), however this can introduce some inaccuracies (315.15 might round to 315.150000003 for example). If you're just looking to truncate the value of the float when you're displaying it, you can specify the width of the output using printf("%.2f", mynumber). ...
0.050976
false
1
185
2009-06-09 19:18:06.150
Django - Website Home Page
I've been having a look at Django and, from what I've seen, it's pretty darn fantastic. I'm a little confused, however, how I go about implementing a "home page" for my website? Would it be a separate app, or just a view within the project, or what?
There's no real rule for this, But one thing I like to do is actually arrange for the index access to redirect to another spot. If you prefer, though, you can just give the index page a plain view. That said, It's probably a good idea to keep all your code in an actual app, so that you can refactor it more easily, a...
1.2
true
1
186
2009-06-10 03:11:55.320
how to integrate ZSH and (i)python?
I have been in love with zsh for a long time, and more recently I have been discovering the advantages of the ipython interactive interpreter over python itself. Being able to cd, to ls, to run or to ! is indeed very handy. But now it feels weird to have such a clumsy shell when in ipython, and I wonder how I could int...
I asked this question on the zsh list and this answer worked for me. YMMV. In genutils.py after the line if not debug: Remove the line: stat = os.system(cmd) Replace it with: stat = subprocess.call(cmd,shell=True,executable='/bin/zsh') you see, the problem is that that "!" call uses os.system to run it, which ...
1.2
true
1
187
2009-06-10 10:42:38.667
python not starting properly
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run pro...
In your path, I think you need to have both the location of the Python install and the Python\Scripts folder. For example, on XP, I have C:\Python25;C:\Python25\Scripts. Can you verify that you have both?
0
false
3
188
2009-06-10 10:42:38.667
python not starting properly
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run pro...
Either use the system control panel to set the PATH environment variable that applies permanently or Reinstall Python as a system administrator so that the installer can set the registry and environment variables for you. If you install the "just for me" option, then you have to set the PATH variable in the control pan...
1.2
true
3
188
2009-06-10 10:42:38.667
python not starting properly
I have installed python and django in my system that uses win vista. Now when I go to command prompt and type python or django-admin.py both are not working. Every time I need to set the path to the python folder manually. But i have seen these commands running even without setting path. So how do i make it to run pro...
you can't run a command that isn't in your path. it should be set globally when you installed python. type 'set' at a dos prompt and look at the PATH variable. c:\python25 (or whever you installed python) has to be in that variable ie PATH=c:\windows;c:\python25;... etc if it isn't in PATH then you or the installer mi...
0.101688
false
3
188
2009-06-10 23:35:16.360
Vim, Python, and Django autocompletion (pysmell?)
Does anyone know how to set up auto completion to work nicely with python, django, and vim? I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project ...
I've had good luck with exuberant-ctags for this. I use this macro in my vimrc: execute 'map :!/usr/bin/exuberant-ctags -f '.&tags.' --recurse '.$_P4ROOT.' ' You'll want to modify that slightly, so that it includes your python /site-packages/django/ directory as well as your own code. Then, hit F2 inside vim to upda...
0.240117
false
2
189
2009-06-10 23:35:16.360
Vim, Python, and Django autocompletion (pysmell?)
Does anyone know how to set up auto completion to work nicely with python, django, and vim? I've been trying to use pysmell, but I can't seem to get it set up correctly (or maybe I don't know how it works). Right now, I run pysmell in the django directory (I'm using the trunk) and move the resulting tags to my project ...
Today, you not need special extentions for django autocomplete in vim. Make sure that you have vim with python support. To check it, type in xterm: vim --version|grep python output: +python -python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs ... ... To make work autocomplete, add this lines in your .vimrc: ...
0.16183
false
2
189
2009-06-12 05:28:54.720
How to specify native library search path for python
I have installed lxml which was built using a standalone version of libxml2. Reason for this was that the lxml needed a later version of libxml2 than what was currently installed. When I use the lxml module how do I tell it (python) where to find the correct version of the libxml2 shared library?
Assuming you're talking about a .so file, it's not up to Python to find it -- it's up to the operating system's dynamic library loaded. For Linux, for example, LD_LIBRARY_PATH is the environment variable you need to set.
1.2
true
1
190
2009-06-15 09:15:37.030
Using python regex to extract namespaces from C++ sources
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestio...
The need is simple enough that you may not need a complex parser. You need to: extract the namespace names count the open/close braces to keep track of where your namespace is defined. This simple approach works if the other conditions are met: you don't get spurious namespace like strings inside comments or inside ...
0.135221
false
5
191
2009-06-15 09:15:37.030
Using python regex to extract namespaces from C++ sources
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestio...
Searching for the namespace names is pretty easy with a regular expression. However, to determine the nesting level you will have to keep track of the curly bracket nesting level in the source file. This is a parsing problem, one that cannot be solved (sanely) with regular expressions. Also, you may have to deal with a...
0.386912
false
5
191
2009-06-15 09:15:37.030
Using python regex to extract namespaces from C++ sources
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestio...
You could write a basic lexer for it. It's not that hard.
0.067922
false
5
191
2009-06-15 09:15:37.030
Using python regex to extract namespaces from C++ sources
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestio...
Most of the time when someone asks how to do something with regex, they're doing something very wrong. I don't think this case is different. If you want to parse c++, you need to use a c++ parser. There are many things that can be done that will defeat a regex but still be valid c++.
0
false
5
191
2009-06-15 09:15:37.030
Using python regex to extract namespaces from C++ sources
I am trying to extract the namespaces defined in C++ files. Basically, if my C++ file contains: namespace n1 { ... namespace n2 { ... } // end namespace n2 ... namespace n3 { ...} //end namespace n3 ... } //end namespace n1 I want to be able to retrieve: n1, n1::n2, n1::n3. Does someone have any suggestio...
That is what I did earlier today: Extract the comment out of the C++ files Use regex to extract the namespace definition Use a simple string search to get the open & close braces positions The various sanity check added show that I am successfully processing 99.925% of my files (5 failures ouf of 6678 files). The...
0
false
5
191
2009-06-15 19:25:28.390
System theme icons and PyQt4
I'm writing a basic program in python using the PyQt4 module. I'd like to be able to use my system theme's icons for things like the preference dialog's icon, but i have no idea how to do this. So my question is, how do you get the location of an icon, but make sure it changes with the system's icon theme? If it matter...
I spent a decent amount of researching this myself not long ago, and my conclusion was that, unfortunately, Qt doesn't provide this functionality in a cross-platform fashion. Ideally the QIcon class would have defaults for file open, save, '+', '-', preferences, etc, but considering it doesn't you'll have to grab the ...
0
false
1
192
2009-06-16 14:09:44.313
How To Reversibly Store Password With Python On Linux?
First, my question is not about password hashing, but password encryption. I'm building a desktop application that needs to authentificate the user to a third party service. To speed up the login process, I want to give the user the option to save his credentials. Since I need the password to authentificate him to the ...
Encrypting the passwords doesn't really buy you a whole lot more protection than storing in plaintext. Anyone capable of accessing the database probably also has full access to your webserver machines. However, if the loss of security is acceptable, and you really need this, I'd generate a new keyfile (from a good sou...
1.2
true
1
193
2009-06-16 18:50:48.037
Number of visitors in Django
In Django, how can I see the number of current visitors? Or how do I determine the number of active sessions? Is this a good method? use django.contrib.sessions.models.Session, set the expiry time short. Every time when somebody does something on the site, update expiry time. Then count the number of sessions that are ...
Edit: Added some more information about why I present this answer here. I found chartbeat when I tried to answer this same question for my django based site. I don't work for them. Not specifically Django, but chartbeat.com is very interesting to add to a website as well. django-tracking is great, +1 for that answer,...
-0.201295
false
1
194
2009-06-18 17:57:24.017
wxPython: how to make two toolbars use one statusbar for tooltips?
I have an interface that has two toolbars, one attached to the frame and one embedded in a notebook tab. The one in the frame dutifully shows longHelp strings in the statusbar, the one in the notebook tab does not. How do I tell the one on the notebook tab where to display its help, or do I have to manage enter and lea...
from wxPython docs """ longHelpString This string is shown in the statusbar (if any) of the parent frame when the mouse pointer is inside the tool """ so toolbar in notebook doesn't get any statusbar to display long help, so either thru src we should invertigate how it inquires abt status bar and supply a ref to main f...
0
false
1
195
2009-06-19 04:04:12.297
Synthesis of general programming language (Python) with tailored language (PureData/MaxMSP/ChucK)
I am learning Python because it appeals to me as a mathematician but also has many useful libraries for scientific computing, image processing, web apps, etc etc. It is frustrating to me that for certain of my interests (eletronic music or installation art) there are very specific programming languages which seem bet...
I would say learn them all. While it's true that many languages can do many things, specialised languages are usually more expressive and easier to use for a particular task. Case-in-point is while most languages allow shell interaction and process control very few are as well suited to the task as bash scripts. Plugin...
1.2
true
2
196
2009-06-19 04:04:12.297
Synthesis of general programming language (Python) with tailored language (PureData/MaxMSP/ChucK)
I am learning Python because it appeals to me as a mathematician but also has many useful libraries for scientific computing, image processing, web apps, etc etc. It is frustrating to me that for certain of my interests (eletronic music or installation art) there are very specific programming languages which seem bet...
This thread is a little old, but I wanted to point out that the majority of the mature audio development environments e.g. supercollider/max-msp/pure data can be controlled via open sound control. You can google up a better description of OSC, but suffice it to say that it allows you to send control data to synths buil...
0.386912
false
2
196
2009-06-19 19:35:07.567
Sandboxing in Linux
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications. So I need to create some kind of sandbox for the apps. At the most basic level, I'd ...
Spawning a new VM under KVM or qemu to compile and run the code looks like the way to go. Running the code under jail/LXC can compromise the machine if it exploits the unsecured parts of the OS like networking code. Advantage of running under a VM are obvious. One can only hack the VM but not the machine itself. But th...
0
false
3
197
2009-06-19 19:35:07.567
Sandboxing in Linux
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications. So I need to create some kind of sandbox for the apps. At the most basic level, I'd ...
I think your solutions must concentrate on analyzing the source code. I don't know any tools, and I think this would be pretty hard with C, but, for example, a Pascal program which doesn't include any modules would be pretty harmless in my opinion.
0
false
3
197
2009-06-19 19:35:07.567
Sandboxing in Linux
I want to create a Web app which would allow the user to upload some C code, and see the results of its execution (the code would be compiled on the server). The users are untrusted, which obviously has some huge security implications. So I need to create some kind of sandbox for the apps. At the most basic level, I'd ...
About the only chance you have is running a VirtualMachine and those can have vulnerabilities. If you want your machine hacked in the short term just use permissions and make a special user with access to maybe one directory. If you want to postpone the hacking to some point in the future then run a webserver inside a ...
-0.067922
false
3
197
2009-06-21 23:31:10.947
What's the best way to implement web service for ajax autocomplete
I'm implementing a "Google Suggest" like autocomplete feature for tag searching using jQuery's autocomplete. I need to provide a web service to jQuery giving it a list of suggestions based on what the user has typed. I see 2 ways of implementing the web service: 1) just store all the tags in a database and search the ...
I would use the first option. 'KISS' - (Keep It Simple Stupid). For small amounts of data there shouldn't be much latency. We run the same kind of thing for a name search and results appear pretty quickly on a few thousand rows. Hope that helps, Josh
0.201295
false
1
198
2009-06-23 14:24:51.560
how to addreference to Ritmo for iSeries in ironpython
I was just wondering if anybody knows how to add reference to "Ritmo for iSeries" in IronPython. I did it successfully in C# and get it to work (since it is just click click click) And I was trying to do the same in IronPython but it says, "could not add reference to assembly Ritmo for iSeries". I was doing import clr ...
Jonathan helped me to figure out that I had not copied the dll file to the location where IronPython can find it. After copying the dll file to the location, usually it s "c:\Program Files\IronPython 2.0\" unless stated otherwise, I did: import clr clr.AddReference('System.Data') clr.AddReferenceToFile('Sql400.dll') ...
0
false
2
199
2009-06-23 14:24:51.560
how to addreference to Ritmo for iSeries in ironpython
I was just wondering if anybody knows how to add reference to "Ritmo for iSeries" in IronPython. I did it successfully in C# and get it to work (since it is just click click click) And I was trying to do the same in IronPython but it says, "could not add reference to assembly Ritmo for iSeries". I was doing import clr ...
You need to use the actual name of the assembly (it won't have spaces). In your C# project, what does it list under the 'references' folder once you've added it as a reference? Try putting that. Also, make sure you've copied the dll for the library to where your IronPython script can find it (if it's not in the GAC).
0
false
2
199
2009-06-24 12:54:21.517
HTML conversion
How to convert HTML CSS file to wxPython files? That is, how to create slidsheet in wxPython like HTML CSS files?
stylesheet, not slidesheet. f = open('NAMEOFSTYLESHEET.css','w') f.write('#ID{}\n.class{}')
0
false
1
200
2009-06-25 11:19:47.427
Encrypt a string using a public key
I need to take a string in Python and encrypt it using a public key. Can anyone give me an example or recommendation about how to go about doing this?
I looked at the ezPyCrypto library that was recommended in another answer. Please don't use this library. It is very incomplete and in some cases incorrect and highly insecure. Public key algorithms have many pitfalls and need to be implemented carefully. For example, RSA message should use a padding scheme such as PKC...
0.201295
false
1
201
2009-06-25 11:59:01.843
Best Practise for transferring a MySQL table to another server?
I have a system sitting on a "Master Server", that is periodically transferring quite a few chunks of information from a MySQL DB to another server in the web. Both servers have a MySQL Server and an Apache running. I would like an easy-to-use solution for this. Currently I'm looking into: XMLRPC RestFul Services a si...
Assuming your situation allows this security-wise, you forgot one transport mechanism: simply opening a mysql connection from one server to another. Me, I would start by thinking about one script that ran regularly on the write server and opens a read only db connection to the read server (A bit of added security) and ...
0
false
2
202
2009-06-25 11:59:01.843
Best Practise for transferring a MySQL table to another server?
I have a system sitting on a "Master Server", that is periodically transferring quite a few chunks of information from a MySQL DB to another server in the web. Both servers have a MySQL Server and an Apache running. I would like an easy-to-use solution for this. Currently I'm looking into: XMLRPC RestFul Services a si...
Server 1: Convert rows to JSON, call the RESTful api of second with JSON data Server 2: listens on a URI e.g. POST /data , get json data convert back to dictionary or ORM objects, insert into db sqlalchemy/sqlobject and simplejson is what you need.
1.2
true
2
202
2009-06-26 10:44:01.177
Hiding characters typed into password field
I am developing an student attendance application in wxpython and I need to know how to ensure that password field doesn't echo characters to the screen. Forexample :if I give the name as moni means then it should be displayed as in format of ****
You need to give your text control the TE_PASSWORD style. (As Jørn's comment points out, this isn't "encryption" - I'm assuming you're only talking about the visual presentation of the password.)
0.386912
false
1
203
2009-06-26 16:39:30.670
Get remote text file, process, and update database - approach and scripting language to use?
I've been having to do some basic feed processing. So, get a file via ftp, process it (i.e. get the fields I care about), and then update the local database. And similarly the other direction: get data from db, create file, and upload by ftp. The scripts will be called by cron. I think the idea would be for each type o...
Most modern languages scripting languages allow you to do all of these things. Because of that, I think your choice of language should be based on what you and the people who read your code know. In Perl I'd make use of the following modules: Net::FTP to access the ftp sites. DBI to insert data into your database. Mo...
0.101688
false
1
204
2009-06-27 22:41:01.413
Changing python interpreter windows
I have two python installations, 2.5 and 2.6 I want to change the default python interpreter from 2.5 to 2.6. Anyone know how?
PYTHONPATH is NOT what you are looking for. That is for varying where Python's "import" looks for packages and modules. You need to change the PATH variable in your environment so that it contains e.g. "....;c:\python26;...." instead of "....;c:\python25;....". Click on start > control panel > system > advanced > envir...
1.2
true
2
205
2009-06-27 22:41:01.413
Changing python interpreter windows
I have two python installations, 2.5 and 2.6 I want to change the default python interpreter from 2.5 to 2.6. Anyone know how?
just FYI, since both c:\python25 and c:\python26 are on PATH, I copy C:\Python25\python.exe to C:\Python25\py25.exe, and copy C:\Python26\python.exe to C:\Python26\py26.exe Then just type py25(or py26) get the specific version.
0.201295
false
2
205
2009-06-30 13:14:59.567
how to use french letters in a django template?
I have some french letters (é, è, à...) in a django template but when it is loaded by django, an UnicodeDecodeError exception is raised. If I don't load the template but directly use a python string. It works ok. Is there something to do to use unicode with django template?
You are probably storing the template in a non-unicode encoding, such as latin-1. I believe Django assumes that templates are in UTF-8 by default (though there is a setting to override this). Your editor should be capable of saving the template file in the UTF-8 encoding (probably via a dropdown on the save as page, t...
1.2
true
1
206
2009-06-30 13:45:12.203
In Python, Using pyodbc, How Do You Perform Transactions?
I have a username which I must change in numerous (up to ~25) tables. (Yeah, I know.) An atomic transaction seems to be the way to go for this sort of thing. However, I do not know how to do this with pyodbc. I've seen various tutorials on atomic transactions before, but have never used them. The setup: Windows pla...
I don't think pyodbc has any specific support for transactions. You need to send the SQL command to start/commit/rollback transactions.
-0.999909
false
1
207
2009-07-02 16:16:07.920
How to debug SCons scripts using eclipse and pydev?
I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?
I'm not an Eclipse expert, but since you didn't get any other answer... If you make the SCons source a part of the Eclipse project, and run the whole command from within Eclipse it should work like any Eclipse debugging. SCons is written in Python, there is no reason it shouldn't be debuggable in Eclipse just like anyt...
1.2
true
5
208
2009-07-02 16:16:07.920
How to debug SCons scripts using eclipse and pydev?
I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?
You are right. Since the SCons is python based, the SCons scripts are debuggable via EClipse PyDev. For this, you need to do the following in the debug configuration... 1. Under the main tab, set the main module to the SCons file which will be available under the python/scripts directory if you have installed SCons. ...
0.386912
false
5
208
2009-07-02 16:16:07.920
How to debug SCons scripts using eclipse and pydev?
I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?
I've since gain more experience with SCons / Python and I'd recommend using python's pdb module. To use it simply add the following code to your SCons/Python files. import pdb; pdb.set_trace() When the file is run from the command line a breakpoint will be hit at this line. I also moved away from Eclipse. A lightweight...
0
false
5
208
2009-07-02 16:16:07.920
How to debug SCons scripts using eclipse and pydev?
I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?
On MAC to debug scons through pydev follow Lennart's answer but with one simply addition. Using Finder (or terminal) browse to where scons is installed. You can find this with the "which" command. e.g. which scons -> /usr/local/bin/scons Make a copy of the scons file and call it scons.py. Now when you create the Debug ...
0.067922
false
5
208
2009-07-02 16:16:07.920
How to debug SCons scripts using eclipse and pydev?
I'm a newbie to SCons and also using pydev. Can someone help me with instructions on how to debug scons scripts using Eclipse and pydev? Is it even possible considering the fact that SCons is a seperate app and not an extension to python?
As an addendum: on Windows, I had to copy the scons-installed files to reside under C:\Python27\Lib\site-packages\scons in order for this to work. Adding the original installed location, qualified with the version number, to the PYTHONPATH, did not work.
0
false
5
208
2009-07-03 03:24:31.120
Windows Application Programming & wxPython
Developing a project of mine I realize I have a need for some level of persistence across sessions, for example when a user executes the application, changes some preferences and then closes the app. The next time the user executes the app, be it after a reboot or 15 minutes, I would like to be able to retain the pref...
I would advice to do it in two steps. First step is to save your prefs. as string, for that you can a) Use any xml lib or output xml by hand to output string and read similarly from string b) Just use pickle module to dump your prefs object as a string c) Somehow generate a string from prefs which you can read b...
1.2
true
1
209
2009-07-06 03:33:04.817
how to make table partitions?
I am not very familiar with databases, and so I do not know how to partition a table using SQLAlchemy. Your help would be greatly appreciated.
Automatic partitioning is a very database engine specific concept and SQLAlchemy doesn't provide any generic tools to manage partitioning. Mostly because it wouldn't provide anything really useful while being another API to learn. If you want to do database level partitioning then do the CREATE TABLE statements using c...
0.386912
false
1
210
2009-07-07 22:55:08.403
Matrix from Python to MATLAB
I'm working with Python and MATLAB right now and I have a 2D array in Python that I need to write to a file and then be able to read it into MATLAB as a matrix. Any ideas on how to do this? Thanks!
I would probably use numpy.savetxt('yourfile.mat',yourarray) in Python and then yourarray = load('yourfile.mat') in MATLAB.
0.283556
false
2
211
2009-07-07 22:55:08.403
Matrix from Python to MATLAB
I'm working with Python and MATLAB right now and I have a 2D array in Python that I need to write to a file and then be able to read it into MATLAB as a matrix. Any ideas on how to do this? Thanks!
You could write the matrix in Python to a CSV file and read it in MATLAB using csvread.
0.229097
false
2
211
2009-07-11 05:45:38.637
List of installed fonts OS X / C
I'm trying to programatically get a list of installed fonts in C or Python. I need to be able to do this on OS X, does anyone know how?
Do you want to write a program to do it, or do you want to use a program to do it? There are many programs that list fonts, xlsfonts comes to mind.
0.081452
false
1
212
2009-07-11 06:02:43.720
How to keep an App Engine/Java app running with deaf requests from a Java/Python web cron?
App Engine allows you 30 seconds to load your application My application takes around 30 seconds - sometimes more, sometimes less. I don't know how to fix this. If the app is idle (does not receive a request for a while), it needs to be re-loaded. So, to avoid the app needing to be reloaded, I want to simulate user a...
App engine also has a new PAY feature where you can have it "always-on". Costs about $0.30 USD cents a day. Just go into your billing settings and enable it if you don't mind paying for the feature. I believe it guarantees you at least 3 instances always running. (I didn't realize hitting a /ping url which caused an...
0.101688
false
1
213
2009-07-11 18:11:18.877
How do I check if a process is alive in Python on Linux?
I have a process id in Python. I know I can kill it with os.kill(), but how do I check if it is alive ? Is there a built-in function or do I have to go to the shell?
os.kill does not kill processes, it sends them signals (it's poorly named). If you send signal 0, you can determine whether you are allowed to send other signals. An error code will indicate whether it's a permission problem or a missing process. See man 2 kill for more info. Also, if the process is your child, you ca...
0.999823
false
1
214
2009-07-14 15:19:21.097
Python: Persistent shell variables in subprocess
I'm trying to execute a series of commands using Pythons subprocess module, however I need to set shell variables with export before running them. Of course the shell doesn't seem to be persistent so when I run a command later those shell variables are lost. Is there any way to go about this? I could create a /bin/sh p...
subprocess.Popen takes an optional named argument env that's a dictionary to use as the subprocess's environment (what you're describing as "shell variables"). Prepare a dict as you need it (you may start with a copy of os.environ and alter that as you need) and pass it to all the subprocess.Popen calls you perform.
1.2
true
1
215
2009-07-14 17:28:02.430
Best way to have full Python install under cygwin/XP?
Pythons installed under WinXP have dirs like DLLs, DOC, include, etc. but python (2.5) installed with cygwin is a bare python.exe. My motivation for asking is that 'things' under XP don't seem to be finding 'other things' under cygwin and vice versa, I want to start developing with Qt, I like shells, and I do not like...
Just a little off the question, but... Have you considered running Sun's VirtualBox with Fedora or Ubuntu inside of it? I'm assuming you have to / need to use windows because you still are, but don't like it. Then you would have python running inside a native linux desktop without any of the troubles you mentioned. A...
0
false
4
216
2009-07-14 17:28:02.430
Best way to have full Python install under cygwin/XP?
Pythons installed under WinXP have dirs like DLLs, DOC, include, etc. but python (2.5) installed with cygwin is a bare python.exe. My motivation for asking is that 'things' under XP don't seem to be finding 'other things' under cygwin and vice versa, I want to start developing with Qt, I like shells, and I do not like...
I use Python from within cygwin, but I don't use the version that cygwin gives you the option of installing as I don't have the control over version number used that I need (we use an older version at work). I have my python version installed via the windows installer (the xp version as you put it) and add the /cygdri...
1.2
true
4
216
2009-07-14 17:28:02.430
Best way to have full Python install under cygwin/XP?
Pythons installed under WinXP have dirs like DLLs, DOC, include, etc. but python (2.5) installed with cygwin is a bare python.exe. My motivation for asking is that 'things' under XP don't seem to be finding 'other things' under cygwin and vice versa, I want to start developing with Qt, I like shells, and I do not like...
I accidentally stumbled on this - If I launch Cygwin from the Cygwin.bat file (which is present directly under the main folder), I get access to the Python version installed under Cygwin (i.e 2.6.8) If I instead launch the Cygwin from bash.exe under bin directory (C:\Cygwin\bin\bash.exe for me), running "Python -V" sho...
0
false
4
216
2009-07-14 17:28:02.430
Best way to have full Python install under cygwin/XP?
Pythons installed under WinXP have dirs like DLLs, DOC, include, etc. but python (2.5) installed with cygwin is a bare python.exe. My motivation for asking is that 'things' under XP don't seem to be finding 'other things' under cygwin and vice versa, I want to start developing with Qt, I like shells, and I do not like...
This probably has little value, but... I found myself in this exact situation -- we use ActivePython2.5 in production (pure windows environment) and I was trying to do my development within cygwin and cygwin's Python... After ripping out half of my hair, I have now switched over to Console2, gvim, iPython and ActivePy...
0
false
4
216