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

Is there a better way to write this?

code:
if lang_list[j].split('(')[0].strip() == name:
    pass
That if is pretty hard to read, but it doesn't seem worth it to put all those operations on different lines either.

Adbot
ADBOT LOVES YOU

vikingstrike
Sep 23, 2007

whats happening, captain

Victor Vermis posted:

Yes, byext.py and whatever script I'm trying to run, say atest.py, are both located in C:\Python25\Tools\Scripts

Am I mistaken thinking that entering the following code into the shell would then activate all of the variable assignments and whatnot within atest.py?
code:
from atest import *
^ this command being the specific problem at hand. I see it used as an example and am instructed to use it, but I have no idea how or why it works (or in this case doesn't work), unlike Function Definitions and Type and Assignments and Operands and everything else that has a dedicated section within the text.

When you are saying "entering the following code into the shell", do you mean that in your terminal you are typing "from byext import *" before running "python atest.py"? If so, you need to put the "from byext import *" at the top of the "atest.py" file. Then just open your terminal and type "python atest.py" to run it.

Victor Vermis
Dec 21, 2004


WOKE UP IN THE DESERT AGAIN

vikingstrike posted:

When you are saying "entering the following code into the shell", do you mean that in your terminal you are typing "from byext import *" before running "python atest.py"? If so, you need to put the "from byext import *" at the top of the "atest.py" file. Then just open your terminal and type "python atest.py" to run it.

I open up Idle Python GUI. To the right of >>> I type "from atest.py import *" and hit enter. I expect the contents of atest.py to now take effect.
For example, if the contents of atest.py are just "message = poop", then the next time I type "print message" I expect the shell to spit "poop" back out at me.

Instead, after typice "from atest.py import *" I get
code:
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from atest.py import *
ImportError: No module named atest.py
I only mentioned byext because it is in the same location as the scripts I made, and I was getting the same error message whenever I tried to import it, showing that this probably wasn't a problem with the content of the script (seeing as byext was a part of the original installation and not made by me) but a problem with the command I was using to import and/or a lack of understanding of how import tracks down the location of whatever .py you're looking for.

vikingstrike
Sep 23, 2007

whats happening, captain
From test1.py
code:
poo = 'message'

def returnPoo():
	return "poo"
From test2.py
code:
from test1 import *

print returnPoo()

print poo
And when I run it:
code:
Randy:Desktop $ python test2.py
poo
message
I never use IDLE, so I have no idea if that's causing you trouble. But, from what I am understanding you're trying to do, the above example shows you what's going on. If you do just "import test1", then you would just change the calls to test1.returnPoo() and test1.poo.

spankweasel
Jan 4, 2006

Victor Vermis posted:


Instead, after typice "from atest.py import *" I get
code:
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from atest.py import *
ImportError: No module named atest.py

Try just:

code:
from atest import *
You don't need the file extension when importing a module.

The Gripper
Sep 14, 2004
i am winner

Victor Vermis posted:

I open up Idle Python GUI. To the right of >>> I type "from atest.py import *" and hit enter. I expect the contents of atest.py to now take effect.
For example, if the contents of atest.py are just "message = poop", then the next time I type "print message" I expect the shell to spit "poop" back out at me.
If you're doing this from the python shell, the working directory will be whatever directory python.exe is located in (C:\python27\ or whatever), so the module you're importing will either need to be in there, or in one of the search path locations (try this code to list search path):
code:
import sys
for n in sys.path:
    print n
Note that sys.path doesn't include windows/system PATH locations, only your python-install specific locations. You don't need to worry about this if you're making your own .py files and keeping the modules you want to import in the same directory.

Scaevolus
Apr 16, 2007

FoiledAgain posted:

Is there a better way to write this?

code:
if lang_list[j].split('(')[0].strip() == name:
    pass
That if is pretty hard to read, but it doesn't seem worth it to put all those operations on different lines either.

What are some values of lang_list[j]?

Victor Vermis
Dec 21, 2004


WOKE UP IN THE DESERT AGAIN

spankweasel posted:

You don't need the file extension when importing a module.
Whoops, I know, a few typos in that post.

vikingstrike posted:

I never use IDLE, so I have no idea if that's causing you trouble. But, from what I am understanding you're trying to do, the above example shows you what's going on. If you do just "import test1", then you would just change the calls to test1.returnPoo() and test1.poo.
This is a bit beyond what I'm having an issue with.

The Gripper posted:

Note that sys.path doesn't include windows/system PATH locations, only your python-install specific locations. You don't need to worry about this if you're making your own .py files and keeping the modules you want to import in the same directory.
This was the issue. Once I saved the file atest.py to C:\Python25 I was able to use
code:
from atest import *
And it worked properly.
Thanks!

duck monster
Dec 15, 2004

If you want to put it in somewhere that scripts can access it anywhere, put it in the site_packages directory, or create your own special funtime directory and figure out how to stick it in the python path.

vikingstrike
Sep 23, 2007

whats happening, captain
I do have to say it was quite enjoyable to write a function called returnPoo(). Ha.

Victor Vermis
Dec 21, 2004


WOKE UP IN THE DESERT AGAIN

duck monster posted:

If you want to put it in somewhere that scripts can access it anywhere, put it in the site_packages directory, or create your own special funtime directory and figure out how to stick it in the python path.
Right now I'm doing everything by the numbers, trying not to work outside of what the book covers so as not to develop any bad habits like using something without understanding it and then relying on it as a clutch. Not very creative, but as long as the book is consistent in building on what it teaches I think I'll feel more comfortable picking up new things from other sources later on.

duck monster
Dec 15, 2004

Right, its just worth pointing out that leaving code strewn all over the system python directory isn't really a "good" habit to be in. :)

FoiledAgain
May 6, 2007

Scaevolus posted:

What are some values of lang_list[j]?

Just strings. It looks like this:

lang_list = ['Vietnamese', 'Welsh', 'Welsh (south)', 'Arrente', 'Arrente (some dialects), 'Faroese', ...]

I'm comparing some information about these languages and I need to avoid dialects, which is why I have that split('(') in there. If I'm already looking at 'Welsh' I don't want to compare it to 'Welsh (south)'.

edit: for clarity, my original question was "is there a better way to write the following?"
if lang_list[j].split('(')[0].strip() == name: pass

FoiledAgain fucked around with this message at 19:50 on Nov 24, 2011

The Gripper
Sep 14, 2004
i am winner

FoiledAgain posted:

Just strings. It looks like this:

lang_list = ['Vietnamese', 'Welsh', 'Welsh (south)', 'Arrente', 'Arrente (some dialects), 'Faroese', ...]

I'm comparing some information about these languages and I need to avoid dialects, which is why I have that split('(') in there. If I'm already looking at 'Welsh' I don't want to compare it to 'Welsh (south)'.

edit: for clarity, my original question was "is there a better way to write the following?"
if lang_list[j].split('(')[0].strip() == name: pass
Are you avoiding dialects entirely (if comparing Welsh to "Arrente", do you also need to compare to "Arrente (some dialects)"?)

If not, you can skip some steps and just do
code:
if "(" in lang_list[j]: pass
I can't think of a better way to do what you're doing already, if the code you've already posted does things exactly the way you need it to.

You could potentially do
code:
if lang_list[j].startswith(name): pass
but you'd need to be sure there are no dialects that could overlap like Welsh and Welshies (or something less stupid). Edit; and that wouldn't work if you were comparing "Language (Dialect)" to "Language".

The Gripper fucked around with this message at 20:06 on Nov 24, 2011

TURTLE SLUT
Dec 12, 2005

I'm writing a program with PyQt4 and trying to pickle quite a large data structure that includes lists, dicts, string, and so on. I seem to be running into problems as one of the objects in one of the lists includes a QDomElement, as it is apparently impossible to serialize this. Every time I try, I get this error:
code:
TypeError: the sip.simplewrapper type cannot be instantiated or sub-classed
Pickling everything else works fine.

Does anyone know how QDomElements are supposed to be serialized? Can the problems have something to do with them being associated with open .xml files or QDomDocuments? I know I could write the QDomElement into .xml but that would be a huge hassle compared to just pickling it along with the rest of the data structure. There also seems to be some sort of function for saving into a QTextStream but I don't know if that can help or how I should do it.

pastorrich
Jun 7, 2008

Keep on truckin' like a novacane hurricane
I have a school issue I would like to discuss. I'm currently enrolled in university as a writing minor and I would like to pursue a interactive media BA. To get in, though, I need to send a piece of work that I've done specificaly for the program.

The piece is rated equally between concept quality, technical ability and the aestethics of the project. I was thinking of making a text based game but that's hardly aestethically nice. I have about a year and a half of time in front of me to make the best piece I can. I have plenty of time on my hands but I want to use it in the best way possible.

I have never programmed anything in my life so my question is this: Is python a good language to learn to code an interactive game? I suppose I could watch a few photoshop tutorials and make a web-based RPG with pictures I made. Is this doable from scracth in a little more than a year? Any ideas? Anything helps, as have no knowledge of programming or programming languages.

tef
May 30, 2004

-> some l-system crap ->

pastorrich posted:

I have never programmed anything in my life

Walk before running. Try writing a text game first. Don't spend the entire time on the project - spend it on smaller projects and get a whole bunch of stuff done. Learning involves making mistakes. Don't burden a project with the mistakes you will make from the outset.

FoiledAgain
May 6, 2007

The Gripper posted:

I can't think of a better way to do what you're doing already, if the code you've already posted does things exactly the way you need it to.

Thanks for the feedback. It does work fine, it just looked ugly. I'm one of those academics you hear about in this thread who writes horrible code because I'm not a programmer by training. I try to make my stuff as readable as possible, so I was really just checking if there was a "nicer" way of writing that line.


I have another question while I'm at it: I want to be able to identify everything that's the same "base" letter is a list of letters, ignoring accents/diacritics. For instance I want to treat 'e', 'é', 'ê', etc. as the same. Is there an easy way to do this, or would I need to set up a custom function for this? (There are probably 15-20 different accent marks in my data, some of them quite rare, and some of them also on consonants.)

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

FoiledAgain posted:

I have another question while I'm at it: I want to be able to identify everything that's the same "base" letter is a list of letters, ignoring accents/diacritics. For instance I want to treat 'e', 'é', 'ê', etc. as the same. Is there an easy way to do this, or would I need to set up a custom function for this? (There are probably 15-20 different accent marks in my data, some of them quite rare, and some of them also on consonants.)

I don't know if this'll work perfectly for you but it's what I have in my helpers library for normalizing accents and diacritics into their base ASCII forms when auto-generating web page names from arbitrary input text, etc:

code:
def sanitise_unicode(str):
    import unicodedata
    return unicodedata.normalize('NFKD', unicode(str)).encode('ascii', 'ignore')

TURTLE SLUT
Dec 12, 2005

I solved my own problem by refactoring code so that the information in the QDomElements is read into container classes that are then serialized normally. A lot more complicated this way but it works. I guess the lesson here is that you can't serialize DOM objects!

FoiledAgain
May 6, 2007

ynohtna posted:

code:
def sanitise_unicode(str):
    import unicodedata
    return unicodedata.normalize('NFKD', unicode(str)).encode('ascii', 'ignore')

Thanks for the idea, but this is giving me a UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
Any idea why? Unicode confuses the hell out of me for some reason, and I always have trouble with funny letters.
In case it makes any difference, this is an example of typical list that I would have:

[p,pʲ,pʷ,t,tʲ,c,cʷ,k,kʷ,k͡p,k͡pʲ,i,u,b,bʲ,bʷ,d,dʲ,ɟ,ɟʷ,ɡ,ɡʷ,ɡ͡b,ɡ͡bʲ,e,o,f,fʲ,s,sɥ,h,ɛ,ɔ,m,mʲ,n,nʲ,ɲ,ŋ,ŋ͡m,ŋ͡mʲ,a,l,lɥ,ɾ,ĩ,ũ,ɥ̥,ɛ̃,ɔ̃,w,ɥ,ã,]

Some things that I would consider "the same":
[ɛ̃] and [ɛ]
[ɥ̥] and [ɥ]
[p], [pʲ] and [pʷ]

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

FoiledAgain posted:

Unicode confuses the hell out of me for some reason, and I always have trouble with funny letters.

See if this helps. I used to have a hard time with unicode as well.

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen

FoiledAgain posted:

Thanks for the idea, but this is giving me a UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
Any idea why?

Sounds like you're not feeding in a fully fledged unicode string but rather a normal ASCII string where the bytes are stored as some other encoding.

Edit: ahah, my function does indeed break when it's given ASCII strings containing high-bit chars when it tries to force it into a unicode string type. Try this update.

code:
def san(str):
    if not isinstance(str, unicode):
        str = unicode(str, 'UTF-8')
    import unicodedata
    value = unicodedata.normalize('NFKD', str).encode('ascii', 'ignore')
    return value

print san('ée-bÿ-ægûm')
print san(u'ée-bÿ-ægûm')
You'll want to investigate altering that 'ignore' parameter, too, as the downcode to ASCII is filtering out the æ character. Essentially, character mapping and comparison is a real pain.

ynohtna fucked around with this message at 23:20 on Nov 25, 2011

tef
May 30, 2004

-> some l-system crap ->

ynohtna posted:

Sounds like you're not feeding in a fully fledged unicode string but rather a normal ASCII string where the bytes are stored as some other encoding.

It does sound like you are doing this -

if you have a string - its default encoding is ascii, so if you call unicode(foo) it is first decoded as ascii before being stored as unicode. so you must do "fooo".decode('text-encoding') to get a unicode string.

FoiledAgain
May 6, 2007

ynohtna posted:

Sounds like you're not feeding in a fully fledged unicode string but rather a normal ASCII string where the bytes are stored as some other encoding.

So I need to convert it to some other encoding, right? I tried this:

letter = letter.encode('UTF-8')

But that throws the ssame error, so I guess I don't understand what it means to "encode" something.

edit: AH! So you have to decode to get the unicode version. I thought that going that direction was encoding. Everything works fine now. Thanks!

FoiledAgain fucked around with this message at 23:20 on Nov 25, 2011

duck monster
Dec 15, 2004

pastorrich posted:

I have a school issue I would like to discuss. I'm currently enrolled in university as a writing minor and I would like to pursue a interactive media BA. To get in, though, I need to send a piece of work that I've done specificaly for the program.

The piece is rated equally between concept quality, technical ability and the aestethics of the project. I was thinking of making a text based game but that's hardly aestethically nice. I have about a year and a half of time in front of me to make the best piece I can. I have plenty of time on my hands but I want to use it in the best way possible.

I have never programmed anything in my life so my question is this: Is python a good language to learn to code an interactive game? I suppose I could watch a few photoshop tutorials and make a web-based RPG with pictures I made. Is this doable from scracth in a little more than a year? Any ideas? Anything helps, as have no knowledge of programming or programming languages.

Pythons a fine language to learn on, and a great one to use as your primary weapon once you've learned. Its easy like basic is , but non-retarded and powerful enough to take you into fairly deep depths of computing.

duck monster
Dec 15, 2004

Has anyone had any luck getting PySide working on Lion? Downloaded latest QT sdk and installed it and PySide, and it just crashes and burns with

code:
Traceback (most recent call last):
  File "test1.py", line 5, in <module>
    from PySide.QtCore import *
  File "/Library/Python/2.7/site-packages/PySide/__init__.py", line 2, in <module>
    import private
  File "/Library/Python/2.7/site-packages/PySide/private.py", line 2, in <module>
    from QtCore import __moduleShutdown
ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Library not loaded: QtCore.framework/Versions/4/QtCore
  Referenced from: /Library/Python/2.7/site-packages/PySide/QtCore.so
  Reason: image not found
trying to install it with brew just causes brew to catch on fire, and I'm not installing loving ports because it tries to install its own python so gently caress that noise.

Catalyst-proof
May 11, 2011

better waste some time with you
Does anyone know if there's a generic Python-primitive to Tkinter Treeview parser? As in, if I hand a Python object to this hypothetical library, it descends through the object and turns all lists, dictionaries, into a tree for the Tkinter Treeview widget to display.

tef
May 30, 2004

-> some l-system crap ->
qt hasn't been released for lion yet. 4.8 should be out real soon now.

vikingstrike
Sep 23, 2007

whats happening, captain

Kim Jong III posted:

POST STUFF....FIREBUG

Just wanted to follow up and say that your advice worked perfectly for me. Thanks again!

Gothmog1065
May 14, 2009

Gothmog1065 posted:

Is there a common separator programmers use? For example, I will have a plaintext file that will have lines that a script I'm writing will perform, and each line will have different functions (IE: open web, url, new/tab) etc.

So an example file will read something like this:

web,forums.somethingawful.com,2
map,r:,\\network drive\
web,https://www.anotherexample.com

Is there something that programmers generally use, or just whatever tickles my fancy?

Okay, stupid question and check to make sure I'm not retarding something up here:

To loop over new lines in the text file, it's:

code:
stuffToDo = open('foo.txt', 'r')
for line in stuffToDo:
    ....
Basically that's what I've got there, the next line will be another for loop to set the variables to put in the functions to actually do the work. My big question is how to loop over a separator (In the above example, the comma). I'm probably going to set it against a list (IE: MAPLIST = ('drive_letter','path') then WEBLIST = ('url','tabs') or something similar so when I call the function I can set the fuction - mapping(drive_letter, path) ...

Am I going about this completely wrong way? It's supposed to start off as a simple script.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Use str.split:

code:
stuffToDo = open('foo.txt', 'r')
for line in stuffToDo:
    command, args = line.split(',', 1)
    print "The command is: %r and the args are %r" % (command, args)

Gothmog1065
May 14, 2009

Suspicious Dish posted:

Use str.split:

code:
stuffToDo = open('foo.txt', 'r')
for line in stuffToDo:
    command, args = line.split(',', 1)
    print "The command is: %r and the args are %r" % (command, args)

That looks like what I need, one last question for now. Some of these line will have two arguments, some one. On top of that I was going to be passing different commands (Mapping a network drive, opening a browser, opening general programs, etc), if my functions have set defaults <def web_open(url = None, args = None) >, will passing on inforation <web_open(command,args)> pass on to the default commands (mapping(command,args) where the defaults are drive_letter,path), and will empty strings override the defaults?

edit:

Can I also call a function with a variable:

code:
command,args = web_open,[url]http://www.foo.com[/url]
command(args)
or do I have to:
code:
if command == "web_open":
    web_open(args)

Gothmog1065 fucked around with this message at 22:18 on Nov 27, 2011

Suspicious Dish
Sep 24, 2011

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

Gothmog1065 posted:

That looks like what I need, one last question for now. Some of these line will have two arguments, some one. On top of that I was going to be passing different commands (Mapping a network drive, opening a browser, opening general programs, etc), if my functions have set defaults <def web_open(url = None, args = None) >, will passing on inforation <web_open(command,args)> pass on to the default commands (mapping(command,args) where the defaults are drive_letter,path), and will empty strings override the defaults?

I recommend making all of your command functions take one argument, and doing the parsing inside each function.

Gothmog1065 posted:


edit:

Can I also call a function with a variable:

code:
command,args = web_open,[url]http://www.foo.com[/url]
command(args)
or do I have to:
code:
if command == "web_open":
    web_open(args)

You can use the dispatch dict pattern:

code:
import subprocess
import sys
import webbrowser

def web_open(args):
    url, = args[:1]
    webbrowser.open(url)

def map_drive(args):
    drive_letter, location = args
    p = subprocess.Popen(['subst', drive_letter, location])
    p.wait()

COMMANDS = dict(
    web_open = web_open,
    map = map_drive
)

stuffToDo = open('foo.txt', 'r')
for line in stuffToDo:
    split_commands = command.split(',')
    command, args = split_commands[0], split_commands[1:]
    if command not in COMMANDS:
        print "Command not found: %r" >> sys.stderr
    command_func = COMMANDS[command]
    command(args)

tef
May 30, 2004

-> some l-system crap ->
My only real question is why you are writing a scripting language inside of python rather than using python as a scripting language?

code:
from mylib import *
web_open('......')
map_drive('......')

duck monster
Dec 15, 2004

tef posted:

My only real question is why you are writing a scripting language inside of python rather than using python as a scripting language?

code:
from mylib import *
web_open('......')
map_drive('......')

Theres plenty of circumstances where a flexible workflow is necessary but a full blown programing language isn't a neat fit, particularly if that flexibility is user facing. Its *very* hard to make python eval() safe.

Gothmog1065
May 14, 2009

tef posted:

My only real question is why you are writing a scripting language inside of python rather than using python as a scripting language?

code:
from mylib import *
web_open('......')
map_drive('......')

I'm looking for something fairly self-contained, when I eventually get done, I want it to be on a flash drive and that's it so I don't have to install it, just run it off the drive.

edit: Dish, I'm having a bit of an issue, I know you wrote that for 2.7, but other than the print function, are there any major changes?

Gothmog1065 fucked around with this message at 07:20 on Nov 28, 2011

Suspicious Dish
Sep 24, 2011

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

Gothmog1065 posted:

I'm looking for something fairly self-contained, when I eventually get done, I want it to be on a flash drive and that's it so I don't have to install it, just run it off the drive.

You have three components when running your own custom script:

  1. Python
  2. Your interpreter program
  3. The script

and only two when just using Python and your own set of custom libraries:

  1. Python
  2. The script

By just writing Python scripts like tef suggested, it's more self-contained.

Gothmog1065 posted:

edit: Dish, I'm having a bit of an issue, I know you wrote that for 2.7, but other than the print function, are there any major changes?

What are you using? 3.2? I highly recommend using 2.7, not 3.2, for a large variety of reasons. I don't use 3.2 myself, but I can't think of any major issue. Post your traceback and code and I'll see what I can do.

Gothmog1065
May 14, 2009

Suspicious Dish posted:

By just writing Python scripts like tef suggested, it's more self-contained.
Is there a good source so I can read up on the difference, etc? The book I used barely covered libraries and such.

Eventually I want this to be part of a larger program that will do some of the tasks at work to make things easier. For example, we use IPs a lot, I'd like to eventually have it where I can put an IP in to a box and have it do various functions depending on the need.

quote:

What are you using? 3.2? I highly recommend using 2.7, not 3.2, for a large variety of reasons. I don't use 3.2 myself, but I can't think of any major issue. Post your traceback and code and I'll see what I can do.

I'm on 3.2.1 right now, going to update, I though I was on 3.1.3, but whatever. I keep hearing different reasons to either be updated or go back. I know 2.x has much better library and addon support, but for the basic stuff right now, will it make a difference?

anyhoo:

pre:
Traceback (most recent call last):
  File "C:\Users\Gothmog\Desktop\Python\Script.py", line 61, in <module>
    main(0)
  File "C:\Users\Gothmog\Desktop\Python\Script.py", line 53, in main
    split_commands = command.split(',')
UnboundLocalError: local variable 'command' referenced before assignment
That's the first thing I'm having an issue with.

Adbot
ADBOT LOVES YOU

The Gripper
Sep 14, 2004
i am winner

Gothmog1065 posted:

pre:
Traceback (most recent call last):
  File "C:\Users\Gothmog\Desktop\Python\Script.py", line 61, in <module>
    main(0)
  File "C:\Users\Gothmog\Desktop\Python\Script.py", line 53, in main
    split_commands = command.split(',')
UnboundLocalError: local variable 'command' referenced before assignment
That's the first thing I'm having an issue with.
That's just a simple typo (that I also make retardedly often), should be line.split not command.split.

As for 3.2 vs. 2.7, my decider for which to use is whether I'm making something self-contained and will be setting up the environment myself. If both of those are true I'll use 3.2, if I have to use external libraries that aren't 3.0 compatible I'll use 2.7, and if I don't know what version of python will be available I use 2.7 since that's what most distros ship with currently.

  • Locked thread