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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,052,990 | 2010-10-29T14:53:00.000 | 1 | 1 | 1 | 0 | c#,python,c++ | 4,056,557 | 3 | false | 0 | 0 | XML is well supported across basically every language. It may become verbose for large maps, however, depending on how you encode the map data in XML.
JSON might not be a good choice, simply because I don't think it supports multiline strings, which would be helpful (although not really necessary)
YAML is another alternative, though it's not as well-known.
You could just stick to binary - most maps would be a pain to edit by hand, no matter what format you pick (though I've heard of Starcraft maps being edited with hex editors...) Just use whatever seems easiest for you.
Additionally, check out the Tiled map editor (http://www.mapeditor.org/), which lets you edit maps (with custom tile properties, I think) and save it in an XML based format, including optional GZip for compression. | 2 | 0 | 0 | I'm trying to figure out how I can best save the map data for a 2d ORPG engine I am developing, the file would contain tile data (Is it blocked, what actual graphics would it use, and various other properties).
I am currently using a binary format but I think this might be a bit too limited and hard to debug, what alternatives are there, I was thinking about perhaps JSON or XML but I don't know if there are any other better options.
It has to work with C++ and C# and preferably also with Python. | Saving map data in a 2d ORPG | 0.066568 | 0 | 0 | 446 |
4,052,990 | 2010-10-29T14:53:00.000 | 1 | 1 | 1 | 0 | c#,python,c++ | 4,062,198 | 3 | true | 0 | 0 | Personally, I would stick with a binary format. Whatever method you choose, it's going to be a pain in the ass to edit by hand anyway, so you may as well stick to binary which gives you a size and speed advantage.
You're also going to want a map editor anyway so that you do not have to edit it by hand. | 2 | 0 | 0 | I'm trying to figure out how I can best save the map data for a 2d ORPG engine I am developing, the file would contain tile data (Is it blocked, what actual graphics would it use, and various other properties).
I am currently using a binary format but I think this might be a bit too limited and hard to debug, what alternatives are there, I was thinking about perhaps JSON or XML but I don't know if there are any other better options.
It has to work with C++ and C# and preferably also with Python. | Saving map data in a 2d ORPG | 1.2 | 0 | 0 | 446 |
4,053,662 | 2010-10-29T16:02:00.000 | 2 | 1 | 1 | 0 | python,python-datamodel | 4,053,781 | 4 | false | 0 | 0 | If not specified in the documentation, it is implementation specific. Implementations other that CPython might re-use the iter method to implement iterkeys and others. I would not consider this to be a bug, but simply a bit of freedom for the implementors.
I suspect there is a performance factor in implementing the methods independently, especially as dictionaries are so widely used in Python.
So basically, you should implement them. | 2 | 1 | 0 | just encountered a problem at dict "type" subclassing. I did override __iter__ method and expected it will affect other methods like iterkeys, keys etc. because I believed they call __iter__ method to get values but it seems they are implemented independently and I have to override all of them.
Is this a bug or intention they don't make use of other methods and retrieves values separately ?
I didn't find in the standard Python documentation description of calls dependency between methods of standard classes. It would be handy for sublassing work and for orientation what methods is required to override for proper behaviour. Is there some supplemental documentation about python base types/classes internals ? | Python std methods hierarchy calls documented? | 0.099668 | 0 | 0 | 142 |
4,053,662 | 2010-10-29T16:02:00.000 | 1 | 1 | 1 | 0 | python,python-datamodel | 4,053,834 | 4 | false | 0 | 0 | You know the saying: "You know what happens when you assume." :-)
They don't officially document that stuff because they may decide to change it in the future. Any unofficial documentation you may find would simply document the current behavior of one Python implementation, and relying on it would result in your code being very, very fragile.
When there is official documentation of special methods, it tends to describe behavior of the interpreter with respect to your own classes, such as using __len__() when __nonzero__() isn't implemented, or only needing __lt()__ for sorting.
Since Python uses duck typing, you usually don't actually need to inherit from a built-in class to make your own class act like one. So you might reconsider whether subclassing dict is really what you want to do. You might choose a different class, such as something from the collections module, or to encapsulate rather than inheriting. (The UserString class uses encapsulation.) Or just start from scratch. | 2 | 1 | 0 | just encountered a problem at dict "type" subclassing. I did override __iter__ method and expected it will affect other methods like iterkeys, keys etc. because I believed they call __iter__ method to get values but it seems they are implemented independently and I have to override all of them.
Is this a bug or intention they don't make use of other methods and retrieves values separately ?
I didn't find in the standard Python documentation description of calls dependency between methods of standard classes. It would be handy for sublassing work and for orientation what methods is required to override for proper behaviour. Is there some supplemental documentation about python base types/classes internals ? | Python std methods hierarchy calls documented? | 0.049958 | 0 | 0 | 142 |
4,054,205 | 2010-10-29T17:05:00.000 | -1 | 0 | 0 | 0 | c#,python,xml,dataset,schema | 4,054,231 | 3 | false | 0 | 0 | hey dude - take beautifulSoup - it is a super library. HEAD over to the site scraperwiki.com
the can help you! | 2 | 1 | 0 | I'm looking to parse a xml file using Python and I was wondering if there was any way of automating the task over manually walking through all xml nodes/attributes using xml.dom.minidom library.
Essentially what would be sweet is if I could load a xml schema for the xml file I am reading then have that automatically generate some kind of data struct/set with all of the data within the xml.
In C# land this is possible via creating a strongly typed dataset class from a xml schema and then using this dataset to read the xml file in.
Is there any equivalent in Python? | Python XML Parse (using schema to generate dataset) | -0.066568 | 0 | 1 | 931 |
4,054,205 | 2010-10-29T17:05:00.000 | 0 | 0 | 0 | 0 | c#,python,xml,dataset,schema | 4,054,752 | 3 | false | 0 | 0 | You might take a look at lxml.objectify, particularly the E-factory. It's not really an equivalent to the ADO tools, but you may find it useful nonetheless. | 2 | 1 | 0 | I'm looking to parse a xml file using Python and I was wondering if there was any way of automating the task over manually walking through all xml nodes/attributes using xml.dom.minidom library.
Essentially what would be sweet is if I could load a xml schema for the xml file I am reading then have that automatically generate some kind of data struct/set with all of the data within the xml.
In C# land this is possible via creating a strongly typed dataset class from a xml schema and then using this dataset to read the xml file in.
Is there any equivalent in Python? | Python XML Parse (using schema to generate dataset) | 0 | 0 | 1 | 931 |
4,054,254 | 2010-10-29T17:10:00.000 | 1 | 0 | 0 | 0 | python,delay | 4,054,980 | 5 | false | 0 | 0 | Also you can try to use few proxy servers for prevent ban by IP adress. urllib support proxies by special constructor parameter, httplib can use proxy too | 2 | 67 | 0 | I have written a program which sends more than 15 queries to Google in each iteration, total iterations is about 50. For testing I have to run this program several times. However, by doing that, after several times, Google blocks me. is there any ways so I can fool google maybe by adding delays between each iteration? Also I have heard that google can actually learn the timesteps. so I need these delays to be random so google cannot find a patter from it to learn my behavior. also it should be short so the whole process doesn't take so much.
Does anyone knows something, or can provide me a piece of code in python?
Thanks | How to add random delays between the queries sent to Google to avoid getting blocked in python | 0.039979 | 0 | 1 | 111,313 |
4,054,254 | 2010-10-29T17:10:00.000 | 4 | 0 | 0 | 0 | python,delay | 4,054,614 | 5 | false | 0 | 0 | Since you're not testing Google's speed, figure out some way to simulate it when doing your testing (as @bstpierre suggested in his comment). This should solve your problem and factor its variable response times out at the same time. | 2 | 67 | 0 | I have written a program which sends more than 15 queries to Google in each iteration, total iterations is about 50. For testing I have to run this program several times. However, by doing that, after several times, Google blocks me. is there any ways so I can fool google maybe by adding delays between each iteration? Also I have heard that google can actually learn the timesteps. so I need these delays to be random so google cannot find a patter from it to learn my behavior. also it should be short so the whole process doesn't take so much.
Does anyone knows something, or can provide me a piece of code in python?
Thanks | How to add random delays between the queries sent to Google to avoid getting blocked in python | 0.158649 | 0 | 1 | 111,313 |
4,055,017 | 2010-10-29T19:01:00.000 | 5 | 0 | 1 | 0 | python,user-interface,tkinter | 4,055,447 | 1 | true | 0 | 1 | There is no option to associate a variable with a text widget. You can achieve the same thing by using variable traces and widget bindings but it's rarely worth the effort.
The typical way to interact with the text widget is to read a file into a variable then use the insert method of the widget to put the text into the widget. Then, to save you just do the reverse -- get the text from the widget with the get method, and write the data to a file.
One tip: when you do a get, don't get the text from 1.0 to "end", use "end-1c" instead. If you specify "end" as the last character you'll get the implicit newline that tk always adds, meaning your text file will grow by one character each time you do a load/save cycle. | 1 | 0 | 0 | so I've got this little Text widget with a scroll bar and I've got a question. How do I make text in this Text widget a variable ? If I made this text a variable I would be able to open a text file and edit it's text or save the text I've written, etc or maybe it's a wrong way that I'm approaching this, is there a better way to do this ? | Text in Text Widget as a variable | 1.2 | 0 | 0 | 1,548 |
4,055,267 | 2010-10-29T19:35:00.000 | 1 | 0 | 0 | 0 | python,windows,user-interface,window,tkinter | 41,426,823 | 5 | false | 0 | 1 | Try this, and it surely works;
Create an event function to move window:
def movewindow(event):
root.geometry('+{0}+{1}'.format(event.x_root, event.y_root))
Bind window:
root.bind('', movewindow)
Now you can touch the the window and drag | 1 | 17 | 0 | Any suggestions on how one might create event bindings that would allow a user to mouse drag a window without borders, eg. a window created with overridedirect(1)?
Use case: We would like to create a floating toolbar/palette window (without borders) that our users can drag around on their desktop.
Here's where I'm at in my thinking (pseudo code):
window.bind( '<Button-1>', onMouseDown ) to capture the initial position of the mouse.
window.bind( '<Motion-1>', onMouseMove ) to track position of mouse once it starts to move.
Calculate how much mouse has moved and calculate newX, newY positions.
Use window.geometry( '+%d+%d' % ( newX, newY ) ) to move window.
Does Tkinter expose enough functionality to allow me to implement the task at hand? Or are there easier/higher-level ways to achieve what I want to do? | Tkinter: Mouse drag a window without borders, eg. overridedirect(1) | 0.039979 | 0 | 0 | 20,122 |
4,058,878 | 2010-10-30T13:26:00.000 | 0 | 0 | 1 | 0 | python,multithreading,user-interface,tkinter | 5,036,358 | 1 | false | 0 | 1 | Definitely go the Queue route. Nothing in Tkinter is setup for being threadsafe :( | 1 | 3 | 0 | Are Tkinter StringVar (IntVar, FloatVar, etc) thread safe, eg. can a background thread read or write to these objects? Or must I use a Queue to pass information between my background thread and my main Tkinter GUI thread and have my main Tkinter thread pop the Queue and update the application's StringVar's accordingly?
I know my application's background threads must not read or write a Tkinter widget directly but I'm unclear on whether StringVar's (or their ilk) are considered widgets or if they are objects far enough removed from widgets that they are thread safe for background threads to read and/or write. | Python/Tkinter: Are Tkinter StringVar (IntVar, etc) thread safe? | 0 | 0 | 0 | 1,582 |
4,059,201 | 2010-10-30T14:49:00.000 | 6 | 1 | 0 | 0 | python,wxpython,ironpython | 4,059,227 | 4 | true | 0 | 1 | IronPython isn't a variant of Python, it is Python. It's an implementation of the Python language based on the .NET framework. So, yes, it is pure Python.
IronPython is caught up to CPython (the implementation you're probably used to) 2.6, so some of the features/changes seen in Python 2.7 or 3.x will not be present in IronPython. Also, the standard library is a bit different (but what you lose is replaced by all that .NET has to offer).
The primary application of IronPython is to script .NET applications written in C# etc., but it can also be used as a standalone. IronPython can also be used to write web applications using the SilverLight framework.
If you need access to .NET features, use IronPython. If you're just trying to make a Windows executable, use py2exe.
Update
For writing basic RDBMS apps, just use CPython (original Python), it's more extensible and faster. Then, you can use a number of tools to make it stand alone on a Windows PC. For now, though, just worry about learning Python (those skills will mostly carry over to IronPython if you choose to switch) and writing your application. | 3 | 4 | 0 | I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup.
I searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET.
I want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.). | Is IronPython a 100% pure Python variant? | 1.2 | 0 | 0 | 1,297 |
4,059,201 | 2010-10-30T14:49:00.000 | 1 | 1 | 0 | 0 | python,wxpython,ironpython | 4,059,540 | 4 | false | 0 | 1 | IronPython is an implementation of Python using C#. It's just like the implementation of Python using Java by Jython. You might want to note that IronPython and Jython will always lag behind a little bit in development. However, you do get the benefit of having some libraries that's not available in the standard Python libraries. In IronPython, you will be able to get access to some of the .NET stuff, like System.Drawings and such, though by using these non-standard libraries, it will be harder to port your code to other platforms. For example, you will have to install mono to run apps written in IronPython on Linux (On windows you will need the .NET Framework) | 3 | 4 | 0 | I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup.
I searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET.
I want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.). | Is IronPython a 100% pure Python variant? | 0.049958 | 0 | 0 | 1,297 |
4,059,201 | 2010-10-30T14:49:00.000 | 1 | 1 | 0 | 0 | python,wxpython,ironpython | 4,059,291 | 4 | false | 0 | 1 | what does "Pure Python" mean? If you're talking about implemented in Python in the same sense that a module may be pure python, then no, and no Python implementation is. If you mean "Compatible with cPython" then yes, code written to cPython will work in IronPython, with a few caveats. The one that's likely to matter most is that the libraries are different, for instance code depending on ctypes or Tkinter won't work. Another difference is that IronPython lags behind cPython by a bit. the very latest version of this writing is 2.6.1, with an Alpha version supporting a few of the 2.7 language features available too.
What do you really need? If you want to learn to program with python, and also want to produce code for windows, you can use IronPython for that, but you can also use cPython and py2exe; both will work equally well for this with only differences in the libraries. | 3 | 4 | 0 | I just downloaded the original Python interpreter from Python's site. I just want to learn this language but to start with, I want to write Windows-based standalone applications that are powered by any RDBMS. I want to bundle it like any typical Windows setup.
I searched old posts on SO and found guys suggesting wxPython and py2exe. Apart from that few suggested IronPython since it is powered by .NET.
I want to know whether IronPython is a pure variant of Python or a modified variant. Secondly, what is the actual use of Python? Is it for PHP like thing or like C# (you can either program Windows-based app. or Web.). | Is IronPython a 100% pure Python variant? | 0.049958 | 0 | 0 | 1,297 |
4,059,691 | 2010-10-30T16:53:00.000 | 1 | 0 | 1 | 0 | python,validation,conditional-statements | 4,059,701 | 3 | false | 0 | 0 | Use Python's language services to parse and compile the string, then execute the resulting AST. | 2 | 0 | 0 | what I am struggling with is testing predefined conditions which takes user provided parameters like in example below:
cond = "if ( 1 is yes and 2 is no ) or ( 1 is yes and 2 is no )"
cond2 = "if (3 is no or 1 is no )"
vars = []
lst = cond.split()
lst += cond2.split()
for l in lst:
if l.isdigit():
if l not in vars:
vars.append(l)
# ... sort
# ... read user answers => x = no, y = no, y = yes
# ... replace numbers with input (yes or no)
# ... finally I have
cond = "if ( no is yes and no is no ) or ( no is yes and no is no )"
cond2 = "if (yes is no or no is no )"
First of all, is this the right approach?
Secondly, how do I validate above conditions if True or False ?
Thank You in advance. | python: how to validate userdefined condition? | 0.066568 | 0 | 0 | 618 |
4,059,691 | 2010-10-30T16:53:00.000 | 0 | 0 | 1 | 0 | python,validation,conditional-statements | 4,060,569 | 3 | false | 0 | 0 | so, after some reading based on Ignacio's tip, I think I have it after some string modifications. However, still not quite sure if this is the right approach.
So, my condition variable is defined as below
cond = """if ( 'no' is 'yes' and 'no' is 'no' ):
result.append[1]
else:
result.append[0]
"""
Additionally I create variable to store condition result to evaluate it later
result = []
I run exec on my string
exec(cond)
Finally, I can evaluate result.
if result[0] == 1
print "Condition was met"
else:
print "Condition wasn't met"
Any thoughts or comments highly appreciated. | 2 | 0 | 0 | what I am struggling with is testing predefined conditions which takes user provided parameters like in example below:
cond = "if ( 1 is yes and 2 is no ) or ( 1 is yes and 2 is no )"
cond2 = "if (3 is no or 1 is no )"
vars = []
lst = cond.split()
lst += cond2.split()
for l in lst:
if l.isdigit():
if l not in vars:
vars.append(l)
# ... sort
# ... read user answers => x = no, y = no, y = yes
# ... replace numbers with input (yes or no)
# ... finally I have
cond = "if ( no is yes and no is no ) or ( no is yes and no is no )"
cond2 = "if (yes is no or no is no )"
First of all, is this the right approach?
Secondly, how do I validate above conditions if True or False ?
Thank You in advance. | python: how to validate userdefined condition? | 0 | 0 | 0 | 618 |
4,059,706 | 2010-10-30T16:58:00.000 | 9 | 0 | 1 | 0 | python,persistent,zeromq | 4,374,385 | 3 | true | 0 | 0 | As far as I know, Zeromq does not have any persistence. It is out of scope for it and needs to be handled by the end user. Just like serializing the message.
In C#, I have used db4o to add persistence. Typically I persist the object in its raw state, then serialize it and send it to ZMQ socket. Btw, this was for PUB/SUB pair. | 2 | 15 | 0 | Who has to manages the persistent in the ZeroMQ?
When we use the ZeroMQ clients in Python language, what are the plug-ins/modules available to manage the persistent?
I would like to know the patterns to use the ZeroMQ. | zeromq persistence patterns | 1.2 | 0 | 0 | 10,288 |
4,059,706 | 2010-10-30T16:58:00.000 | 3 | 0 | 1 | 0 | python,persistent,zeromq | 9,593,144 | 3 | false | 0 | 0 | On the application ends you can persist accordingly, for example I've built a persistance layer in node.js which communicated to back-end php calls and via websockets.
The persistance aspect held messages for a certain period of time (http://en.wikipedia.org/wiki/Time_to_live) this was to give clients a chance to connect. I used in-memory data structures but I toyed with the idea of using redis to gain on-disk persistance. | 2 | 15 | 0 | Who has to manages the persistent in the ZeroMQ?
When we use the ZeroMQ clients in Python language, what are the plug-ins/modules available to manage the persistent?
I would like to know the patterns to use the ZeroMQ. | zeromq persistence patterns | 0.197375 | 0 | 0 | 10,288 |
4,059,851 | 2010-10-30T17:35:00.000 | 0 | 1 | 0 | 1 | python,ruby,perl | 4,060,827 | 3 | false | 0 | 0 | The tomboy notes are saved as xml files so you could write a xml parser. | 1 | 0 | 0 | I am using sticky notes in ubuntu . And was wondering if it would be possible to read the text written in sticky notes using any scripting language . | is it possible to read the text written in a sticky note using a script in linux? | 0 | 0 | 0 | 536 |
4,061,635 | 2010-10-31T02:54:00.000 | 0 | 0 | 0 | 0 | python,postgresql,psycopg | 4,061,641 | 2 | false | 0 | 0 | You will definitely get an error the next time you try and execute a query, so I wouldn't worry if you can't alert the user at the exact instance they lose there network connection. | 2 | 2 | 0 | When connected to a postgresql database using psycopg and I pull the network cable I get no errors. How can I detect this in code to notify the user? | Python and psycopg detect network error | 0 | 1 | 0 | 214 |
4,061,635 | 2010-10-31T02:54:00.000 | 0 | 0 | 0 | 0 | python,postgresql,psycopg | 4,069,833 | 2 | true | 0 | 0 | psycopg can't detect what happens with the network. For example, if you unplug your ethernet cable, replug it and execute a query everything will work OK. You should definitely get an exception when psycopg tries to send some SQL to the backend and there is no network connection but depending on the exact netwokr problem it can take some time. In the worst case you'll have to wait for a TCP timeout on the connection (several tens of seconds). | 2 | 2 | 0 | When connected to a postgresql database using psycopg and I pull the network cable I get no errors. How can I detect this in code to notify the user? | Python and psycopg detect network error | 1.2 | 1 | 0 | 214 |
4,061,828 | 2010-10-31T04:18:00.000 | 1 | 0 | 0 | 0 | python,mysql,sqlalchemy,performance | 4,061,902 | 3 | true | 1 | 0 | I would create a read only slave to your mysql database and force its database engines to memory. You'd have to handle failures by re-initializing the read only database, but that can be scripted rather easily.
This way you still have your persistence in the regular mysql database and your read speed in the read only memory tables. | 2 | 1 | 0 | I am using Redis database where we store the navigational information. These data must be persistent and should be fetched faster. I don't have more than 200 MB data in this data set.
I face problem when writing admin modules for redis db and I really missing the sql schema and power of django style admin modules.
Now I am thinking of using MySQL. The requirement is, I want the persistent database but the data can be loaded into the memory like redis so that I can do the SQL queries REALLY faster.
Is it possible to use MySQL in persistent mode and instruct MySQL to use the memory for querying purpose? What is the best suitable MySQL DB where I do not worry much on consistencies where our writes are very few. | fit mysql db in memory | 1.2 | 1 | 0 | 1,165 |
4,061,828 | 2010-10-31T04:18:00.000 | 0 | 0 | 0 | 0 | python,mysql,sqlalchemy,performance | 4,061,848 | 3 | false | 1 | 0 | I would think you could have a persistent table, copy all of the data into a MEMORY engine table whenever the server starts, and have triggers on the memory db for INSERT UPDATE and DELETE write to the persistent table so it is hidden for the user. Correct me if I'm wrong though, it's just the approach I would first try. | 2 | 1 | 0 | I am using Redis database where we store the navigational information. These data must be persistent and should be fetched faster. I don't have more than 200 MB data in this data set.
I face problem when writing admin modules for redis db and I really missing the sql schema and power of django style admin modules.
Now I am thinking of using MySQL. The requirement is, I want the persistent database but the data can be loaded into the memory like redis so that I can do the SQL queries REALLY faster.
Is it possible to use MySQL in persistent mode and instruct MySQL to use the memory for querying purpose? What is the best suitable MySQL DB where I do not worry much on consistencies where our writes are very few. | fit mysql db in memory | 0 | 1 | 0 | 1,165 |
4,063,482 | 2010-10-31T14:28:00.000 | 2 | 0 | 0 | 1 | python,remote-debugging | 4,300,007 | 1 | true | 0 | 0 | Under Windows, I've experienced the same behavior you mention, i.e., remote debugging sometimes works, but often 'gets stuck'. I've found a few things helpful in resolving this situation:
Make sure your firewall isn't blocking traffic to/from the ports being used by WingIDE and the process being debugged. (In my case, I had to unblock both wing.exe and the program I was attempting to debug in Windows Firewall.)
Make sure you haven't accumulated any zombie python processes after failed debug sessions. These can hold open a connection to the IDE, making it impossible for a newly-spawned instance to connect. (Under Windows, you can use the tasklist command to check for running python instances, and netstat -anp tcp will show any sockets stuck in the TIME_WAIT state.)
Insert a time.sleep(10) call immediately after your import wingdbstub statement. Start the program from a console, make sure it connects in the IDE (debug icon will turn green), then hit the 'Pause' button in the IDE, followed by 'Step Out'. (I can't begin to explain why, but this appeared to right the ship for me a couple of times after the debug connection had gone wonky.)
The above advice probably applies to Linux as well, but I've only experienced this problem under Windows so far... | 1 | 1 | 0 | Using WingIDE to debug a web application, I have set a breakpoint in some Python code which runs when a web-form is submitted. Just before the breakpoint I have inserted 'import wingdbstub' to activate remote deubgging. However, execution does not stop at the breakpoint. I know the code is running because if I insert 'raise exception(sys.modules)' just before the breakpoint, execution stops and a traceback appears in my browser, showing wingdbstub is loaded.
If I hover over the bug icon in the status-bar, a dialog says "No debug process / listening for connections on TCP/IP 50005. Allowed hosts 127.0.0.1". I know I have 'lost' debug mode when a) the bug icon changes from green to white, and b) the debugging toolbar buttons (step into, over, out, etc.) disappear.
I tried deleting compiled .pyc files so that they recompile when the module next runs, but the problem remains.
How can I check if Wing is listening on the correct port? The strange thing is that remote-debugging has worked sometimes, but most of the time it doesn't.
Any help would be appreciated. For the record, I am using Python 3.1, CherryPy 3.20 and WingIDE Personal 3.2.11.
Alan | Remote debugging with WingIDE | 1.2 | 0 | 0 | 879 |
4,063,534 | 2010-10-31T14:41:00.000 | 3 | 0 | 1 | 0 | python | 4,063,575 | 1 | false | 0 | 0 | You can only tell if the job you're submitting is the shortest if you know the runtime of all your jobs in advance. This is not an easy thing to know without first running the jobs. SJF is rarely used for this reason. Scheduling in a FIFO is much easier; you stick the jobs in a list as they come in (with lst.append()) and lst.pop(0) one off whenever you need a new job to run. | 1 | 0 | 0 | Well , i want to test out which scheduling algorithm is suitable for my application , but unable to figure out on how to go about testing. i have a set of jobs to be executed , for SMP (Symmetric Multi Process ) execution i used Parallel Python , but not able to apply Job Scheduling algorithm .
For ex: if i want to implement SJF (Shortest Job First) how will know that the job i am submitting is the shortest compared to others , it may also happen that eventually a larger job submitted may become smaller than a relative smaller job submitted at that time. | How to perform Job scheduling algorithms using python? | 0.53705 | 0 | 0 | 4,097 |
4,065,157 | 2010-10-31T21:12:00.000 | 2 | 0 | 0 | 0 | python,django | 4,065,182 | 3 | false | 1 | 0 | I'd make all my times UTC, as that's a good international-level reference point, and you can always shift that to a local time, given that you know the user's TZ.
I'd also use the time on the server (datetime.datetime.now()) rather than rely on the client's system clock, as this makes it easy to fake what time something happened at. | 1 | 2 | 0 | My app in django requires to tell the user what time an action occurred. Aside from asking the user what timezone he/she is in, is it possible for me to generate the time on the client end?
Off the top of my head, are there a particular representation of time that is timezone independent, (unix time?), and then I can simply paste it into the html and have the client end (browser) findout the timezone and then do the calculation? | Django Time issues | 0.132549 | 0 | 0 | 274 |
4,066,075 | 2010-11-01T01:16:00.000 | 2 | 0 | 0 | 0 | python,data-structures,graph,sudoku | 4,066,155 | 4 | false | 0 | 0 | Others have reasonably suggested simply using a 2D array.
I note that a 2D array in most language implementations (anything in which that is implemented as "array of array of X" suffers from additional access time overhead (one access to the top level array, a second to the subarray).
I suggest you implement the data structure abstractly as a 2D array (perhaps even continuing to use 2 indexes), but implement the array as single block of 81 cells, indexed classically by i*9+j. This gives you conceptual clarity, and somewhat more efficient implementation, by avoiding that second memory access.
You should be able to hide the 1D array access behind setters and getters that take 2D indexes. If your language has the capability (dunno if this is true for Python), such small methods can be inlined for additional speed. | 1 | 6 | 1 | What would be a smart data structure to use to represent a Sudoku puzzle? I.e. a 9X9 square where each "cell" contains either a number or a blank.
Special considerations include:
Ability to compare across row, column, and in 3X3 "group
Ease of implementation (specifically in Python)
Efficiency (not paramount)
I suppose in a pinch, a 2D array might work but that seems to be a less than elegant solution. I just would like to know if there's a better data structure. | Proper data structure to represent a Sudoku puzzle? | 0.099668 | 0 | 0 | 7,767 |
4,066,173 | 2010-11-01T01:46:00.000 | 0 | 0 | 1 | 0 | python,imagemagick | 4,066,240 | 2 | false | 0 | 0 | It would be a lot more work than piping data to ImageMagick, but there are several Pango based solutions. I used pango and pygtk awhile back, and I am pretty sure you could develop a headless gtk or gdk application to render text to a pixbuf.
A simpler solution might be to use the python cairo bondings.
Pango works at a pretty low level, so simple stuff can be a lot more complicated, but rendering quality is hard to beat, and it gives you a lot of fine grained control over the layout. | 1 | 4 | 0 | I'm working in Python to create images from text. I've already been back and forth with PIL and frankly, its font and alignment options need a lot of work.
I can subprocess Imagemagick and it works great, except that it seems to always need to write a file to disk. I would like to subprocess the image creation and just get the data returned to Python, keeping everything in memory.
I've looked into a number of supposed Python wrappers for ImageMagick, but they're all hopelessly years out of date or not documented whatsoever. Even searching extensively on SO doesn't see to clearly point to a defacto way to use ImageMagic with Python. So I think going for subprocessing is the best way forward. | Using Imagemagick without making files? | 0 | 0 | 0 | 1,322 |
4,066,328 | 2010-11-01T02:31:00.000 | 2 | 0 | 1 | 0 | python,windows-xp | 4,066,380 | 1 | false | 0 | 0 | which in turn executes the script which ...
How does it ‘execute’ the script? You mean an import? A subprocess call? Something else?
Because “no viable alternative at input...” is a distinctive ANTLR parser error, and CPython 2.6 doesn't use that.
Jython 2.5 does. But Jython shouldn't be trying to run the codecs module from CPython 2.6. In this case it fails because of the syntax b"" for byte strings which is new in Python 2.6. | 1 | 1 | 0 | I'm using a script which imports some modules, one being codecs. When the script is executed, I'll get a Traceback (most recent call last): on the import codecs line and SyntaxError: ('no viable alternative at input \'""\'', ('C:\\Python26\\lib\\codecs.py', 268, 17, ' return (b"", 0)\n')). This only occurs when I'm executing my own script which in turn executes the script which imports the codecs module. If I directly execute the script through cmd, the error will not occur. | Python: Syntax Error for imported module - 'codecs.py' | 0.379949 | 0 | 0 | 1,142 |
4,066,571 | 2010-11-01T04:06:00.000 | 2 | 1 | 1 | 0 | python,buildout,pypi,tipfy | 4,066,739 | 6 | false | 0 | 0 | To keep your headache in check, I would really recommend just bundling all such custom code with your package. Say you made a fork of some package. As long as its license allows it, I would just bundle the modified version of package with my code, as if it's just another directory. You can place it locally under package so it will be easily found. Once the developers of package fix what you need, just remove this directory and make it a dependency on an online package once again.
An added bonus of this approach is making distribution to users/customers easier. | 1 | 5 | 0 | I'm doing a few projects in python right now, and I'm trying to figure out how to work with my own versions of existing open source packages.
For instance, I'm using tipfy with zc.buildout, and I've added in the 'paypal' package. Unfortunately it doesn't have a feature I need, so I've forked it on github and added the feature. I will send the original package maintainers a pull request, but whether they accept my additions or not, I'd like to use my version of the package and keep the convenience of having zc.buildout manage my dependencies. How do I do this?
Do I upload my own take on the library to PyPI and prefix it with my name? Wouldn't that unnecessarily pollute the index?
Or should I make and maintain my own index and package repo? Where do I find the format for this? And is it against to terms of the OSS licenses to host my own repo with modified packages with the same names? (I'd rather not modify every file in the project with new namespaces)
I'm sure this problem comes up quite a lot, and not just with python. I can see this happening with Maven and SBT, too... what do people usually do when they want to use their own versions of popular packages? | Using custom packages on my python project | 0.066568 | 0 | 0 | 1,349 |
4,067,499 | 2010-11-01T08:34:00.000 | 1 | 1 | 1 | 0 | python,gmail,imap,imaplib,gmail-imap | 4,069,524 | 2 | true | 0 | 0 | Simple answer: yes.
There is no concept of Deleted Items, Trash, etc. in IMAP. If you want to have a message in one of those folders after deletion, you have to copy it. | 1 | 1 | 0 | When I use google IMAP and try to delete message the message removes from folder but not going to trash folder. Did i must to copy this message before delete it? | Deleting using google IMAP (python, imaplib) | 1.2 | 0 | 0 | 896 |
4,068,052 | 2010-11-01T10:20:00.000 | 0 | 0 | 0 | 0 | java,python,django,jython | 40,502,477 | 4 | false | 1 | 0 | It might be what you wanted to avoid.
but at the most simple way of things, using sockets / shared file with java will be the best solution.
python socket can send information and revise it from java.
On the other hand if that feel like a pain. if you use java and python at the same computer you can use a shared file, that java can read from and python can wright to. | 1 | 5 | 0 | Apologies if my question is noob. I'm running Django 1.2 with pgsql 8.4 and I'm required to run a Java program after getting the inputs from the user, does some calculations and return the results back to the user.
May I know what is the best way to pass data between the Java and Python Django, such that the above scenario are taken care of? I heard of Jython, but according to the Django docs, it requires the extension jython-Django, but currently it doesn't support django 1.2.x. Should I pass the data using stdout?
thanks people for hearing me out. | passing data between java and python | 0 | 0 | 0 | 5,214 |
4,068,906 | 2010-11-01T12:37:00.000 | 0 | 0 | 0 | 0 | python,dll,windows-vista,qt4,pyqt4 | 4,453,952 | 1 | false | 0 | 1 | Yes, Qt plugin infrastructure is a fairly simple and robust one.
It attempts to load every file in sqldrivers directory. If it is successful, each dll then runs a function that registers all the features such a plugin supports.
Then, you application initalizes. If all the features it needs are available, it works properly, otherwise, some form of error or exception handling occurs. | 1 | 0 | 0 | I'm experimenting with PyQT, and I was trying to figure out how to get it to work with Firebird. I built the Firebird driver, but couldn't get it to work, so I was thinking maybe I wasn't putting it in the right place. So I tried experimenting with the SQLite driver, since PyQT came with it already installed, with working examples. I figured if I renamed all the qsqlite4.dll driver files I could find, eventually the example program would stop working when I renamed the one it was actually using. That didn't work. So I tried renaming the "site-packages\pyqt4\plugins\sqldrivers" folder to "site-packages\pyqt4\plugins\sqldrivers-old", and that did it. The example program stopped working. So I changed the folder name back, and tried renaming all the files in the folder. But the example program started working again. Then I moved the qsqlite4.dll file to a subdirectory, and it stopped working. So I moved it back, and renamed it to blah.blah.blah. And it worked again. Then I opened up blah.blah.blah with notepad++, and deleted some stuff at the top of the file, and that kept the example program from working. So I'm confused. As far as I can tell, either Python, PyQT, QT, or Windows Vista is finding the dll, no matter what I rename it to, as long as it's in the right folder. I even tried renaming it to the name of one of the other dll's, thinking maybe that would confuse it. But it only confused me. Is this normal?
edit: I'm thinking this has something to do with plugins | Either Python, PyQT, QT, or Windows Vista is finding my dll, no matter what I rename it to. Is this normal? | 0 | 0 | 0 | 284 |
4,072,844 | 2010-11-01T20:37:00.000 | 0 | 0 | 0 | 0 | python,numpy,scipy | 4,072,921 | 3 | false | 0 | 0 | If your application is not sensitive to precision or you just want a quick overview, you could just fill the unknown data points with averages from neighbouring known data points (in other words, do naive linear interpolation). | 1 | 7 | 1 | Given some data of shape 20x45, where each row is a separate data set, say 20 different sine curves with 45 data points each, how would I go about getting the same data, but with shape 20x100?
In other words, I have some data A of shape 20x45, and some data B of length 20x100, and I would like to have A be of shape 20x100 so I can compare them better.
This is for Python and Numpy/Scipy.
I assume it can be done with splines, so I am looking for a simple example, maybe just 2x10 to 2x20 or something, where each row is just a line, to demonstrate the solution.
Thanks! | Add more sample points to data | 0 | 0 | 0 | 5,913 |
4,073,352 | 2010-11-01T21:47:00.000 | 1 | 0 | 0 | 0 | python,django | 4,073,511 | 4 | false | 1 | 0 | The devserver included with django is for testing purposes, only on your local machine and should not be used on a web host. From the docs:
DO NOT USE THIS SERVER IN A PRODUCTION
SETTING. It has not gone through
security audits or performance tests.
(And that's how it's gonna stay. We're
in the business of making Web
frameworks, not Web servers, so
improving this server to be able to
handle a production environment is
outside the scope of Django.)
If i have somehow misinterpreted your question, i apologise. | 1 | 1 | 0 | I'm learning Django and working on sample sites.. I registered at alwaysdata but am unable to view the site after I go 'manage.py runserver' in the SSH (this is after I've created the project and navigated to the appropriate directory, of course).
I appreciate any help.
Thanks | Django + alwaysdata.com Noob Question | 0.049958 | 0 | 0 | 1,444 |
4,073,928 | 2010-11-01T23:21:00.000 | 0 | 0 | 0 | 0 | python,scroll,2d,pygame | 14,293,575 | 5 | false | 0 | 1 | You can have a 2 variables level_landlevel_d which see where you are in the level, Then check which sprites are in the visible area
level_d+height and level_l+width,
and draw them on the screen. | 3 | 2 | 0 | I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups.
What I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level.
But now, since we use the "spriteGroup.draw(surface)" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player/enemy/bullet/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated.
Is this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects.
Obviously the ideal method (I think) is to use Rects with "real" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT.
Any comments/insight would be appreciated.
Thanks | Pygame: Updating Rects with scrolling levels | 0 | 0 | 0 | 1,235 |
4,073,928 | 2010-11-01T23:21:00.000 | 0 | 0 | 0 | 0 | python,scroll,2d,pygame | 14,189,213 | 5 | false | 0 | 1 | One method I found is to keep track of a scrollx and a scrolly. Then, just add scrollx and scroll y to the coordinates when you move the rectangles. | 3 | 2 | 0 | I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups.
What I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level.
But now, since we use the "spriteGroup.draw(surface)" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player/enemy/bullet/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated.
Is this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects.
Obviously the ideal method (I think) is to use Rects with "real" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT.
Any comments/insight would be appreciated.
Thanks | Pygame: Updating Rects with scrolling levels | 0 | 0 | 0 | 1,235 |
4,073,928 | 2010-11-01T23:21:00.000 | 1 | 0 | 0 | 0 | python,scroll,2d,pygame | 4,077,600 | 5 | false | 0 | 1 | You could extend de Sprite.Group so it recives the camera information.
Then do one of these options:
A. Override the update method so it updates the on-screen coordinates of every sprite.
B. Override the draw method so it updates the on-screen coordinates of every sprite and then calls its parent draw method.
I think A it's easier and cleaner. | 3 | 2 | 0 | I'm currently making a 2D side-scrolling run'n'jump platform game in PyGame. Most of the stuff is working OK and very well in fact - I am exploiting the fast pyGame Sprite objects & groups.
What I'm interested to know is how people usually deal with Rects for scrolling games. I obviously have a level that is much bigger than visible area, and the player, enemies, bullets etc each have their own (x,y) coordinates which describe where they are in the level.
But now, since we use the "spriteGroup.draw(surface)" call, it will not display them in the right spot unless each objects Rects have been adjusted so that the right part displays on the screen. In other words, everytime a player/enemy/bullet/whatever else is updated, the Camera information needs to be passed, so that their Rect can be updated.
Is this the best method to use? It works but I don't really like passing the camera information to every single object at every update to offset the Rects.
Obviously the ideal method (I think) is to use Rects with "real" coordinates, blit everything to a buffer as big as the level, and then just blit the visible part to the screen, but in practice that slows the game down A LOT.
Any comments/insight would be appreciated.
Thanks | Pygame: Updating Rects with scrolling levels | 0.039979 | 0 | 0 | 1,235 |
4,075,309 | 2010-11-02T06:11:00.000 | 0 | 1 | 0 | 0 | php,.net,python,ruby | 4,076,484 | 3 | true | 1 | 0 | I presume you're using a CMS. If not, use one. WordPress is a good start.
If you're developing from scratch, the usual method is to have two tables: one for page information (so title, menu position etc.) and then a page_content table, which has columns for page_id, content, and timestamp.
As you save a page, instead of updating a database table you instead write a new record to the page_content table with the page's ID and the time of the save. That way, when displaying pages on your front-end you just select the latest record for that particular page ID, but you also have a history of that page by querying for all records by page_id, sorted by timestamp. | 2 | 0 | 0 | Our client wants us to implement change history for website articles. What is the best way to do it? | What is the best way to store change history of website articles? | 1.2 | 0 | 1 | 289 |
4,075,309 | 2010-11-02T06:11:00.000 | -1 | 1 | 0 | 0 | php,.net,python,ruby | 4,075,372 | 3 | false | 1 | 0 | There is a wide variety of ways to do this as you alluded by tagging php, .net, python, and ruby. You missed a few off the top of my head perl and jsp. Each of these have their plusses and minuses and is really a question of what best suits your needs.
PHP is probably the fastest reward for time spent.
Ruby, i'm assuming Ruby on Rails, is the automatic Buzz Word Bingo for the day.
.Net, are you all microsoft every where and want easy integration with your exchange server and a nice outlook API?
python? Do you like the scripted languages but you're too good for php and ruby.
Each of these languages have their strong points and their draw backs and it's really a matter of what you know, how much you have to spend, and what is your timeframe. | 2 | 0 | 0 | Our client wants us to implement change history for website articles. What is the best way to do it? | What is the best way to store change history of website articles? | -0.066568 | 0 | 1 | 289 |
4,075,627 | 2010-11-02T07:16:00.000 | 0 | 0 | 0 | 1 | python,python-3.x | 5,056,711 | 1 | false | 0 | 0 | Is there a problem in making the current directory e:\\lynx from withing python? That seems like a good solution to me. | 1 | 1 | 0 | With args=['e:\\lynx\\lynx.exe','-dump',some_url],
subprocess.check_output works fine if the current-directory is e:\lynx.
Elsewhere, it fails with a CalledProcessException and retcode of -1.
For now, I do not wish to add e:\lynx to PATH.
Any thoughts? | Python on Windows - subprocess.check_output with full-path works not? | 0 | 0 | 0 | 490 |
4,076,055 | 2010-11-02T08:41:00.000 | 0 | 0 | 1 | 0 | python,audio,microphone,pyaudio | 4,076,389 | 2 | false | 0 | 0 | I have performed basic signal processing (FFT etc) using numpy/scipy directly on the audio buffer without too much trouble. Be careful, you need to tell numpy about the buffer type: float or int, long or short, signed/unsigned ... | 1 | 0 | 0 | I am trying to obtain the pitch, the level, and other stuff from my microphone using Python. I am trying using pyaudio, but I read that I need to use other libraries to generate the maths. I can’t find how mix pyaudio with the math library. | How do I do mathematical analysis on microphone audio information from pyaudio? | 0 | 0 | 0 | 961 |
4,076,114 | 2010-11-02T08:49:00.000 | 0 | 0 | 1 | 0 | c#,python,remoting | 4,077,076 | 3 | false | 0 | 0 | I would use XML-RPC for communication. It is very simple to implement (a couple lines of code in Python, not sure about .NET but it shouldn't be difficult there either) and should be enough in your scenario. | 2 | 1 | 0 | I've got a problem. I Have a tool(threads manager) that receives some data and do some computation. I need to write Python client to send data to that tool...I thing I should use .NET Remoting, but how to do that?
pls share some links where I can read or post some code...I can't google info about that...
P.S Python 2.7, NOT IronPython | How implement .NET server and Python client? | 0 | 0 | 0 | 987 |
4,076,114 | 2010-11-02T08:49:00.000 | 1 | 0 | 1 | 0 | c#,python,remoting | 4,076,158 | 3 | true | 0 | 0 | .Net Remoting is designed for when you have .net at both ends so will be very hard to use from the Python end. (Event the XML encoding of .net remoting is not easy to use from other platforms)
I am assuming that Python has support for soap, if so I would look at using WCF at the .net end running over the “basic profile”. JSON is another option, there are lots of open source projects that add JSON support to .net, I assume that Python also has JSON surport. | 2 | 1 | 0 | I've got a problem. I Have a tool(threads manager) that receives some data and do some computation. I need to write Python client to send data to that tool...I thing I should use .NET Remoting, but how to do that?
pls share some links where I can read or post some code...I can't google info about that...
P.S Python 2.7, NOT IronPython | How implement .NET server and Python client? | 1.2 | 0 | 0 | 987 |
4,076,695 | 2010-11-02T10:16:00.000 | 0 | 0 | 1 | 0 | python,syntax-highlighting,sublimetext,keyword,todo | 4,076,750 | 2 | true | 0 | 0 | This is very specific to the editor.
Language/Platform has nothing to do with highlighting. | 1 | 1 | 0 | Can I define #@TODO or something like that as a keyword to be highlighted in Python?
Is this specific to the text editor or to the language/platform? | Define todo keyword in Python and Sublime Text | 1.2 | 0 | 0 | 1,159 |
4,076,822 | 2010-11-02T10:33:00.000 | 0 | 0 | 1 | 0 | python,data-structures,hash,set | 4,076,849 | 2 | false | 0 | 0 | Hashes can collide. You will have to consider that. | 1 | 0 | 0 | I have ~200K named properties and ~25K files. I extract whether the properties hold or not for each file using Python as a set of properties that hold, one set for each file.
To do this extraction I might run hundreds of individual python extraction scripts on a compute farm, in parallel. Each leaving behind some representation of the set extraction from each of the files.
Further processing involves reading these 20K sets and working on the accumulated data. to generate a report on this set of files/properties.
One issue I have is that if I store the extracted set as text then the long property name strings and file name strings will get repeated wasting disk space and increasing parse time.
I was thinking of creating a central index of the sorted property names and just saving the index - same for the file names, as probably .py files to import.
An alternative to using an index into the sorted list of names would be to use the str.hash() value as the index which would mean probably faster processing, but I am worried about the possibility of two unequal strings ending up with the same hash() value. Could this happen?
I would be using the same Python executable and OS version on all machines. | Hash+mapping or index+mapping to condense use of strings | 0 | 0 | 0 | 148 |
4,077,338 | 2010-11-02T11:52:00.000 | 0 | 1 | 0 | 1 | python,linux,unit-testing,regression | 4,078,021 | 2 | false | 0 | 0 | You could use a helper application that is setuid root to run the chroot; that would avoid the need to run the tests as root. Of course, that would probably still open up a local root exploit, so should only be done with appropriate precautions (e.g. in a VM image).
At any rate, any solution with chroot is inherently platform-dependent, so it's rather awkward. I actually like the idea of Dave Webb (override open) better, I must admit... | 1 | 3 | 0 | I need to extend a python code which has plenty of hard coded path
In order not to mess everything, I want to create unit-tests for the code before my modifications: it will serve as non-regression tests with my new code (that will not have hard-coded paths)
But because of hard coded system path, I shall run my test inside a chroot tree (I don't want to pollute my system dir)
My problem is that I want to set up the chroot only for test, and this can be done with os.chroot only with root privileges (and I don't want to run the test scripts as root)
In fact, I just need a fake tree diretory so that when the code that open('/etc/resolv.conf) retrieves a fake resolv.conf and not my system one
I obviously don't want to replace myself the hard coded path in the code because it would not be real regression test
Do you have any idea how to achieve this?
Thanks
Note that all the path accessed are readable with a user accout | regression test dealing with hard coded path | 0 | 0 | 0 | 291 |
4,078,084 | 2010-11-02T13:25:00.000 | 2 | 0 | 0 | 0 | python,memory-leaks,garbage-collection,twisted,memory-management | 4,078,247 | 1 | false | 0 | 0 | If the code is only leaking under load (did you verify this?), I'd have a look at all spots where messages are buffered. Does the memory usage of the process itself increase? Or does the memory use of the system increase? If it's the latter case, your server might simply be too slow to keep up with the incoming messages and the OS buffer fill up.. | 1 | 13 | 0 | I have a Twisted server under load. When the server is under load, memory usage increases, and it is never reclaimed (even when there are no more clients). Next time it goes into high load, memory usage increases again. Here's a snapshot of the situation at that point:
RSS memory is 400 MB (should be 200MB with usual max number of clients).
gc.garbage is empty, so there are no uncollectable objects.
Using objgraph.py shows no obvious candidates for leaks (no notable difference between a normal, healthy process and a leaking process).
Using pympler shows a few tens of MB (only) used by Python objects (mostly dict, list, str and other native containers).
Valgrind with leak-check=full enabled doesn't show any major leaks (only couple of MBs 'definitively lost') - so C extensions are not the culprit. The total memory also doesn't add up with the 400MB+ shown by top:
==23072== HEAP SUMMARY:
==23072== in use at exit: 65,650,760 bytes in 463,153 blocks
==23072== total heap usage: 124,269,475 allocs, 123,806,322 frees, 32,660,215,602 bytes allocated
The only explanation I can find is that some objects are not tracked by the garbage collector, so that they are not shown by objgraph and pympler, yet use an enormous amount of RAM.
What other tools or solutions do I have? Would compiling the Python interpreter in debug mode help, by using sys.getobjects? | Memory leak in Python Twisted: where is it? | 0.379949 | 0 | 0 | 2,703 |
4,078,734 | 2010-11-02T14:38:00.000 | 4 | 0 | 1 | 0 | python,windows,audio,jython,sikuli | 4,079,110 | 6 | false | 0 | 1 | If its Jython, then just use any of the Java classes that play sound. There are tons of them.
from java import net
from java.applet.Applet import newAudioClip
from java import io
url = io.File("fileName").toURL()
audio = newAudioClip(url)
audio.play()
import sun.audio
import java.io
inputStream = java.io.FileInputStream("test.wav")
audioStream = sun.audio.AudioStream(inputStream)
sun.audio.AudioPlayer.player.start(audioStream) | 3 | 7 | 0 | I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.)
How can I do this? I see that the winsound module is not available on Jython.
(Note that I want to use the sound card, not the built-in beeper.) | Jython: Making a simple beep on Windows | 0.132549 | 0 | 0 | 2,323 |
4,078,734 | 2010-11-02T14:38:00.000 | 0 | 0 | 1 | 0 | python,windows,audio,jython,sikuli | 4,987,576 | 6 | false | 0 | 1 | Since you are using Sikuli you can to the following.
Add any mediafile such as any .mp3 on the desktop of a windows machine, asociate the file to a media player. Capture the image and include:
click(pattern(desktopnoiseicon.png)
alternatley you could execute the same task with openApp(C:\noise.mp3)
Sikuli gives the ability to find numerous workarounds
in SikuluXrc2 you could even point to a URL from your code without the need of setting a bundle path | 3 | 7 | 0 | I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.)
How can I do this? I see that the winsound module is not available on Jython.
(Note that I want to use the sound card, not the built-in beeper.) | Jython: Making a simple beep on Windows | 0 | 0 | 0 | 2,323 |
4,078,734 | 2010-11-02T14:38:00.000 | 2 | 0 | 1 | 0 | python,windows,audio,jython,sikuli | 5,165,371 | 6 | false | 0 | 1 | You may do the fllowing using command line:
Execute "copy con beep.txt"
type [ctrl+G] as input and then [ctrl+Z] followed by [Enter] to exit
Then run
"type beep.txt"
and you will hear a beep.
You may place "type beep.txt" in a batch file or use Ctrl+G directly in batch (which would produce error in command line with sound) | 3 | 7 | 0 | I'm working with Sikuli, which (I think) is build on Jython. I want to make a script that does a small gentle beep to attract the user's attention. (This is on Windows.)
How can I do this? I see that the winsound module is not available on Jython.
(Note that I want to use the sound card, not the built-in beeper.) | Jython: Making a simple beep on Windows | 0.066568 | 0 | 0 | 2,323 |
4,079,866 | 2010-11-02T16:33:00.000 | 5 | 0 | 0 | 0 | python,wxpython,gui-builder | 4,080,817 | 5 | false | 0 | 1 | In addition to those, some people really like the XRCed application that's included with wxPython. Basically you create your GUI in XML. There's also the defunct Boa Constructor that I see people still using on the wxPython user's list. | 2 | 29 | 0 | Is there a good wxpython GUI builder that does not require much coding, like in the case of the form builder in MS visual studio ? | A good wxpython GUI builder? | 0.197375 | 0 | 0 | 46,286 |
4,079,866 | 2010-11-02T16:33:00.000 | 0 | 0 | 0 | 0 | python,wxpython,gui-builder | 55,686,053 | 5 | false | 0 | 1 | You can use ezWxPython. it is not gui builder, but it helps you make layout easy same way as pySimpleGUI. | 2 | 29 | 0 | Is there a good wxpython GUI builder that does not require much coding, like in the case of the form builder in MS visual studio ? | A good wxpython GUI builder? | 0 | 0 | 0 | 46,286 |
4,080,413 | 2010-11-02T17:30:00.000 | 6 | 0 | 0 | 0 | python,python-3.x,widget,tkinter-canvas | 4,080,471 | 1 | true | 0 | 1 | Your choices depend on what you're really trying to accomplish. Why is using a canvas preferable to using a frame?
You can easily add widgets to a canvas just like you do any other container, using pack or grid or place. when you do this, the items will not scroll when you scroll the canvas because they aren't actually part of the canvas.
The other choice is to create window objects on the canvas. You do this with the create_window method of the canvas. The advantage is, this window becomes part of the canvas and will scroll along with any other objects on the canvas. The downside is, your only option is absolute placement and you have to explicitly control the size of the widgets. | 1 | 4 | 0 | I want basically to be able to use a Canvas as a meta container for other widgets.
I want to divide my GUI into a left, center and middle section. Within each section I would like to be able to place widgets like: Checkbutton, Button, Label, etc.
How to place widgets in a Canvas widget? | How to place a widget in a Canvas widget in Tkinter? | 1.2 | 0 | 0 | 4,505 |
4,080,688 | 2010-11-02T18:04:00.000 | 1 | 0 | 1 | 0 | python,pickle,graceful-degradation | 4,160,332 | 5 | false | 0 | 0 | This is how I would do this (I did something similar before and it worked):
Write a function that determines whether or not an object is pickleable
Make a list of all the pickleable variables, based on the above function
Make a new dictionary (called D) that stores all the non-pickleable variables
For each variable in D (this only works if you have very similar variables in d)
make a list of strings, where each string is legal python code, such that
when all these strings are executed in order, you get the desired variable
Now, when you unpickle, you get back all the variables that were originally pickleable. For all variables that were not pickleable, you now have a list of strings (legal python code) that when executed in order, gives you the desired variable.
Hope this helps | 1 | 12 | 0 | I have an object gui_project which has an attribute .namespace, which is a namespace dict. (i.e. a dict from strings to objects.)
(This is used in an IDE-like program to let the user define his own object in a Python shell.)
I want to pickle this gui_project, along with the namespace. Problem is, some objects in the namespace (i.e. values of the .namespace dict) are not picklable objects. For example, some of them refer to wxPython widgets.
I'd like to filter out the unpicklable objects, that is, exclude them from the pickled version.
How can I do this?
(One thing I tried is to go one by one on the values and try to pickle them, but some infinite recursion happened, and I need to be safe from that.)
(I do implement a GuiProject.__getstate__ method right now, to get rid of other unpicklable stuff besides namespace.) | Python: Pickling a dict with some unpicklable items | 0.039979 | 0 | 0 | 7,031 |
4,080,749 | 2010-11-02T18:10:00.000 | 15 | 0 | 0 | 0 | python,optimization,premature-optimization,python-import | 4,080,823 | 5 | true | 1 | 0 | No, don't do this. In a normal python execution environment on the web (mod_wsgi, gunicorn, etc.) when your process starts those imports will be executed, and then all subsequent requests will not re-execute the script. If you put the imports inside the functions they'll have to be processed every time the function is called. | 3 | 5 | 0 | In a framework such as Django, I'd imagine that if a user lands on a page (running a view function called "some_page"), and you have 8 imports at the top of module that are irrelevant to that view, you're wasting cycles on those imports. My questions are:
Is it a large enough amount of resources to make an impact on a high-traffic website?
Is it such a bad practice to import inside of a function for this purpose that it should be avoided at said impact?
Note: This could be considered premature optimization, but I'm not interested in that argument. Let's assume, for the sake of practical theory, that this is a completed site with loads of traffic, needing to be optimized in every way possible, and the application code, as well as DB have been fully optimized by 50 PhD database admins and developers, and these imports are the only thing left. | Python - optimize by not importing at module level? | 1.2 | 0 | 0 | 1,475 |
4,080,749 | 2010-11-02T18:10:00.000 | 4 | 0 | 0 | 0 | python,optimization,premature-optimization,python-import | 4,080,821 | 5 | false | 1 | 0 | 1) The answer is no. Django/Python is not like PHP. Your whole module will not be reinterpreted with each pageview like happens with PHP includes. The module will be in memory and each page view will make a simple function call to your view.
2) Yes, it will be a counter-optimization to make imports at the view level. | 3 | 5 | 0 | In a framework such as Django, I'd imagine that if a user lands on a page (running a view function called "some_page"), and you have 8 imports at the top of module that are irrelevant to that view, you're wasting cycles on those imports. My questions are:
Is it a large enough amount of resources to make an impact on a high-traffic website?
Is it such a bad practice to import inside of a function for this purpose that it should be avoided at said impact?
Note: This could be considered premature optimization, but I'm not interested in that argument. Let's assume, for the sake of practical theory, that this is a completed site with loads of traffic, needing to be optimized in every way possible, and the application code, as well as DB have been fully optimized by 50 PhD database admins and developers, and these imports are the only thing left. | Python - optimize by not importing at module level? | 0.158649 | 0 | 0 | 1,475 |
4,080,749 | 2010-11-02T18:10:00.000 | 5 | 0 | 0 | 0 | python,optimization,premature-optimization,python-import | 4,080,836 | 5 | false | 1 | 0 | Yes, it is a bad practice to import at the function level. By using smarter imports at the top of the module, you create a one time, small cost. However, if you place an import in a function you will suffer the cost of the import each time that function is run. So, rather than import in the function, just import at the top of the module.
A few things you can do to clean up and improve your imports:
Don't use wild imports e.g. from x import *
Where possible, just use a normal import e.g. import x
Try to split your code up into smaller modules that can be called separately, so that fewer imports are made
Also, placing imports at the top of the module is a matter of style. There's a reason why PEP 8 says that modules need to be imported at the top. It's far more readable and maintainable that way.
Finally, some imports at function level will cause compatibility issues in the future, as from x import * is not valid Python 3.x at function level. | 3 | 5 | 0 | In a framework such as Django, I'd imagine that if a user lands on a page (running a view function called "some_page"), and you have 8 imports at the top of module that are irrelevant to that view, you're wasting cycles on those imports. My questions are:
Is it a large enough amount of resources to make an impact on a high-traffic website?
Is it such a bad practice to import inside of a function for this purpose that it should be avoided at said impact?
Note: This could be considered premature optimization, but I'm not interested in that argument. Let's assume, for the sake of practical theory, that this is a completed site with loads of traffic, needing to be optimized in every way possible, and the application code, as well as DB have been fully optimized by 50 PhD database admins and developers, and these imports are the only thing left. | Python - optimize by not importing at module level? | 0.197375 | 0 | 0 | 1,475 |
4,081,020 | 2010-11-02T18:40:00.000 | 0 | 0 | 0 | 0 | python,user-interface,gtk,pygtk | 4,085,525 | 1 | true | 0 | 1 | Are you sure it's the minimize button? Because GTK doesn't deal with (or even know about the existence of) minimize buttons at all, they are part of the window manager. | 1 | 0 | 0 | Problem: I have a gtk.Dialog. Whenever the 'minimize' button on the dialog is clicked, the window is destroyed.
Question: How can I connect to the minimize button of a gtk.Dialog so that I can iconify the window? | Problems Connecting to Minimized Signal | 1.2 | 0 | 0 | 129 |
4,081,217 | 2010-11-02T19:04:00.000 | 4 | 0 | 1 | 0 | python | 4,081,239 | 9 | false | 0 | 0 | No you wouldn't alter the "content" of the list, if you could mutate strings that way. But in Python they are not mutable. Any string operation returns a new string.
If you had a list of objects you knew were mutable, you could do this as long as you don't change the actual contents of the list.
Thus you will need to do a map of some sort. If you use a generator expression it [the operation] will be done as you iterate and you will save memory. | 1 | 228 | 0 | Now I know that it is not safe to modify the list during an iterative looping. However, suppose I have a list of strings, and I want to strip the strings themselves. Does replacement of mutable values count as modification? | How to modify list entries during for loop? | 0.088656 | 0 | 0 | 346,667 |
4,081,333 | 2010-11-02T19:22:00.000 | 1 | 0 | 0 | 0 | python,security,mobile | 4,084,073 | 1 | true | 1 | 0 | As far as I know, there is no way to get Python code running on that kind of mobile platform.
Try looking up JavaME and/or Brew. Further, you will need the carrier and device maker to allow your app the get access to the phone's GPS information. This is not a given on the low-end devices.
As a first step, most carriers have a free developer relation program. Sign up there and you will have access to many forums with experts in the field.
Good luck. :) | 1 | 0 | 0 | I would like to build a mobile phone tracking application for feature phones which have minimum of gprs connectivity. I would like a user to log in to the application and be able to see the location of their phone through google maps. Any resources or information will be highly appreciated. I would preferably use python. | feature mobile phone tracking application | 1.2 | 0 | 0 | 1,349 |
4,081,561 | 2010-11-02T19:52:00.000 | 96 | 0 | 1 | 0 | python | 4,081,587 | 7 | true | 0 | 0 | When reading, list is a reference to the original list, and list[:] shallow-copies the list.
When assigning, list (re)binds the name and list[:] slice-assigns, replacing what was previously in the list.
Also, don't use list as a name since it shadows the built-in. | 1 | 69 | 0 | What, if any, is the difference between list and list[:] in python? | What is the difference between list and list[:] in python? | 1.2 | 0 | 0 | 31,643 |
4,081,672 | 2010-11-02T20:07:00.000 | 2 | 0 | 1 | 0 | python,list,position | 4,081,702 | 7 | false | 0 | 0 | you can use ['hello', 'world'].index('world') | 1 | 15 | 0 | I will check if a word exists in a list.
How can I show the position of this word? | Position in an list? | 0.057081 | 0 | 0 | 71,203 |
4,082,725 | 2010-11-02T22:37:00.000 | 1 | 0 | 1 | 0 | python,reportlab,pypdf | 4,082,827 | 2 | false | 0 | 0 | Basically you'll have to remove the corresponding text drawing commands in the PDF's page content stream. It's much easier to generate the pages twice, once with the confidential information, once without them.
It might be possible (I don't know ReportLab enough) to specially craft the PDF in a way that the confidential information is easier accessible (e.g. as separate XObjects) for deletion. Still you'd have to do pretty low-level operations on the PDF -- which I would advise against. | 2 | 1 | 0 | In Python, I have files generated by ReportLab. Now, i need to extract some pages from that PDF and hide confidential information.
I can create a PDF file with blacked-out spots and use pyPdf to mergePage, but people can still select and copy-paste the information under the blacked-out spots.
Is there a way to make those spots completely confidential?
Per example, I need to hide addresses on the pages, how would i do it?
Thanks, | Hide information in a PDF file in Python | 0.099668 | 0 | 0 | 1,789 |
4,082,725 | 2010-11-02T22:37:00.000 | 0 | 0 | 1 | 0 | python,reportlab,pypdf | 4,083,017 | 2 | false | 0 | 0 | (Sorry, I was not able to log on when I posted the question...)
Unfortunately, the document cannot be regenerated at will (context sensitive), and those PDF files (about 35) are 3000+ pages.
I was thinking about using pdf2ps and pdf2ps back, but there is a lot of quality.
pdf2ps -dLanguageLevel=3 input.pdf - | ps2pdf14 - output.pdf
And if i use "pdftops" instead, the text is still selectable. If there is a way to make it non-selectable like with "pdf2ps" but with better quality, it will do too. | 2 | 1 | 0 | In Python, I have files generated by ReportLab. Now, i need to extract some pages from that PDF and hide confidential information.
I can create a PDF file with blacked-out spots and use pyPdf to mergePage, but people can still select and copy-paste the information under the blacked-out spots.
Is there a way to make those spots completely confidential?
Per example, I need to hide addresses on the pages, how would i do it?
Thanks, | Hide information in a PDF file in Python | 0 | 0 | 0 | 1,789 |
4,083,440 | 2010-11-03T01:07:00.000 | 0 | 0 | 0 | 0 | python,web-applications,flask | 4,083,522 | 2 | false | 1 | 0 | IMHO your time would be better invested learning something like Django, because much of what you could improve in a micro framework is already builtin on a bigger framework. | 1 | 0 | 0 | I'd like to look at some good web-app code written in python, just so I can learn some of the patterns / see how I can improve my code.
I've already googled around a bit, used google code search and run a search on github too - but haven't come across a well built, comprehensive app.
Perhaps a book could work as well. Basically, I'm just trying to find a way to learn the basic programming patterns for web-applications.
Any suggestions? | Great flask / other python micro framework code I could learn from | 0 | 0 | 0 | 1,700 |
4,083,523 | 2010-11-03T01:25:00.000 | 1 | 1 | 0 | 1 | python,profiling,benchmarking,latency,apachebench | 4,083,570 | 6 | true | 0 | 0 | I have done this in two ways.
With "loadrunner" which is a wonderful but pretty expensive product (from I think HP these days).
With combination perl/php and the Curl package. I found the CURL api slightly easier to use from php. Its pretty easy to roll your own GET and PUT requests. I would also recommend manually running through some sample requests with Firefox and the LiveHttpHeaders add on to captute the exact format of the http requests you need. | 2 | 8 | 0 | I've done some experiments using Apache Bench to profile my code response times, and it doesn't quite generate the right kind of data for me. I hope the good people here have ideas.
Specifically, I need a tool that
Does HTTP requests over the network (it doesn't need to do anything very fancy)
Records response times as accurately as possible (at least to a few milliseconds)
Writes the response time data to a file without further processing (or provides it to my code, if a library)
I know about ab -e, which prints data to a file. The problem is that this prints only the quantile data, which is useful, but not what I need. The ab -g option would work, except that it doesn't print sub-second data, meaning I don't have the resolution I need.
I wrote a few lines of Python to do it, but the httplib is horribly inefficient and so the results were useless. In general, I need better precision than pure Python is likely to provide. If anyone has suggestions for a library usable from Python, I'm all ears.
I need something that is high performance, repeatable, and reliable.
I know that half my responses are going to be along the lines of "internet latency makes that kind of detailed measurements meaningless." In my particular use case, this is not true. I need high resolution timing details. Something that actually used my HPET hardware would be awesome.
Throwing a bounty on here because of the low number of answers and views. | Alternatives to ApacheBench for profiling my code speed | 1.2 | 0 | 0 | 6,473 |
4,083,523 | 2010-11-03T01:25:00.000 | 0 | 1 | 0 | 1 | python,profiling,benchmarking,latency,apachebench | 4,162,131 | 6 | false | 0 | 0 | I've used a script to drive 10 boxes on the same switch to generate load by "replaying" requests to 1 server. I had my web app logging response time (server only) to the granularity I needed, but I didn't care about the response time to the client. I'm not sure you care to include the trip to and from the client in your calculations, but if you did it shouldn't be to difficult to code up. I then processed my log with a script which extracted the times per url and did scatter plot graphs, and trend graphs based on load.
This satisfied my requirements which were:
Real world distribution of calls to different urls.
Trending performance based on load.
Not influencing the web app by running other intensive ops on the same box.
I did controller as a shell script that foreach server started a process in the background to loop over all the urls in a file calling curl on each one. I wrote the log processor in Perl since I was doing more Perl at that time. | 2 | 8 | 0 | I've done some experiments using Apache Bench to profile my code response times, and it doesn't quite generate the right kind of data for me. I hope the good people here have ideas.
Specifically, I need a tool that
Does HTTP requests over the network (it doesn't need to do anything very fancy)
Records response times as accurately as possible (at least to a few milliseconds)
Writes the response time data to a file without further processing (or provides it to my code, if a library)
I know about ab -e, which prints data to a file. The problem is that this prints only the quantile data, which is useful, but not what I need. The ab -g option would work, except that it doesn't print sub-second data, meaning I don't have the resolution I need.
I wrote a few lines of Python to do it, but the httplib is horribly inefficient and so the results were useless. In general, I need better precision than pure Python is likely to provide. If anyone has suggestions for a library usable from Python, I'm all ears.
I need something that is high performance, repeatable, and reliable.
I know that half my responses are going to be along the lines of "internet latency makes that kind of detailed measurements meaningless." In my particular use case, this is not true. I need high resolution timing details. Something that actually used my HPET hardware would be awesome.
Throwing a bounty on here because of the low number of answers and views. | Alternatives to ApacheBench for profiling my code speed | 0 | 0 | 0 | 6,473 |
4,083,554 | 2010-11-03T01:32:00.000 | 1 | 0 | 1 | 0 | java,python,ruby,system,enterprise | 4,083,588 | 3 | false | 1 | 0 | You make a valid point in saying that Java is more suited to enterprise software. That's really where Java shines: it works very well for enterprise programming.
However, your gripes about the tools in Python and Ruby are unfounded. PyDev for Eclipse takes full advantage of the same features that you would enjoy if you were developing in Java. Ruby has a similar plugin for Eclipse. Unit testing frameworks like pyunit, nose, and others exist for both languages (and I believe PyDev has support for unit tests). Also, just like a Java compiler would catch an error at compile time, a Python script will give syntax errors before you run it, along with an (IMO) much more understandable error system than a Java compiler.
Since Python and Ruby are scripting languages, their area of expertise lies more in small tasks, rapid development, and using frameworks like Django or Rails. So yes, more heavy-duty languages like Java are great for enterprise, but there's something to be said for the elegance and ease of use of Python and Ruby. | 3 | 1 | 0 | There is some hype with languages like Python (that I like very much) and Ruby but I was writing a medium-size system in Python and feel the lack of some tools that I would have if I was using Java: Eclipse features, JUnit integration and some language-features like catching some errors in compile time.
Some people says that Java is dead as a language. But large important software are written in Java: Hadoop, Lucene and many others.
Is Java a better language than Python or Ruby for medium/large infrastructure software like these? | Issues when writing a medium/large system | 0.066568 | 0 | 0 | 178 |
4,083,554 | 2010-11-03T01:32:00.000 | 0 | 0 | 1 | 0 | java,python,ruby,system,enterprise | 4,083,633 | 3 | false | 1 | 0 | All much of a muchness really. There are features in Python/Ruby that your aware of that make them a more appealing offering than say Java. Static typing can be your best friend most of the time, and a pain for the other.
Lack of tooling is related to adoption. Java/c# has a larger adoption.
Corporates/Enterprises and medium to large organizations, like to procure solutions with contracts as opposed to technical merits.
From experience Python does have some speed issues, I can't comment on Ruby, but I imagine that if your applications require dedicated speed I would not use python.
Also threading and multi-core processing is not as good as it could be in python, although 2.7 seems to improve a lot of the old problems, I think the GIL problem still remains for threading.
My only comment on Java is that it now has Oracle behind it, and depending where your sitting and how you like Oracle, might change your attitude to Java. especially if your designing for Open Source solutions. | 3 | 1 | 0 | There is some hype with languages like Python (that I like very much) and Ruby but I was writing a medium-size system in Python and feel the lack of some tools that I would have if I was using Java: Eclipse features, JUnit integration and some language-features like catching some errors in compile time.
Some people says that Java is dead as a language. But large important software are written in Java: Hadoop, Lucene and many others.
Is Java a better language than Python or Ruby for medium/large infrastructure software like these? | Issues when writing a medium/large system | 0 | 0 | 0 | 178 |
4,083,554 | 2010-11-03T01:32:00.000 | 1 | 0 | 1 | 0 | java,python,ruby,system,enterprise | 4,083,662 | 3 | false | 1 | 0 | This kind of question can get very argumentative... For enterprise software most of time the key factor is political, not technical.
If you own the business, stick with the technology that best fits your vision. If not, use Java - it is politically safer.
On the technical field, it is almost a tie. | 3 | 1 | 0 | There is some hype with languages like Python (that I like very much) and Ruby but I was writing a medium-size system in Python and feel the lack of some tools that I would have if I was using Java: Eclipse features, JUnit integration and some language-features like catching some errors in compile time.
Some people says that Java is dead as a language. But large important software are written in Java: Hadoop, Lucene and many others.
Is Java a better language than Python or Ruby for medium/large infrastructure software like these? | Issues when writing a medium/large system | 0.066568 | 0 | 0 | 178 |
4,084,608 | 2010-11-03T06:12:00.000 | 6 | 0 | 0 | 0 | python,email,rfc822,email-parsing | 4,084,648 | 2 | true | 0 | 0 | Oh it's email.utils.getaddresses. Just make sure to call it with a list. | 1 | 7 | 0 | I need something like rfc822.AddressList to parse, say, the content of the "TO" header field of an email into individual addresses. Since rfc822 is deprecated in favor of the email package, I looked for something similar there but couldn't find anything. Does anyone know what I'm supposed to use instead?
Thanks! | Is there a non-deprecated equivalent of rfc822.AddressList? | 1.2 | 0 | 1 | 1,862 |
4,085,417 | 2010-11-03T08:58:00.000 | 2 | 0 | 1 | 0 | python,list,stack | 4,085,432 | 2 | false | 0 | 0 | stack[-1] ist the last element
EDIT renamed the previously list called variable (Thanks, Tim McNamara). | 1 | 8 | 0 | In python I need a stack, and I'm using a list for it. In the documenation it says that you can use append() and pop() for stack operations but what about accessing the top of the stack without removing it?
How to do that in the most readable way? Because all I came up with is stack[-1:][0] which looks a bit ugly for me, there must be a better way. | How to check the last element of a python list? | 0.197375 | 0 | 0 | 5,959 |
4,085,826 | 2010-11-03T09:55:00.000 | 3 | 0 | 0 | 0 | python,django | 4,085,840 | 1 | true | 1 | 0 | Yes. You're having other problems. | 1 | 0 | 0 | Just curious to know, Test module won't work properly with django 1.2.3 when update from django 1.1.1 (now on python 2.6.5) | Is Django 1.2.3 competable with Python 2.6.5 | 1.2 | 0 | 0 | 102 |
4,086,311 | 2010-11-03T10:55:00.000 | 0 | 0 | 1 | 1 | python,concurrency,process,queue | 4,086,600 | 3 | false | 0 | 0 | If I understand correctly what you are doing, I might suggest a slightly different approach. Try establishing a single unit of work as a function and then layer on the parallel processing after that. For example:
Wrap the current functionality (calling subprocess and capturing output) into a single function. Have the function create a result object that can be returned; alternatively, the function could write out to files as you see fit.
Create an iterable (list, etc.) that contains an input for each chunk of data for step 1.
Create a multiprocessing Pool and then capitalize on its map() functionality to execute your function from step 1 for each of the items in step 2. See the python multiprocessing docs for details.
You could also use a worker/Queue model. The key, I think, is to encapsulate the current subprocess/output capture stuff into a function that does the work for a single chunk of data (whatever that is). Layering on the parallel processing piece is then quite straightforward using any of several techniques, only a couple of which were described here. | 1 | 2 | 0 | The use case is as follows :
I have a script that runs a series of
non-python executables to reduce (pulsar) data. I right now use
subprocess.Popen(..., shell=True) and then the communicate function of subprocess to
capture the standard out and standard error from the non-python executables and the captured output I log using the python logging module.
The problem is: just one core of the possible 8 get used now most of the time.
I want to spawn out multiple processes each doing a part of the data set in parallel and I want to keep track of progres. It is a script / program to analyze data from a low frequencey radio telescope (LOFAR). The easier to install / manage and test the better.
I was about to build code to manage all this but im sure it must already exist in some easy library form. | python queue concurrency process management | 0 | 0 | 0 | 727 |
4,086,675 | 2010-11-03T11:44:00.000 | 3 | 0 | 0 | 1 | python,portability,pygame | 4,086,715 | 4 | false | 0 | 0 | The Python scripts are reasonably portable, as long as the interpreter and relevant libraries are installed. Generated .exe and .app files are not. | 3 | 1 | 0 | I have a lovely Macbook now, and I'm enjoying coding on the move. I'm also enjoying coding in Python. However, I'd like to distribute the end result to friends using Windows, as an executable.
I know that Py2Exe does this, but I don't know how portable Python is across operating systems. Can anyone offer any advice? I'm using PyGame too.
Many thanks | Portable Python (Mac -> Windows) | 0.148885 | 0 | 0 | 1,743 |
4,086,675 | 2010-11-03T11:44:00.000 | 0 | 0 | 0 | 1 | python,portability,pygame | 4,087,087 | 4 | false | 0 | 0 | If you are planning to include Linux in your portability criteria, it's worth remembering that many distributions still package 2.6 (or even 2.5), and will probably be a version behind in the 3.x series as well (I'm assuming your using 2.x given the PyGame requirement though).
Versions of PyGame seem to vary quite heavily between distros as well. | 3 | 1 | 0 | I have a lovely Macbook now, and I'm enjoying coding on the move. I'm also enjoying coding in Python. However, I'd like to distribute the end result to friends using Windows, as an executable.
I know that Py2Exe does this, but I don't know how portable Python is across operating systems. Can anyone offer any advice? I'm using PyGame too.
Many thanks | Portable Python (Mac -> Windows) | 0 | 0 | 0 | 1,743 |
4,086,675 | 2010-11-03T11:44:00.000 | 0 | 0 | 0 | 1 | python,portability,pygame | 4,153,679 | 4 | true | 0 | 0 | Personally I experienced huge difficult with all the Exe builder, py2exe , cx_freeze etc. Bugs and errors all the time , keep displaying an issue with atexit module.
I find just by including the python distro way more convinient. There is one more advantage beside ease of use.
Each time you build an EXE for a python app, what you essential do is include the core of the python installation but only with the modules your app is using. But even in that case your app may increase from a mere few Kbs that the a python module is to more than 15 mbs because of the inclusion of python installation.
Of course installing the whole python will take more space but each time you send your python apps they will be only few kbs long. Plus you want have to go to the hussle of bundling the exe each time you change even a coma to your python app. Or I think you do , I dont know if just replacing the py module can help you avoid this.
In any case installing python and pygame is as easy as installing any other application in windows. In linux via synaptic is also extremly easy.
MACOS is abit tricky though. MACOS already come with python pre installed, Snow leopard has 2.6.1 python installed. However if you app is using a python later than that and include the install of python with your app, you will have to instruct the user to set via "GET INFO -> open with" the python launcher app which is responsible for launcing python apps to use your version of python and not the onboard default 2.6.1 version, Its not difficult and it only takes a few seconds, even a clueless user can do this.
Python is extremely portable, python pygame apps cannot only run unchanged to the three major platform , Windows , MACOS ,Linux . They can even run on mobile and portable devices as well. If you need to build app that runs across platform , python is dead easy and highly recomended. | 3 | 1 | 0 | I have a lovely Macbook now, and I'm enjoying coding on the move. I'm also enjoying coding in Python. However, I'd like to distribute the end result to friends using Windows, as an executable.
I know that Py2Exe does this, but I don't know how portable Python is across operating systems. Can anyone offer any advice? I'm using PyGame too.
Many thanks | Portable Python (Mac -> Windows) | 1.2 | 0 | 0 | 1,743 |
4,087,582 | 2010-11-03T13:38:00.000 | 0 | 1 | 0 | 1 | python,debugging,pylons,pydev,nose | 4,087,763 | 3 | false | 0 | 0 | Try import pydevd; pydevd.settrace() where would like a breakpoint. | 1 | 8 | 0 | I'm using PyDev ( with Aptana ) to write and debug a Python Pylons app, and I'd like to step through the tests in the debugger.
Is it possible to launch nosetests through PyDev and stop at breakpoints? | Interactive debugging with nosetests in PyDev | 0 | 0 | 0 | 4,516 |
4,088,703 | 2010-11-03T15:28:00.000 | 0 | 0 | 0 | 0 | python,firefox,selenium,download,firefox-addon | 13,342,386 | 4 | false | 0 | 0 | In this case, Just create a new folder everytime and download your file there.
Make sure the foldername is incremented if it already exits (Ex: folder1, folder2, Folder3.....) | 3 | 3 | 0 | first of all, I'm sorry for my English
I am doing some scripting in Python using Selenium RC.
The aim is to access to some website, and download some files
I would like to know, at the end of the script, what files exactly have been downloaded
At that moment, I'm doing something a bit naive, which is checking the new files who appears in the download directory of Firefox, it's working well but if I launch severals clients in the same times, they can't detect which files they own etc...
So i was trying to find a solution to that problem, if it's possible to handle the download from Firefox to know exactly when a download occur, and what is downloaded, then I would be super fine, but so far, I haven't find anything about that
Thanks for your help | Is it possible to know what file is downloaded by Firefox with Selenium | 0 | 0 | 1 | 1,024 |
4,088,703 | 2010-11-03T15:28:00.000 | 0 | 0 | 0 | 0 | python,firefox,selenium,download,firefox-addon | 4,698,653 | 4 | false | 0 | 0 | I haven't tried it myself, but I would consider setting up multiple Firefox profiles each set with a different download directory and then telling my instances to use those profiles (or maybe programmatically setting profile values if you're using Selenium2 - I'm not sure if download directory is possible to change or not). Then you can keep monitoring each directory and seeing what was downloaded for each session. | 3 | 3 | 0 | first of all, I'm sorry for my English
I am doing some scripting in Python using Selenium RC.
The aim is to access to some website, and download some files
I would like to know, at the end of the script, what files exactly have been downloaded
At that moment, I'm doing something a bit naive, which is checking the new files who appears in the download directory of Firefox, it's working well but if I launch severals clients in the same times, they can't detect which files they own etc...
So i was trying to find a solution to that problem, if it's possible to handle the download from Firefox to know exactly when a download occur, and what is downloaded, then I would be super fine, but so far, I haven't find anything about that
Thanks for your help | Is it possible to know what file is downloaded by Firefox with Selenium | 0 | 0 | 1 | 1,024 |
4,088,703 | 2010-11-03T15:28:00.000 | 0 | 0 | 0 | 0 | python,firefox,selenium,download,firefox-addon | 4,118,400 | 4 | false | 0 | 0 | If you are working with python-->Selenium RC why don't you just
create a lastdownload.txt type of file, and put in the dates, filenames
of the files you download.
So each time your script runs, it will check the fileserver, and your log file
to see which files are new, which files you already have. (if same filename is used
you can check the lastupdatetime of headers, or even the filesize as a way to compare)
Then you just download the new files... so this way you replicate a simple incremental mechanism with lookup on a txt file... | 3 | 3 | 0 | first of all, I'm sorry for my English
I am doing some scripting in Python using Selenium RC.
The aim is to access to some website, and download some files
I would like to know, at the end of the script, what files exactly have been downloaded
At that moment, I'm doing something a bit naive, which is checking the new files who appears in the download directory of Firefox, it's working well but if I launch severals clients in the same times, they can't detect which files they own etc...
So i was trying to find a solution to that problem, if it's possible to handle the download from Firefox to know exactly when a download occur, and what is downloaded, then I would be super fine, but so far, I haven't find anything about that
Thanks for your help | Is it possible to know what file is downloaded by Firefox with Selenium | 0 | 0 | 1 | 1,024 |
4,088,996 | 2010-11-03T16:01:00.000 | 1 | 0 | 0 | 0 | python,user-interface,tkinter,pywin32,win32ole | 4,091,168 | 1 | true | 0 | 1 | No, Tkinter has no such thing. However, the screen is only updated via the event loop, so if all of your "large amount of screen activity" is happening in a single method, none of the activity will show up until your method finishes and the event loop is re-entered (or you explicitly call .update_idletasks()) | 1 | 1 | 0 | Does Tkinter provide a way to temporarily turn off screen updates (when performing a large amount of screen activity) and then turn on screen updates when the UI updates are complete? Many GUI frameworks have this feature. wxPython provides Freeze and Thaw methods for this functionality. The Windows Win32api supports this as well via LockWindowUpdate( hWnd | 0 ). Googling on "tkinter freeze thaw" and "tkinter lockwindowupdate" came up emtpy. | Python/Tkinter: Turn on/off screen updates like wxPython Freeze/Thaw? | 1.2 | 0 | 0 | 968 |
4,090,753 | 2010-11-03T19:15:00.000 | 0 | 0 | 0 | 1 | python,macos,installation,osx-snow-leopard | 4,161,287 | 2 | true | 0 | 0 | The solution was to --force pythonbrew to install in spite of the errors.
I tested the socket responses using the built-in Python, Perl and Ruby, and they had the same problem resolving the localhost name. I tested using a current version of Ruby and Python on one of my Linux boxes, and the calls worked, so I was pretty sure it was something outside of that particular Mac's configuration.
After forcing the install I tested the socket calls to other hosts and got the expected results and haven't had any problems doing other networking tasks so I think everything is fine. | 1 | 0 | 0 | I'm using pythonbrew to install Python 2.6.6 on Snow Leopard. It failed with a readline error, then a socket error. I installed readline from source, which made the installer happy on the next attempt, but the socket error remains:
test_socket
test test_socket failed -- Traceback (most recent call last):
File "/Users/gferguson/python/pythonbrew/build/Python-2.6.6/Lib/test/test_socket.py", line 483, in testSockName
my_ip_addr = socket.gethostbyname(socket.gethostname())
gaierror: [Errno 8] nodename nor servname provided, or not known
Digging around with the system Python shows:
>>> import socket
>>> my_ip_addr = socket.gethostbyname(socket.gethostname())
Traceback (most recent call last):
File "", line 1, in
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
>>> socket.gethostname()
'S1WSMA-JHAMI'
>>> socket.gethostbyname('S1WSMA-JHAMI')
Traceback (most recent call last):
File "", line 1, in
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
>>> socket.gethostbyname('google.com')
'74.125.227.20'
I triangulated the problem with Ruby's IRB:
IPSocket.getaddress(Socket.gethostname)
SocketError: getaddrinfo: nodename nor servname provided, or not known
So, I'm not sure if this is a bug in the resolver not understanding the hostname, or if there's something weird in the machine's configuration, or if it's something weird in our network's DNS lookup, but whatever it is the installer isn't happy.
I think it's a benign failure in the installer though, so I feel safe to force the test to succeed, but I'm not sure how to tell pythonbrew how to ignore that test value or specifically pass test_socket.
I'm also seeing the following statuses but haven't figured out if they're significant yet:
33 tests skipped:
test_al test_bsddb test_bsddb3 test_cd test_cl test_codecmaps_cn
test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr
test_codecmaps_tw test_curses test_dl test_epoll test_gdbm test_gl
test_imageop test_imgfile test_largefile test_linuxaudiodev
test_normalization test_ossaudiodev test_pep277 test_py3kwarn
test_smtpnet test_socketserver test_startfile test_sunaudiodev
test_timeout test_urllib2net test_urllibnet test_winreg
test_winsound test_zipfile64
1 skip unexpected on darwin:
test_dl
Anyone have experience getting Python 2.6.6 installed with pythonbrew on Snow Leopard?
Update: I just tried the socket.gethostbyname(socket.gethostname()) command from Python installed on my MacBook Pro with Snow Leopard, and it successfully reported my IP back so it appears the problem is in the system config at work. I am going to ask at SO's sibling "Apple" site and see if anyone knows what it might be. | Workaround for Pythonbrew failing because test_socket can't resolve? | 1.2 | 0 | 1 | 2,411 |
4,092,333 | 2010-11-03T22:46:00.000 | 1 | 0 | 0 | 0 | python,wxpython | 4,101,577 | 2 | true | 0 | 1 | You access the rich text control like this: import wx.richtext
Or you pass the wx.TextCtrl the wx.TE_RICH or wx.TE_RICH2 flag. I've heard that the richtext widget isn't available on *nix though. Did you try the wxPython Demo? That's usually the best place to look to find out how to use a widget. | 2 | 0 | 0 | im using wxpython 2.8 ansi with python 2.6 ,and richtext class seems to not exist as an error message prompts that wx module does not contain richtext attribute, i've searched the web but couldn't find a clear answer,therefore i come to you:)
any thoughts?
thanks in advance
Nataly | Is wx.richtext supported in wxpython 2.8? | 1.2 | 0 | 0 | 427 |
4,092,333 | 2010-11-03T22:46:00.000 | 1 | 0 | 0 | 0 | python,wxpython | 4,093,711 | 2 | false | 0 | 1 | I just downloaded and installed version 2.8.11-ansi. RichTextControl is the first demo listed, and works fine.
It sounds like there is something messed up with your installation.
Unless you have to support windows 98/ME, I don't know any good reason to prefer the ansi version over unicode.
Can you provide the exact text of the error message, and a listing of your site-packages, and the contents of wx.pth | 2 | 0 | 0 | im using wxpython 2.8 ansi with python 2.6 ,and richtext class seems to not exist as an error message prompts that wx module does not contain richtext attribute, i've searched the web but couldn't find a clear answer,therefore i come to you:)
any thoughts?
thanks in advance
Nataly | Is wx.richtext supported in wxpython 2.8? | 0.099668 | 0 | 0 | 427 |
4,093,015 | 2010-11-04T00:50:00.000 | 0 | 0 | 1 | 1 | python,osx-snow-leopard | 4,093,046 | 2 | false | 0 | 0 | It's impossible to tell without knowing which version(s) you're comparing. You're best off doing python --version on your default OS X install, and then checking release notes from that version to subsequent versions. My guess (I don't have OS X) is that you're likely running 2.4.x or 2.5.x. There'll be very few regressive differences from 2.4.x forward on the 2.x version tree. Python 3.x introduces syntax changes, which will break some existing code. Perhaps the most visible change is print becomes a function in 3.0, while still a statement in 2.x.
In general, amongst 2.x, syntax is only enhanced, not broken. The changes are going to be more in the libraries (i.e. the md5 module is deprecated at 2.6 in favor of the hashlib module). | 2 | 0 | 0 | I am a new Mac (Snow Leopard) user and I found that Python is pre-installed in Mac OS X. What is the difference between Mac OS X pre-installed Python and the one from Python.org?
If I install the one from Python.org, will it break anything? Will it be redundant?
EDIT
What would be a good reason to prefer the Python.org version, comparing identical version numbers head-to-head? | What is the difference between Mac OS X pre-installed Python and the one from Python.org? | 0 | 0 | 0 | 2,569 |
4,093,015 | 2010-11-04T00:50:00.000 | 3 | 0 | 1 | 1 | python,osx-snow-leopard | 4,094,163 | 2 | false | 0 | 0 | The Apple-supplied Python 2.6 in Mac OS X 10.6 (Snow Leopard) is currently 2.6.1 (and, based on previous OS X releases, it is unlikely Apple will update it to a newer version in a 10.6.x maintenance release). The most recent (and likely final) release of Python 2.6 is 2.6.6. So if you install the most recent python.org release, you will get the benefit of a large number of bug fixes that have been made over the lifetime of Python 2.6. There are some other differences. The python.org 2.6.x versions are built as 32-bit-only. The Apple-suppled version is built as a 32-bit/64-bit universal and will, by default, prefer to run in 64-bit mode when possible. Either one can lead to some issues when installing third-party packages with C extension modules that depend on other 3rd-party libraries. There needs to be at least one common architecture (be it 32-bit, i386, or 64-bit, x86_64) among all the components. Another difference is that the Apple-suppled 2.6 is linked with a new version of Tk 8.5; there are reported problems with the IDLE that comes with 10.6 and possibly with other applications using Tkinter. If you plan to use either, you may be better off with the python.org 2.6 which is linked with Tk 8.4.
On OS X, it is particularly easy and common to install multiple Python versions even of the same major version. If you do install the python.org version, by default the installer will modify your shell search PATH so that the python.org version is found first. It will also be available via the absolute path /usr/local/bin/python2.6. The Apple-suppled version will remain available as /usr/bin/python2.6.
FYI: Be aware that Python 2.7 has already been released and there are OS X installers for it available from python.org. A new, not upwards-compatible version of Python, Python 3, is also available (currently 3.1.2 with 3.2 coming in a few months) and is expected to gradually replace Python 2 in popularity as new features are only being added to Python 3. | 2 | 0 | 0 | I am a new Mac (Snow Leopard) user and I found that Python is pre-installed in Mac OS X. What is the difference between Mac OS X pre-installed Python and the one from Python.org?
If I install the one from Python.org, will it break anything? Will it be redundant?
EDIT
What would be a good reason to prefer the Python.org version, comparing identical version numbers head-to-head? | What is the difference between Mac OS X pre-installed Python and the one from Python.org? | 0.291313 | 0 | 0 | 2,569 |
4,093,387 | 2010-11-04T02:22:00.000 | 0 | 0 | 0 | 0 | python | 4,093,406 | 2 | false | 1 | 0 | I'll admit I don't know Python 3, so I may be wrong, but in Python 2, you can just check the __file__ variable in your module to get the name of the file it was loaded from. Just create your file in that same directory (preferably using os.path.dirname and os.path.join to remain platform-independent). | 1 | 0 | 0 | I have a rather simple program that writes HTML code ready for use.
It works fine, except that if one were to run the program from the Python command line, as is the default, the HTML file that is created is created where python.exe is, not where the program I wrote is. And that's a problem.
Do you know a way of getting the .write() function to write a file to a specific location on the disc (e.g. C:\Users\User\Desktop)?
Extra cool-points if you know how to open a file browser window. | Python3:Save File to Specified Location | 0 | 0 | 0 | 2,983 |
4,093,447 | 2010-11-04T02:37:00.000 | 2 | 0 | 0 | 0 | python,module,installation | 4,093,865 | 2 | false | 0 | 0 | 32-bit and 64-bit binaries are different animals, and can be mixed only if you know what you are doing.
Did you try installing python 2.6 32-bit on your friend's machine?
Why are you using apsw instead of the standard library sqlite3? | 1 | 0 | 0 | First off, I don't know if this goes on stackoverflow or one of the other related sites.
So, I have apsw on my system, and am using python 2.6 32 bit. My friend is using Python 64 bit, and when I tried to install apsw on his system, we got a multitude of errors, depending on how we installed it. First off, installing via exe gave us a "This application is not a valid win32 program" When we manually installed it from my system, we got a "ImportError: DLL load failed: %1 is not a valid Win32 application." And we have some complications with building the module too with sqlite3.dll and sqlite3.lib. | Odd error when helping a friend install apsw | 0.197375 | 0 | 0 | 1,014 |
4,093,541 | 2010-11-04T03:00:00.000 | 0 | 0 | 0 | 0 | python,django,http-status-code-404,runtime-error | 4,096,820 | 2 | false | 1 | 0 | try not loading all middleware modules, just comment them all in the settings and see if the problem is somewhere there. | 1 | 0 | 0 | In my Django project I am having RUntimeError when I'm supposed to get a 404. The description says:
Exception Value: maximum recursion depth exceeded
The error only occurs when I try to access a non-existent page (the correct result would be a 404 page isn't it?). Is this a Django bug or is it my fault? I will provide more information if needed.
EDIT: I have tried syncing the database (actually drop the database and sync it from scratch), restarting the server and even commenting out all the urlpatterns in all urls.py files.
EDIT: This is what the traceback looks like:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response
83. request.path_info)
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in resolve
218. sub_match = pattern.resolve(new_path)
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in resolve
218. sub_match = pattern.resolve(new_path)
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in resolve
218. sub_match = pattern.resolve(new_path)
And the last few lines are:
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in resolve
218. sub_match = pattern.resolve(new_path)
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in resolve
216. for pattern in self.url_patterns:
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in _get_url_patterns
245. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) | Django is returning RuntimeError instead of 404 | 0 | 0 | 0 | 425 |
4,093,819 | 2010-11-04T04:07:00.000 | 2 | 0 | 0 | 0 | wxpython,wxwidgets,openfiledialog,savefiledialog,filedialog | 5,943,314 | 4 | false | 0 | 1 | In wxWidgets 2.9 custom controls can be added to file dialogs using wxFileDialog::SetExtraControlCreator(). It's implemented for GTK, MSW and generic dialogs.
Alternatively, you may use the wxFileCtrl class. It has native implementation only in wxGTK.
I don't know if these features is available from Python wrappers, though. | 2 | 2 | 0 | I'm creating a file dialog that allows the user to save a file after editing it in my app. I want to add a checkbox to the dialog so the user can make some choices about what format the file is saved in. I think I need to make some new class that inherits from FileDialog and inserts a checkbox into the frame created by the filedialog, but I don't really know how to do that. Can anyone help me out?
(I also want to create an analogous file dialog for opening a file, but I assume that will just mean replacing the SAVE style with the OPEN style.) | How do I add widgets to a file dialog in wxpython? | 0.099668 | 0 | 0 | 2,300 |
4,093,819 | 2010-11-04T04:07:00.000 | 2 | 0 | 0 | 0 | wxpython,wxwidgets,openfiledialog,savefiledialog,filedialog | 12,428,450 | 4 | false | 0 | 1 | I have to disagree with the sentiment that you should use standard dialogs only how they were designed.
I take another view and would rather look at using subclassing the way that subclassing was intended. And to me, it is to add additional functionality/specialization to a class.
So it is not changing the behavior of the standard dialog. It is creating a new dialog BASED ON the standard dialog with a little additional functionality.
In my case, I want to add two buttons to the wx.MultiChoiceDialog to provide a Select All and/or Unselect All functions. | 2 | 2 | 0 | I'm creating a file dialog that allows the user to save a file after editing it in my app. I want to add a checkbox to the dialog so the user can make some choices about what format the file is saved in. I think I need to make some new class that inherits from FileDialog and inserts a checkbox into the frame created by the filedialog, but I don't really know how to do that. Can anyone help me out?
(I also want to create an analogous file dialog for opening a file, but I assume that will just mean replacing the SAVE style with the OPEN style.) | How do I add widgets to a file dialog in wxpython? | 0.099668 | 0 | 0 | 2,300 |
4,093,982 | 2010-11-04T04:49:00.000 | 3 | 0 | 0 | 0 | python,pyjamas | 4,094,232 | 1 | true | 1 | 0 | GWT and Pyjamas were created to remove the drugery of coding Javascript and compensating for all of the different browser implementations and object models.
Yes, you still need a designer.
Yes, you can code in python and not
have to learn Javascript (in theory).
No, you won't have to recode to work
around "features" of the Javascript
implementations in new browsers or
old browsers. | 1 | 8 | 0 | I am learning Pyjamas framework of python to generate the frontend which is basically a javascript code generated by Pyjamas. Though, being a new concept and a GWT equivalent in python I am interested in learning it, but I can not really find out what is the actual significance of it? I mean we are coding in python, compiling the code and generating javascript, which allows us to put CSS classes with the code. So, basically it does not removes the need of a designer as well.
Also, is it a good idea to use Pyjamas with Django?
Please suggest.
Thanks in advance | Pyjamas framework significance | 1.2 | 0 | 0 | 1,188 |
4,093,999 | 2010-11-04T04:56:00.000 | 6 | 0 | 0 | 0 | python,django,url,host | 4,094,037 | 9 | false | 1 | 0 | Try os.environ.get('HOSTNAME') | 2 | 66 | 0 | How to use Django to get the name for the host server?
I need the name of the hosting server instead of the client name? | How to use Django to get the name for the host server? | 1 | 0 | 0 | 62,436 |
4,093,999 | 2010-11-04T04:56:00.000 | 4 | 0 | 0 | 0 | python,django,url,host | 54,194,805 | 9 | false | 1 | 0 | Basically, You can take with request.get_host() in your view/viewset. It returns <ip:port> | 2 | 66 | 0 | How to use Django to get the name for the host server?
I need the name of the hosting server instead of the client name? | How to use Django to get the name for the host server? | 0.088656 | 0 | 0 | 62,436 |
4,095,925 | 2010-11-04T10:55:00.000 | 1 | 0 | 1 | 0 | python,multithreading,queue | 4,096,149 | 1 | true | 0 | 0 | If a threads waits for a specific task completion, i.e it shouldn't pick any completed task except that one it put, you can use locks to wait for the task:
def run(self):
# get a task, do somethings, put a new task
newTask.waitFor()
...
class Task:
...
def waitFor(self):
self._lock.acquire()
def complete(self):
self._lock.release()
def failedToComplete(self, err):
self._error = err
self._lock.release()
This will help to avoid time.sleep()-s on response queue monitoring. Task completion errors handling should be considered here. But this is uncommon approach. Is it some specific algorithm where the thread which puts a new task, should wait for it? Even so, you can implement that logic into a Task class, and not in the thread that processes it. And why the thread picks a task from the destination queue and puts a new task back to the destination queue? If you have n steps of processing, you can use n queues for it. A group of threads serves the first queue, gets a task, processes it, puts the result (a new task) to the next queue. The group of final response-handler threads gets a response and sends it back to the client. The tasks encapsulate details concerning themselves, the threads don't distinguish a task from another. And there is not need to wait for a particular task. | 1 | 0 | 0 | could anyone please provide on how to achieve below scenario ?
2 queues - destination queue, response queue
thread picks task up from destination queue
finds out needs more details
submits new task to destination queue
waits for his request to be processed and result appear in response queue
or
monitors response queue for response to his task but does not actually pick any response so it is available to the other threads waiting for other responses ?
thank you | python: how to make threads wait for specific response? | 1.2 | 0 | 0 | 1,230 |
4,096,417 | 2010-11-04T12:02:00.000 | 5 | 0 | 0 | 0 | python,wxpython,wxwidgets | 4,101,554 | 2 | false | 0 | 1 | The simple answer is "no". The panel is not a TopLevelWindow. Top level windows are Frames and Windows. Panels typically go in Frames, although you can nest panels in panels or frames. Telling us what to do, as Ryan suggested, would be the best way to get a good answer though. | 1 | 0 | 0 | there are some people?
i have some question about wxpython ,
can i use panel without a frame? | can i use panel without a frame in wxpython? | 0.462117 | 0 | 0 | 588 |
4,096,751 | 2010-11-04T12:44:00.000 | 5 | 1 | 1 | 0 | python | 4,096,865 | 2 | false | 0 | 0 | There are three most popular tools: pylint, pyflakes and pycheker.
Pyflakes will show you unused imports, variables, variable usage before assignment, syntax errors and things like that. Pychecker, AFAIK is similar to pyflakes.
Pylint, on the other hand, is a much more comprehensive tool: apart from the listed above, it also checks for PEP8 compatibility, variable names, docstrings, proper indentation, checks for maximum line and module length, number of local variables and class methods and so on. It gives a more or less complete report with a universal score of your code. However, because of the outstanding amount of errors it shows, without proper configuration it is quite tedious to use. | 1 | 4 | 0 | I wrote a nice little script to do some lightweight work. I set it to run all night, and when I eagerly checked it this morning, I found that I had left a module name prefix out of one of its variables. Is there any way to check for this kind of chicanery statically? The trouble is that this thing sleeps a lot, so running it isn't the best way to find out. | Python syntax and other things checking? | 0.462117 | 0 | 0 | 108 |
4,098,119 | 2010-11-04T15:15:00.000 | 6 | 0 | 0 | 1 | python,google-app-engine | 4,098,417 | 1 | true | 1 | 0 | Somewhere in your top level module code is something that uses Python print statements. Print outputs to standard out, which is what is returned as the response body; if it outputs a pair of newlines, the content before that is treated by the browser as the response header. The 'junk' you're seeing is the real response headers being produced by your webapp.
It's only happening on startup requests, because that's the only time the code in question gets executed. | 1 | 1 | 0 | I'm developing an app in Python for Google App Engine.
When I run the deployed app from appspot, it works fine unless I'm accessing it for the first time in over, say, 5 minutes. The problem is that if I haven't accessed the app for a while, the page renders with the message
Status: 200 OK Content-Type: text/html; charset=utf-8 Cache-Control: no-cache Expires: Fri, 01 Jan 1990 00:00:00 GMT Content-Length: 15493
prepended at the top. Usually that text is displayed for a second or two before the rest of the page is displayed.
If I check the server Logs, I see the info message
This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time.
The problem is easily corrected by refreshing the page. In this case, the page is delivered correctly, and works for subsequent refreshes. But if I wait 5 minutes, the problem comes back.
Any explanations, or suggestions on how to troubleshoot this? I've got a vague notion that when GAE "wakes up" after being inactive, there is an incorrect initialization going on. Or perhaps a header from a previous bout of activity is lingering in a buffer somewhere. But self.response.out seems to be empty when the request handler is invoked. | Google App Engine gives spurious content at beginning of page after quiescent period | 1.2 | 0 | 0 | 108 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.