Re: [Tutor] line class
"Christopher Spears" <[EMAIL PROTECTED]> wrote def __cmp__(self, other): if self.x == other.x and self.y == other.y: return 0 elif self.x < other.x and self.y < other.y: return -1 elif self.x > other.x and self.y > other.y: return 1 Rather than comparing in that manner I'd take a different approach. I'd measure the length from the origin thus any point that was inside the circle upon whose ciorcumference the point sits is less than the point. Any point on the circumference is equal and any point outside the circle is greater... [ Another approach with similar results is to convert the coordinates into complex numbers and then use the complex number cmp method to compare those. ] Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] build list of non-empty variables
Ah! A list comprehension. Not at that point in the learning python book, yet, but I will be soon. Thanks! Don On Tue, Jul 8, 2008 at 9:34 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Tue, Jul 8, 2008 at 6:35 PM, Don Jennings <[EMAIL PROTECTED]> wrote: > > > def __unicode__(self): > > l=[self.first_name, self.last_name, self.email, self.phone] > > res=[] > > > > for x in l: > > if x != '': > > res.append(x) > > > > return ';'.join(res) > > return ';'.join(x for x in l if x) > will work. > > Kent > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] line class
On Wed, Jul 9, 2008 at 3:05 AM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > Rather than comparing in that manner I'd take a different approach. > I'd measure the length from the origin thus any point that was inside > the circle upon whose ciorcumference the point sits is less than > the point. Any point on the circumference is equal and any point > outside the circle is greater... That will allow points with different x and y values to compare equal which would be a strange definition of equality. > [ Another approach with similar results is to convert the coordinates > into complex numbers and then use the complex number cmp method > to compare those. That just raises the question of how do complex numbers compare? Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to create array of variants?
Monika Jisswel googlemail.com> writes: > > > Comment : I never did any VB so I am not sure if I understand you.supposing your data comes like this :python code : > > > Data = ( ('A', 1), ('B', 2), ('C', 3), ('D', 4) )#you can create a list of the items like this : List_Letters = [ x[0] for x in Data]List_Numbers = [ x[1] for x in Data] > > hope this helps. > > Monika, Thanks for your reply. I've tried using the list data type, but it does not work in this case. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Python Characteristics.
Hello All, I was pondering something. when you are in the live environment receiving immediate feedback is it basically a compiler (or program), responding to what the user inputs, or is it like the bash shell where I could tell it to search the file system for a certain file? Or how does python interact with the environment it is in? If those are too broad of questions just pass. Sorry for the illiterate questions. Thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python Characteristics.
Jeremiah Stack wrote: Hello All, I was pondering something. when you are in the live environment receiving immediate feedback is it basically a compiler (or program), responding to what the user inputs, or is it like the bash shell where I could tell it to search the file system for a certain file? Yes. :) That's sort of a philosophical question, at least from one point of view. Python compiles the source code you give it before running it. With the interactive mode, it's simply compiling lines of code on the fly as you input them, and executing them, and printing the return value of each statement you type, rather than having you prepare them in a file and feeding them to it all at once. Otherwise everything's identical as far as what the system is doing and how it interacts with the environment. So it's not like a shell in that respect, (unlike, say, tclsh is for the TCL interactive environment). Certainly, however, you could write Python code to interact with the file system in any manner you choose, and that code would work equally well at the interactive prompt and as part of a stored program file. Or how does python interact with the environment it is in? If those are too broad of questions just pass. Sorry for the illiterate questions. Thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] line class
"Kent Johnson" <[EMAIL PROTECTED]> wrote That just raises the question of how do complex numbers compare? Usually based on magnitude alone. That's why I said the results would be equivalent to the length of a point approach. You assume that any point on the same sperical locus is equal. At least on my engineering course :-) I confess I haven't tried it to see if Python implements cmp for the complex type. c < d Traceback (most recent call last): File "", line 1, in TypeError: no ordering relation is defined for complex numbers Apparently not! :-/ Alan G ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] line class
On Wed, Jul 9, 2008 at 2:17 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "Kent Johnson" <[EMAIL PROTECTED]> wrote >> >> That just raises the question of how do complex numbers compare? > > Usually based on magnitude alone. > That's why I said the results would be equivalent to the length of a point > approach. You assume that any point on the same sperical locus is equal. At > least on my engineering course :-) That seems a pretty strange definition of equal, that makes (1, 0) == (0, 1). Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] build list of non-empty variables
"Don Jennings" <[EMAIL PROTECTED]> wrote return ';'.join(x for x in l if x) Ah! A list comprehension. Not at that point in the learning python book, Not quite, I believe its called a generator expression. Its like a list comprehension but without the [] around it. In fact I guess you could say that the new definition of a list comprehension is [ generator expression] But if I'm wrong someone will explain why I'm sure! :-) Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python Characteristics.
"Jeremiah Stack" <[EMAIL PROTECTED]> wrote I was pondering something. when you are in the live environment receiving immediate feedback is it basically a compiler (or program), responding to what the user inputs, Yes, technically its an interpreter rather than a compiler, although there is an intermediate compilation step involved in the interpretation! But it is the same python program used to interpret scripts, it just reads its input from stdin rather than from a text file. or is it like the bash shell where I could tell it to search the file system for a certain file? You can interact with the operating system and file system using modules such as os etc. But you can't do it directly as you can in bash. But that is because bash has built in capability to execute external commands, otherwise bash is an interpreter too, albeit with a much more limited syntax and general capability. Bash's power is in calling external commands. Python's power is in creating commands! Or how does python interact with the environment it is in? As above, it reads input from a file (foo.py) or from stdin. It compiles the instructions too byte code. If the file is being imported as a module it saves the bytecode as a compiled file (foo.pyc) and uses that the next time it imports the same module, provided the module has not been changed - ie. it checks the datestamps!. It then interprets the byte code much as does Java's JVM. If the file is not being imported then it just executes the internal byte code block by block. There are various actions at startup time that influence the operation of the interpreter, ie. its environment, but you can read about all of these issues on the Python web site. There is copious documentation on such things. You can also use pythons introspection capabilities to explorte much of it - for example you can decompile the .pyc byte code into Python's pseudo assembler. You can find out which file a particular module is from. etc. If those are too broad of questions just pass. They are ok. Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Text Editor With Speech
Hi! I am coming closer to the talking editor and voice adjustments inside my editor/talking module. When reading the events over and over again I am slowly understanding who wants what. Inside an editor there are key commands that do certain things and I try to give some voice to them. Below I do not use the OnKey function yet, but will erase the comments and such and only have a say key inside with a toggle on/off for key typing. Before this was the only event call with keys, now it is only for say key pressed in the future. At the moment I use the KEY_UP event to look at what was done by the editor after the key is released. This allows no need for location calculations since the move has been made and the final position in most cases has been done. So, I moved the values for all line parms over to the OnKey_Up function so I know where the pointer is at. I do a word forward and back inside of this function so the word forward and back are pronounced. You may replace the speech engine with the pyTTS if you so desire. But I have not added the method for pitch to there module, so the pitch adjustment would not work. I mention this because I have not done a dictionary for the engine, so some things get pronounced a little different. Like AM for the time does not come out as A.M. nor am, but likes to take the m out for something else. Little things like that. Anyway, this is the latest using events and have removed the button list. I left the textctrl control methods in the 2 function calls for future usage and reference. Enjoy. Bruce #Editor.py import wx import os import Sapi5 tts = Sapi5.Create( {"name":"Mary"}) purge = tts._purge async = tts._async punc = tts._punc ID=0 HK=1 KH=2 MK=3 MF=4 MF2=5 DW_ID=1000 class MainWindow(wx.Frame): def __init__(self, parent, id, title): self.dirname=os.getcwd() #SEARCH FROM PRESENT DIRECTORY! self.filename="" self.items4menu = {"File": [ {ID:102, HK:"&Open", KH:" Open a file to edit", MF:self.OnOpen}, {ID:103, HK:"&Save", KH:" save file to disk", MF:self.OnSave}, {ID:104, HK:"&Edit", KH:" Do editing", MF:self.OnEdit}, {ID:101, HK:"&About", KH:" Information about this program", MF:self.OnAbout}, {ID:109, HK:"E&xit", KH:" Terminate the program", MF:self.OnExit} ], #END OF FILE MENU! "Voice": [ {ID:202, HK:"&Read", KH:" Open a file to read", MF:self.OnWav2Read}, {ID:203, HK:"&Save", KH:" save text to audio file", MF:self.OnSave2Wav}, {ID:204, HK:"Te&xt", KH:" read text field", MF:self.OnRead}, {ID:205, HK:"&Quit", KH:" Stop Reading", MF:self.OnQuitRead} ], #END OF VOICE MENU! "Settings": [ {ID:302, HK:"&Speaker", KH:" Name for voice.", MF:self.OnEnter, MF2:self.OnVoice}, {ID:303, HK:"&Rate", KH:" Rate for voice.", MF:self.OnEnter, MF2:self.OnVoice}, {ID:304, HK:"&Pitch", KH:" Pitch for voice.", MF:self.OnEnter, MF2:self.OnVoice}, {ID:305, HK:"&Volume", KH:" Volume for voice.", MF:self.OnEnter, MF2:self.OnVoice} ], #END OF SETTINGS MENU! "Down": [ {ID:DW_ID, HK:"&Down", KH:" Lower Setting.", MF:self.OnEnter, MF2:self.OnVoice} ] #END OF DOWN MENU! } #END OF ITEMS FOR MENU! wx.Frame.__init__(self, parent, wx.ID_ANY, title) self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE) self.control.Bind( wx.EVT_KEY_UP, self.OnKey_Up) #, self.control) #self.control.Bind( wx.EVT_CHAR, self.OnKey) #, self.control) self.CreateStatusBar() #A Statusbar in the bottom of the window #Setting up the menu. filemenu = wx.Menu() for o in self.items4menu["File"]: filemenu.Append( o[ID], o[HK], o[KH]) filemenu.AppendSeparator() voicemenu = wx.Menu() for o in self.items4menu["Voice"]: voicemenu.Append( o[ID], o[HK], o[KH]) voicemenu.AppendSeparator() self.setting_menu = wx.Menu() for o in self.items4menu["Settings"]: down_menu = wx.Menu() down_menu.Append( o[ID], o[HK], o[KH]) d = self.items4menu["Down"][0] down_menu.Append( d[ID]+o[ID], d[HK], d[KH]) self.setting_menu.AppendMenu( o[ID], o[HK], down_menu) self.setting_menu.AppendSeparator() voicemenu.AppendMenu(-1, "&VoiceSettings", self.setting_menu) # Creating the menubar. menuBar = wx.MenuBar() menuBar.Append( filemenu,"&File") # Adding the "filemenu" to the MenuBar menuBar.Append( voicemenu,"&Voice") # Adding the "voicemenu" to the MenuBar self.SetMenuBar( menuBar) # Adding the MenuBar to the Frame content. self.data4menu = {} for o in self.items4menu["File"]: wx.EVT_MENU(self, o[ID], o[MF]) self.data4menu[ o[ID]] = o
Re: [Tutor] build list of non-empty variables
Alan Gauld wrote: In fact I guess you could say that the new definition of a list comprehension is [ generator expression] Well, not if sure if you meant that literally, but it's certainly not: that would be a list whose one item was a generator expression: squares = (x * x for x in range (10)) l = [squares] print len (l) print l[0] But a list comp *is* (in effect) the same as: squares = (x * x for x in range (10)) l = list (squares) print len (l) print l[0] TJG ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Problem with creating class instance
I've just started using classes in Python. The basic goal is to develop a script that tracks individual player stats for poker tournaments. This involves nesting a class within a class within a class. The Player class incorporates a Stats class (three instances for three different game types) and the Stats class incorporates a Details class (three instances for three different game phases). In creating a Player instance, that instance can create the Stats class, but when creating the first instance within the Stats class of a Details class, it fails with the following traceback: Traceback (most recent call last): File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 309, in RunScript debugger.run(codeObject, __main__.__dict__, start_stepping=0) File "C:\Python25\Lib\site-packages\pythonwin\pywin\debugger\__init__.py", line 60, in run _GetCurrentDebugger().run(cmd, globals,locals, start_stepping) File "C:\Python25\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 624, in run exec cmd in globals, locals File "C:\Documents and Settings\Mike and Patsy\Desktop\pk\pkutilities.py", line 140, in initplayers(playernames) File "C:\Documents and Settings\Mike and Patsy\Desktop\pk\pkutilities.py", line 119, in initplayers gameplayers[name] = Player(name) File "C:\Documents and Settings\Mike and Patsy\Desktop\pk\pkutilities.py", line 8, in __init__ self.stat[0] = Stats('holdem', name) File "C:\Documents and Settings\Mike and Patsy\Desktop\pk\pkutilities.py", line 29, in __init__ self.gamephase[0] = Details('full') IndexError: list assignment index out of range The appropriate code segments defining the classes and the calling function follow: class Player(): def __init__(self,name): self.name = name self.stat[0] = Stats('holdem', name) self.stat[1] = Stats('omahah', name) self.stat[2] = Stats('omahahl', name) class Stats(): def __init__(self, type, name): self.name = name self.gametype = type self.totalgames = 0 self.totalgamestofinish = 0 self.totalfinish = 0 self.gamephase[0] = Details('full')# this is the line which fails self.gamephase[1] = Details('mid') self.gamephase[2] = Details('end') class Details(): def __init__(self, type): self.type = type self.totalhands = 0 self.VPIPhands = 0 self.VPIPcount = 0 self.VPSBhands = 0 self.VPSBcount = 0 self.flopseen = 0 self.turnseen = 0 self.riverseen = 0 self.preflopraise = 0 self.flopraise = 0 self.turnraise = 0 self.riverraise = 0 self.winpreflop = 0 self.winflop = 0 self.winturn = 0 self.winriver = 0 # this is the function that creates the Player instance def initplayers(playernames): global db, gameplayers db = shelve.open('playerstats.dat') for i in range(len(playernames)): name = playernames[i] if db.has_key(name): gameplayers[name] = db[name] else: gameplayers[name] = Player(name) # this line creates the Player instance db[name] = gameplayers[name] I don't see how the "list assignment index" can be out of range, so I assume there's an earlier error that I can't find or a syntax error that I'm overlooking. Can anyone point out where I'm going wrong? And, if you can recommend a better way to organize the data, feel free. Thanks for your help. Mike ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python Characteristics.
To add to Alan: On Wed, Jul 9, 2008 at 2:34 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > You can interact with the operating system and file system using > modules such as os etc. But you can't do it directly as you can > in bash. But that is because bash has built in capability to execute > external commands, otherwise bash is an interpreter too, albeit > with a much more limited syntax and general capability. Bash's > power is in calling external commands. Python's power is in > creating commands! > > You can *make* it more like a shell (if that's what you're looking for) by using ipython: http://ipython.scipy.org/ A large percentage of python developers use IPython (the I stands for interactive, I think). -- Michael Langford Phone: 404-386-0495 Consulting: http://www.RowdyLabs.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Problem with creating class instance
On Wed, Jul 9, 2008 at 5:02 PM, Mike Meisner <[EMAIL PROTECTED]> wrote: > In creating a Player instance, that instance can create the Stats class, > but when creating the first instance within the Stats class of a Details > class, it fails with the following traceback: > > Traceback (most recent call last): > File "C:\Documents and Settings\Mike and Patsy\Desktop\pk\pkutilities.py", > line 29, in __init__ > self.gamephase[0] = Details('full') > IndexError: list assignment index out of range > > > The appropriate code segments defining the classes and the calling function > follow: > class Stats(): > > def __init__(self, type, name): > self.name = name > self.gametype = type > self.totalgames = 0 > self.totalgamestofinish = 0 > self.totalfinish = 0 > self.gamephase[0] = Details('full')# this is the line which > fails You don't show how self.gamephase is initialized. I assume you say something like self.gamephase = [] because if you didn't initialize it at all you would get a NameError rather than IndexError. You can't assign to a list element that doesn't exist, it will raise IndexError; e.g. In [19]: phase = [] In [20]: phase[0] = 'test' --- Traceback (most recent call last) /Users/kent/ in () : list assignment index out of range You can append to the list: In [21]: phase.append('test') Now it has a zeroth element: In [22]: phase[0] Out[22]: 'test' but a simpler solution might be just to create the list with the elements you want: self.gamephase = [ Details('full') , Details('mid'), Details('end') ] > for i in range(len(playernames)): > name = playernames[i] Write this as for name in playernames: > I don't see how the "list assignment index" can be out of range, so I assume > there's an earlier error that I can't find or a syntax error that I'm > overlooking. No, if it says the index is out of range, it probably is. This might be a symptom of an earlier error but you should believe the error message. A syntax error will prevent the program from running at all. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] line class
"Kent Johnson" <[EMAIL PROTECTED]> wrote Usually based on magnitude alone. That seems a pretty strange definition of equal, that makes (1, 0) == (0, 1). Yes I know! But actually in many engineering situations where phase is not important it's a good first approximation (for example power calculation in a single phase AC circuit - you only care about the magnitude of the current not it's phase.) Of course in other cases its wildly wrong so you need to apply with caution. In those cases comparison has to be defined arbitrarily to fit the scenario - but that's common practice in engineering. Adapting the rules of math to suit is all part of the fun! -) Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] build list of non-empty variables
"Tim Golden" <[EMAIL PROTECTED]> wrote In fact I guess you could say that the new definition of a list comprehension is [ generator expression] Well, not if sure if you meant that literally No I meant in syntactic terms. We usually define an LC as [ expr for vars in sequence if expr ] or somesuch imprecise gobbledy gook ;-). Now we can define the generator expr (syntax) as expr for vars in sequence if expr and the LC as [ gen expr ] squares = (x * x for x in range (10)) l = [squares] But doesn't that generate a tuple (because of the parens)? And if you remove the parens you cant assign to the variable so you have to [put it in the list literally which becomes l = [x * x for x in range (10)] Which is an LC... Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] build list of non-empty variables
On Wed, Jul 9, 2008 at 8:17 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > No I meant in syntactic terms. > We usually define an LC as > > [ expr for vars in sequence if expr ] > > or somesuch imprecise gobbledy gook ;-). > > Now we can define the generator expr (syntax) as > > expr for vars in sequence if expr > and the LC as > > [ gen expr ] The gen exp needs the parens. You could possibly have an intermediate term that can be put inside () or []. The actual formal syntax definitions for the two are slightly different: http://docs.python.org/ref/lists.html http://docs.python.org/ref/genexpr.html Presumably this means there is something that is syntactically allowed in one form and not the other, but I can't figure out what it might be. >> >> squares = (x * x for x in range (10)) >> l = [squares] > > But doesn't that generate a tuple (because of the parens)? No, the parens are required for, and create, a generator expression. In [23]: squares = (x * x for x in range (10)) In [24]: squares Out[24]: Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] build list of non-empty variables
On 10/07/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: > The actual formal syntax definitions for the two are slightly different: > http://docs.python.org/ref/lists.html > http://docs.python.org/ref/genexpr.html > > Presumably this means there is something that is syntactically allowed > in one form and not the other, but I can't figure out what it might > be. Is the generator expression grammar right? How do I parse, e.g., '(x+1 for x in range(10))'? Seems like there's nothing there for 'range(10)'. Like it should replace 'or_test' with 'old_expression'. At any rate, here is one difference: >>> a = range(5) >>> b = range(5, 10) >>> [x for x in a, b] [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]] >>> (x for x in a, b) File "", line 1 (x for x in a, b) ^ SyntaxError: invalid syntax (I'm not sure I've ever used a list comprehension like that) -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] build list of non-empty variables
On Wed, Jul 9, 2008 at 9:38 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > On 10/07/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: >> The actual formal syntax definitions for the two are slightly different: >> http://docs.python.org/ref/lists.html >> http://docs.python.org/ref/genexpr.html > Is the generator expression grammar right? How do I parse, e.g., > '(x+1 for x in range(10))'? Seems like there's nothing there for > 'range(10)'. Like it should replace 'or_test' with 'old_expression'. I can't figure out how to parse that either, as a gen exp or a list comp. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] build list of non-empty variables
On 10/07/2008, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Wed, Jul 9, 2008 at 9:38 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > > Is the generator expression grammar right? How do I parse, e.g., > > '(x+1 for x in range(10))'? Seems like there's nothing there for > > 'range(10)'. Like it should replace 'or_test' with 'old_expression'. > I can't figure out how to parse that either, as a gen exp or a list comp. Oh, wait, I got it. I just didn't follow the chain far enough. old_expression -> or_test -> and_test -> not_test -> comparison -> or_expr -> xor_expr -> and_expr -> shift_expr -> a_expr -> m_expr -> u_expr -> power -> primary -> call (or replace call with atom) So the other difference between list comprehensions and generator expressions is that list comprehensions get to use "old_expression"s whereas generator expressions start with "or_test"s. An old_expression can be an old_lambda_form, which means that this is valid syntax: >>> [x for x in lambda y: y**2] whereas this is not: >>> (x for x in lambda y: y**2) I'm lost for how to come up with a use for that, though (or even a way to write code like that without producing a TypeError: 'function' object is not iterable). -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] python beginner
I have an external app that writes out a very basic xml files that contains data that needs to be processed. For Example, one type of job would be a simple file copy. So in the XML file there would be (among other bits of information about the job) things like CopyFiles Frank ( for who submitted the job.) c:\tmp\ Image_0001.jpg Image_0150..jpg d:\backup\ I need to learn to write a program that does several things. First it will scan a directory for these sort of xml data files. Secondly, it will need a basic interface that lists the jobs in the queue, and whether or not they are done being processed. Thirdly, it will have to support multiple job types. Each job type will have its own set of commands to run. The example above would be a very simple job that would copy (probably using xcopy) to copy all the images in a sequence between frame 0001 and frame 0150 of c:\tmp \Image_0001.jpg to d:\backup\. This job type of copy should probably also check the destdir to make sure they are identical, and then set the status of that job to completed. Of course to do all of this, it will also need an interface. So whatever language/script I use must of course be able to produce a sort of small database and interface to keep track of which jobs have been processed. My first question is, what language do you think this sort of thing would be best done in. I have some scripting experience in Lua, very basic python, and 2 semesters of c++, so i am a NOVICE in all those languages, but I understand scripting and programming a little and don't think it is too far of a stretch for me to learn how to do this. But I want to make sure I start down the right road with the best tool for the job, IE: the best language for this sort of program. Thank you. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Basic Help Implementing Saved Scripts
Hi, Sorry for this, most likely, idiotic question on my part. I'm really liking Python and it's ease of use. My only trouble is that I'm not sure how to use a script that I've saved, during another script located within the same folder. The idea is that I want to make a few functions and be able to pull them up within my program without copy and pasting them. Is it possible in Python? Do I have to import them? I've tried looking at tutorials, etc, but I can't find any that are up to date/simple enough to make any sense to me. I'm running Windows ME and have used IDLE up to this point. Python is my first language. I have some knowledge of computers but reading some of the things on the other e-mails sent out, I'm lost. I'd really appreciate it if someone gave me a very simple, step by step explanation of how to do this. Thanks, -Jay ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Basic Help Implementing Saved Scripts
On 10/07/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > Sorry for this, most likely, idiotic question on my part. I'm really > liking Python and it's > ease of use. My only trouble is that I'm not sure how to use a script that > I've saved, during > another script located within the same folder. > > The idea is that I want to make a few functions and be able to pull them up > within my > program without copy and pasting them. Is it possible in Python? Do I have > to import > them? Short answer: Yes. Check out the tutorial: http://docs.python.org/tut/node8.html -- John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor