Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
FoiledAgain
May 6, 2007

Three cheers for tef, this is uber-helpful.

Adbot
ADBOT LOVES YOU

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Oh, yeah you're right. It was late :)

Sylink
Apr 17, 2004

I want to make a log viewer in python that will tail logs from various linux servers, I think I can handle the tailing part easily enough. But I would like to have it in GUI form.

I've seen some software made in PyQT that runs nicely but the QT Designer is totally weird to me. It only generates a template and doesn't let you make the code that actually does things within it, which is super annoying compared to using something more akin to Visual Studio.

Is there anything like the Visual Studio way of doing things in Python? I'm not deadset on Qt or anything.

Drunk Badger
Aug 27, 2012

Trained Drinking Badger
A Faithful Companion

Grimey Drawer
Any recommendations for adding simple graphics to a python program? Don't need anything more complex than drawing a few colored squares on the screen.

Emacs Headroom
Aug 2, 2003

Drunk Badger posted:

Any recommendations for adding simple graphics to a python program? Don't need anything more complex than drawing a few colored squares on the screen.

pygame works pretty well and is easy to pick up. It's got a 2d layer IIRC, which will be a lot faster to get going for you especially if you're not used to Direct3D / OpenGL stuff.

edit: the name makes it sound like it's for games mostly, but I've used it for scientific applications and such before and it's good at basic display also

Drunk Badger
Aug 27, 2012

Trained Drinking Badger
A Faithful Companion

Grimey Drawer

Emacs Headroom posted:

pygame works pretty well and is easy to pick up. It's got a 2d layer IIRC, which will be a lot faster to get going for you especially if you're not used to Direct3D / OpenGL stuff.

edit: the name makes it sound like it's for games mostly, but I've used it for scientific applications and such before and it's good at basic display also

That should work great for what I need, thanks.

Dwayne Bensey
Jan 7, 2010
Can I ask about Python CGI scripts in this thread?

I'm doing an experiment for a university research paper that involves timing how long people take to read a web page I've made. Basically, the timer starts when they load the page and stops when they click the link to the next page, whose URL contains a query string with the time it took the user to read the page. The second page then gets the time from the URL and stores it in a Javascript variable I called "querystr". Because of the nature of the experiment, I can't tell the user that they're going to be timed before they read the page, which means that afterwards I have to offer them the option to either opt out of having their data analysed or agree for it to be used.

Here's where the CGI script comes in: if they allow me to analyse their data, I need their time to then be added to a database on the university web server so that I can easily read it off. I've done the client-side end of things (measuring how long they spend on the page and storing it in a variable) but I'm not really sure how to go about passing that variable on to a database if they don't check the box indicating that they want to opt out. I'm still sort of coming to terms with Python, and I don't know much about server-side applications at all - am I in over my head here? Is the script I want relatively simple, and if so, do I just dump whatever .py file in a folder on the web server and get it to create a HTML page with the data?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Dwayne Bensey posted:

Can I ask about Python CGI scripts in this thread?

You can, but don't expect anybody to help you. CGI is an old protocol, and it's fairly obsolete. Python's startup speed is slow, meaning that the CGI model of "start up a process, translate HTTP into environment variables and command lines, and let the Python script translate all that back into HTTP again" won't be too performant.

Emacs Headroom
Aug 2, 2003
Django would be the overkill choice for you. Flask would probably be the more logical choice. Both will have instructions on their documentation for how to get set up with Apache.

Is the database MySQL or something like that? Are you allowed to make new tables in it? Or do you have an existing table you want to write into?

One final idea: if you don't have a ton of time to play around with learning server-side scripting and databases etc., I bet you could pay someone about 200 bucks to do all this for you. If you've got some research money you can use.

OnceIWasAnOstrich
Jul 22, 2006

Emacs Headroom posted:

Django would be the overkill choice for you. Flask would probably be the more logical choice. Both will have instructions on their documentation for how to get set up with Apache.

Is the database MySQL or something like that? Are you allowed to make new tables in it? Or do you have an existing table you want to write into?

One final idea: if you don't have a ton of time to play around with learning server-side scripting and databases etc., I bet you could pay someone about 200 bucks to do all this for you. If you've got some research money you can use.

Something like Flask or CherryPy is actually pretty hilariously easy to use. Find their quickstart script, write an HTML template. Write two functions, one which returns the template and one that accepts GET request headers wtih the info you need and puts whatever you want in a database. If you know how to use Git you could put all of this on Heroku for free with a PostgreSQL database and write a couple lines of SQLAlchemy to stick your info in there since it seems unlikely that kind of data would generate more than the tiny limit the free database has.

OnceIWasAnOstrich fucked around with this message at 00:56 on Feb 16, 2013

Drunk Badger
Aug 27, 2012

Trained Drinking Badger
A Faithful Companion

Grimey Drawer

Emacs Headroom posted:

pygame works pretty well and is easy to pick up. It's got a 2d layer IIRC, which will be a lot faster to get going for you especially if you're not used to Direct3D / OpenGL stuff.

edit: the name makes it sound like it's for games mostly, but I've used it for scientific applications and such before and it's good at basic display also

Any issues with using the version for Python 3.1 (Or the alpha for 3.2) with Python 3.3?

Dwayne Bensey
Jan 7, 2010
I don't actually have a database set up. I had a look at Flask but couldn't get it to install on Ubuntu for some reason.
Got some help in the form of a small PHP script that accepts a variable and makes a text file with the data that I need in it, so that should do the trick anyway. Thanks for the suggestions though :)

BeefofAges
Jun 5, 2004

Cry 'Havoc!', and let slip the cows of war.

Did anyone see this? It was accepted today. http://www.python.org/dev/peps/pep-0427/

Hed
Mar 31, 2004

Fun Shoe
That seems really nice... hunting for the right package flavor can be really obnoxious as it is. At least this looks like fewer variants would have to be shuttled between the package index and a development network that doesn't have Internet access.

Innocent Bystander
May 8, 2007
Born in the LOLbarn.
tef, that was invaluable. Thank you so much for the effort and the write, very, very helpful.

Modern Pragmatist
Aug 20, 2008
I'm working on refactoring a library that I've been using to read/write binary files. I was curious if there are any guides to the optimal layout for a project. Maybe even a link to a similar type of project that has a logical layout?

I'm thinking something like the following:

code:
|- Project Directory
    |- Main Module
        |- encoding 	=> encoding/decoding unicode items
        |- io 		=> reading/writing files
        |- types 	=> User-defined datatypes
        |- utils 	=> Various utilities
    |- docs
    |- tests

onionradish
Jul 6, 2006

That's spicy.
I'm trying to whip up a script to convert between Unicode and ASCII HTML entities for some website work, but am failing somewhere on the Unicode conversion. The conversion to named entities works fine, but fails when I convert back to accented Unicode, and specifically on the & rsquo ; entity. What am I missing?

Full code at Pastebin

code:
def entity2chr(n):
    """Convert named HTML entity to unicode character (é -> é)"""
    if n in hd.name2codepoint:
	# Debug to figure out which character fails on next line
        print ''.join(['N:', n, ' ', str(hd.name2codepoint[n])])
        return unichr(hd.name2codepoint[n])  # this should return a unicode character, FAILS HERE
    else:
        return "????"  # this isn't an issue; shouldn't happen

onionradish fucked around with this message at 16:39 on Feb 19, 2013

Feral Integral
Jun 6, 2006

YOSPOS

Sylink posted:

I want to make a log viewer in python that will tail logs from various linux servers, I think I can handle the tailing part easily enough. But I would like to have it in GUI form.

I've seen some software made in PyQT that runs nicely but the QT Designer is totally weird to me. It only generates a template and doesn't let you make the code that actually does things within it, which is super annoying compared to using something more akin to Visual Studio.

Is there anything like the Visual Studio way of doing things in Python? I'm not deadset on Qt or anything.

I'd recommend either Glade or wxFormBuilder. Both are pretty similar in functionality, although I would say wxformbuilder is overall a bit more intuitive for someone used to Visual Studio-type GUI building.

Here's a screenshot of a GUI I made for work that utilizes the skype API to automatically add contacts for accounts (since skype is a pain in the rear end and for some reason doesn't include this feature in their business account manager thing, wtf?):



Hopefully the "object tree" structure in that image will give you a head start on how you can layout the GUI. Just remember that the first thing you have to start off with is a frame to place objects in, and you'll need at least one sizer to layout the elements of your GUI. If you check out the tabs at the bottom, you'll see that the builder automatically generates the python code you need, and alls you have to do is then import it like so:



Easy as py! :v:

Feral Integral fucked around with this message at 18:36 on Feb 19, 2013

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


So I'm doing game stuff in python, and I'm trying to figure something out.

If I have a a loop that looks like
Python code:
while d > 0:
    d=f(d-cos(theta))
will python "automatically factor out" that cos(theta), or is that something I need to do? If d converges rapidly, then doing a cos() every loop isn't a problem. But if I'm doing a bunch of math that all remains invariant, will the runtime environment make these loops faster for me, or do I need to do it myself?

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

babyeatingpsychopath posted:

So I'm doing game stuff in python, and I'm trying to figure something out.

If I have a a loop that looks like
Python code:
while d > 0:
    d=f(d-cos(theta))
will python "automatically factor out" that cos(theta), or is that something I need to do? If d converges rapidly, then doing a cos() every loop isn't a problem. But if I'm doing a bunch of math that all remains invariant, will the runtime environment make these loops faster for me, or do I need to do it myself?
doubtful that it would factor it out, and could vary between implementations (maybe pypy would be smart about it? *shrug*) best to be explicit if you are concerned about performance, and you already know what you want to optimize.
Python code:
cosTheta = cos(theta)
while d > 0:
    d=f(d-cosTheta)

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


peepsalot posted:

doubtful that it would factor it out, and could vary between implementations (maybe pypy would be smart about it? *shrug*) best to be explicit if you are concerned about performance, and you already know what you want to optimize.
Python code:
cosTheta = cos(theta)
while d > 0:
    d=f(d-cosTheta)

Yeah, I know I can do it by hand, but I'm really trying to get away from premature optimization. It was more a philosophical question about the python interpreter/bytecode compiler/etc. If it's implementation-dependent, that's cool. If it looks like that specific part is the slow part, I'll optimize it the old-fashioned way.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
It's doubtful to matter that much, but it doesn't cost anything to do it, and also makes it clearer to other people (and static analyzers, etc.) that cosTheta will not change during the loop.

The Insect Court
Nov 22, 2012

by FactsAreUseless

onionradish posted:

I'm trying to whip up a script to convert between Unicode and ASCII HTML entities for some website work, but am failing somewhere on the Unicode conversion. The conversion to named entities works fine, but fails when I convert back to accented Unicode, and specifically on the & rsquo ; entity. What am I missing?

Full code at Pastebin


You're over-thinking this.

code:
def unicode_to_html(s):
    return s.encode('ascii', 'xmlcharrefreplace').decode()

def html_to_unicode(s):
    return html.parser.HTMLParser().unescape(s)

txt = "L’Agence pour l’enseignement français à l’étranger (A.E.F.E) peut apporter aux enfants français résidant à l’étranger une aide à la scolarisation"

assert txt == html_to_unicode(unicode_to_html(txt))


BigRedDot
Mar 6, 2008

babyeatingpsychopath posted:

So I'm doing game stuff in python, and I'm trying to figure something out.

If I have a a loop that looks like
Python code:
while d > 0:
    d=f(d-cos(theta))
will python "automatically factor out" that cos(theta), or is that something I need to do? If d converges rapidly, then doing a cos() every loop isn't a problem. But if I'm doing a bunch of math that all remains invariant, will the runtime environment make these loops faster for me, or do I need to do it myself?

cpython will not hoist out expressions like that:

code:
In [1]: def foo(x):
   ...:     while x > 0:
   ...:         x = f(x - cos(theta))
   ...:         

In [2]: import dis   

In [3]: dis.dis(foo)
  2           0 SETUP_LOOP              38 (to 41)
        >>    3 LOAD_FAST                0 (x)
              6 LOAD_CONST               1 (0)
              9 COMPARE_OP               4 (>)
             12 POP_JUMP_IF_FALSE       40

  3          15 LOAD_GLOBAL              0 (f)
             18 LOAD_FAST                0 (x)
             21 LOAD_GLOBAL              1 (cos)
             24 LOAD_GLOBAL              2 (theta)
             27 CALL_FUNCTION            1
             30 BINARY_SUBTRACT     
             31 CALL_FUNCTION            1
             34 STORE_FAST               0 (x)
             37 JUMP_ABSOLUTE            3
        >>   40 POP_BLOCK           
        >>   41 LOAD_CONST               0 (None)
             44 RETURN_VALUE        

It wouldn't even if you used a numeric literal like cos(37) instead of cos(theta). There's no way here to know the function is free of side effects or will return the same output from repeated identical inputs.

To eke performance out of pure python, without resorting to cython, Numba, PyPy, SWIG, or hand-rolled extension modules, people will sometimes even hoist dotted namespace lookups out of loop. (i.e foo = bar.foo) But you might have an argument about diminishing returns and proper tool choices at that point.

BigRedDot fucked around with this message at 06:22 on Feb 20, 2013

Opinion Haver
Apr 9, 2007

BigRedDot posted:


It wouldn't even if you used a numeric literal like cos(37) instead of cos(theta). There's no way here to know the function is free of side effects or will return the same output from repeated identical inputs.

Even if it knew that the builtin cos is side-effect free and always returns the same value, it'd also have to 'prove' that the cos in scope there is always the 'right' cos, which can get very messy.

onionradish
Jul 6, 2006

That's spicy.
UTF/HTML stuff...

The Insect Court posted:

You're over-thinking this.
Thanks. This also revealed that me printing to Windows PowerShell was the cause of the UTF errors, not Python. :arghfist::mad:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Windows has always gotten and will always get proper Unicode support wrong.

Innocent Bystander
May 8, 2007
Born in the LOLbarn.
I have another unicode question, for some reason Google Translate has begun returning values in iso-8859-1, and had previously been returning them in utf8, and I cannot figure out why this isn't working.

code:
import requests

def translate(text, tl, sl='en', key=None):

    TRANSLATE_API_ADDRESS = 'https://www.googleapis.com/language/translate/v2'
    get_params = { 'q' : text, 'source' : sl , 'target' : tl, 'key' : key }
    raw_json = requests.get(TRANSLATE_API_ADDRESS, params=get_params)
    print raw_json.content.encode('latin') # Prints the proper value
    print raw_json.content.encode('utf8') # Prints garbage for a few characters
I've tried to convert the string from latin to utf8 with no good results. I need to write it to a utf8 file. The following:

code:
    raw_json.content.encode('latin').decode('utf8')
Dumps a

code:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xfc in position 68: invalid start byte
And quite frankly I'm really not sure how to fix it.

Modern Pragmatist
Aug 20, 2008

Innocent Bystander posted:

I have another unicode question, for some reason Google Translate has begun returning values in iso-8859-1, and had previously been returning them in utf8, and I cannot figure out why this isn't working.

code:
import requests

def translate(text, tl, sl='en', key=None):

    TRANSLATE_API_ADDRESS = 'https://www.googleapis.com/language/translate/v2'
    get_params = { 'q' : text, 'source' : sl , 'target' : tl, 'key' : key }
    raw_json = requests.get(TRANSLATE_API_ADDRESS, params=get_params)
    print raw_json.content.encode('latin') # Prints the proper value
    print raw_json.content.encode('utf8') # Prints garbage for a few characters
I've tried to convert the string from latin to utf8 with no good results. I need to write it to a utf8 file. The following:

code:
    raw_json.content.encode('latin').decode('utf8')
Dumps a

code:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xfc in position 68: invalid start byte
And quite frankly I'm really not sure how to fix it.

Google is returning a UNICODE string to you. This means that you can encode it using whatever character set you want (as long as it is able to interpret all of the characters).

The output of your print statements are the raw byte strings corresponding to the 'latin' and 'utf8' representations of the unicode string returned by google. In your case, that character is a lower-case umlaut u. Of course they aren't going to be the same because UTF-8 and 'latin-1' are two different encodings and therefore will have different codes for the same unicode character.


Your line that you're trying to run is doing this following
code:
raw_json.content              # THIS IS UNICODE
a = raw_json.encode('latin')  # You're asking to return a byte-string that is latin-1 encoded
a.decode('utf8')              # You're now trying to get BACK to unicode using UTF-8 but your bytes 
                                  # are encoded as latin-1 so obviously there may be some incompatibilities
The error is because \xfc isn't a valid UTF-8 byte sequence.

When you use the following, you're actually seeing the byte-string that represents the umlaut u in UTF-8 which is what you want
code:
print raw_json.content.encode('utf8') # Prints garbage for a few characters
If you're trying to write to a file as unicode, then all you need to do is this:

code:
fid = open('testfile.txt', 'rb')
fid.write(raw_json.content.encode('utf8'))
fid.close()
If you have characters that you can't represent with UTF-8, then you can supply the 'xmlcharrefreplace' second argument to raw_json.content.encode() to provide the xml representation of those characters.


I would highly recommend you watch Ned Batchelder's talk about unicode to save yourself a lot of headaches (http://nedbatchelder.com/text/unipain.html)

Houston Rockets
Apr 15, 2006

Anyone here well versed in nose? I can't figure out how to get a single test to run.

I have a test runner that invokes nose.core.TestProgram(). Passing the something like ['my_file.py:TestClass.test_method'] to defaultTest runs all the tests in the TestClass, and not the individual method as I would expect it to.

Houston Rockets fucked around with this message at 02:04 on Feb 21, 2013

Lurchington
Jan 2, 2003

Forums Dragoon
'my_file.py:TestClass.test_method'

this form of test specifying usually goes by module instead of filename. I'm curious what would happen if you passed 'my_file:TestClass.test_method' instead (notice the missing .py)

ah, too bad VVVVVVVVVVV

Lurchington fucked around with this message at 03:14 on Feb 21, 2013

Houston Rockets
Apr 15, 2006

Lurchington posted:

'my_file.py:TestClass.test_method'

this form of test specifying usually goes by module instead of filename. I'm curious what would happen if you passed 'my_file:TestClass.test_method' instead (notice the missing .py)

Same result unfortunately. Here's the documentation I've been looking at in order to try and figure it out:

http://nose.readthedocs.org/en/latest/usage.html#selecting-tests

Cantorsdust
Aug 10, 2008

Infinitely many points, but zero length.
I'm at my wits end, so I figure I'll ask here:

I'm making a simple game in python curses to teach myself programming. I'm in windows, where the curses module doesn't work natively, so after a bit of googling I found the windows version for 3.2 here.

When I use initscr() to bring up the curses terminal, it defaults to a 25 line, 80 column size. I want a bigger size than that. The python documentation says window.resizeterm(lines, cols) should resize the window, but it keeps throwing an error saying 'resizeterm' isn't in the module curses. hasattr(curses, 'resizeterm') does indeed return false. I find another windows curses version, unicurses, but it doesn't have the resizeterm command at all!

So I do more googling, and find that I can change the default size of the window by doing os.environ['LINES'] = 'blah' and os.environ['COLS'] = 'blah' which does indeed change the terminal size. But, the actual program window doesn't change size to match the terminal!

A picture of how it looks:

http://imgur.com/kVWESjj

The LINES and COLS values are in the top left. LINES is 80, COLS is 60. A box is drawn around the actual python window to show what should be being drawn. As you can see, the program is actually getting resized, and all the test entries in my menu are printed off screen. I can still interact with them, scroll back up, etc. The border continues offscreen as well, so I know the program thinks it's 80x60, but the Windows window is still stuck at the 25x80 size. How can I fix this?

edit: figured it out. All I had to do was right click the border, hit properties, and change the Window size. I'm sure there's a way to do that in-program, though, which would be preferable.
os.system("mode con cols=80 lines=60") works. Done.

Cantorsdust fucked around with this message at 08:36 on Feb 21, 2013

Gothmog1065
May 14, 2009
Well, I've picked back up on Python. I'm terrible at this, and have nobody's brain to pick but yours, so I suppose I get back to the ignorant questions. I'm using tkinter and trying to create basic GUI's right now, and I'm loving with buttons and just trying to get really basic poo poo to work. I can't get past this error:

quote:

C:\Users\Gothmog\Desktop\Python\HelpGui>MainWindow.py
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python33\lib\tkinter\__init__.py", line 1442, in __call__
return self.func(*args)
File "C:\Users\Gothmog\Desktop\Python\HelpGui\MainWindow.py", line 16, in star
t_up
temp = New_window()
File "C:\Users\Gothmog\Desktop\Python\HelpGui\MainWindow.py", line 39, in __in
it__
self.mess = Text(self, width = 20, height = 1, wrap = WORD)
File "C:\Python33\lib\tkinter\__init__.py", line 2917, in __init__
Widget.__init__(self, master, 'text', cnf, kw)
File "C:\Python33\lib\tkinter\__init__.py", line 2033, in __init__
BaseWidget._setup(self, master, cnf)
File "C:\Python33\lib\tkinter\__init__.py", line 2011, in _setup
self.tk = master.tk
AttributeError: 'New_window' object has no attribute 'tk'


I know it's something stupid, probably coming from my lack of understanding on how classes work still. Please don't vomit on your keyboards when you see this:

code:
from tkinter import *

class App:
    def __init__(self, master):

        frame = Frame(master)
        frame.pack()

        self.start = Button(frame, text = "Begin", command = self.start_up)
        self.start.pack()
        
        self.end = Button(frame, text = "End", command = frame.quit)
        self.end.pack()

    def start_up(self):
        temp = New_window()
   

class New_window: #Manages the new window

    def __init__(self):

        top = Toplevel()
        top.title("Back and forth!")
        
        mess = "Hit forward or back!"

        # Create buttons
        self.quit = Button(top, text = "QUIT", command=top.destroy)
        self.quit.pack(side=LEFT)

        self.prev = Button(top, text = "Previous", command=self.prev)
        self.prev.pack(side=LEFT)

        self.nxt = Button(top, text = "Next", command=self.nxt)
        self.nxt.pack(side=LEFT)

        # Create text box
        self.mess = Text(self, width = 20, height = 1, wrap = WORD)
        self.mess.grid(row = 2, column = 1, columnspan = 3)

    def nxt(self):
        mess_txt = "Moving forward"
        self.mess_update
        
    def prev(self):
        mess_txt = "Let's go back"
        self.mess_update
        
    def mess_update(self):
        self.mess.delete(0.0, END)
        self.mess.insert(0.0, mess_txt)
        

        
root = Tk()
app = App(root)
root.mainloop()
If I'm completely loving up, please tell me what to look at harder.

Scaevolus
Apr 16, 2007

New_window isn't a Tk widget. You pass it as the "parent" argument on the last Text() call. You want to pass "top" instead.

Scaevolus fucked around with this message at 05:07 on Feb 21, 2013

Houston Rockets
Apr 15, 2006

Houston Rockets posted:

Same result unfortunately. Here's the documentation I've been looking at in order to try and figure it out:

http://nose.readthedocs.org/en/latest/usage.html#selecting-tests

It seems to be some problem with multiprocessing. Not the first time this has bitten me. Multiprocessing breaks a lot of other nose options as well. I had to use some random dev's custom noseplugins to get xunit report output to work with multiprocessing. I'll just disable multiprocessing if individual tests are selected using the test runner. Ugh.

Wish I had time to contribute and get some pull requests going.

good jovi
Dec 11, 2000

'm pro-dickgirl, and I VOTE!

Houston Rockets posted:

It seems to be some problem with multiprocessing. Not the first time this has bitten me. Multiprocessing breaks a lot of other nose options as well. I had to use some random dev's custom noseplugins to get xunit report output to work with multiprocessing. I'll just disable multiprocessing if individual tests are selected using the test runner. Ugh.

Wish I had time to contribute and get some pull requests going.

Fixing nose to get xunit output and multiprocessing output to work together is a major architectural reworking that will almost certainly never get done. I haven't had to deal with I/O-bound test suites in a while, so I don't know what the status of this issue is with nose2, but it should at least be a bit more tractable, if not solved.

Edit: for at least the trivial case I tested, nose2's multiprocessing and junit-xml plugins do play nicely together.

good jovi fucked around with this message at 20:59 on Feb 21, 2013

Gothmog1065
May 14, 2009

Scaevolus posted:

New_window isn't a Tk widget. You pass it as the "parent" argument on the last Text() call. You want to pass "top" instead.

This is where my ignorance shines. How do I manage to do that?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Gothmog1065 posted:

This is where my ignorance shines. How do I manage to do that?

Replace "self" with "top"

Adbot
ADBOT LOVES YOU

Gothmog1065
May 14, 2009
Well I feel stupid now. I must not have saved the file before running it again. Now to find out why the program locks up.

Running the debugger in IDLE, I can step all the way through until it comes back to the root.mainloop, then locks up on some random line in another module. Takes a beginner to lock something up this bad.

Gothmog1065 fucked around with this message at 03:44 on Feb 22, 2013

  • Locked thread