Help
I'm a bit new to python and I'm trying to create a simple program which adds words and definitions to a list, and then calls them forward when asked to. --- choice = 0 words = [] entry = 0 definition = 0 escape = 0 finish = 0 memory = 0 dictionary = [] search = 0 def ask_ok(prompt, retries=2, complaint='Yes or no, please!'): while True: ok = input(prompt) if ok in ('y', 'ye', 'yes'): return True if ok in ('n', 'no', 'nop', 'nope'): return False retries = retries - 1 if retries < 0: raise IOError('refusenik user') print(complaint) print("Welcome to Digital Dictionary V1.0!\n\n") while escape < 1: choice = input("Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. ") if choice == '`': break if choice == 'Entry' or 'entry': while finish < 1: entry = input("Please type the word you wish to add: ") words.append(entry) definition = input("What does the word mean?\n ") dictionary.append(definition) print(entry, '\n', definition) ask_ok("Is this entry complete? ") if True: finish = 1 entry = 0 definition = 0 elif choice == 'Search' or 'search': search = input("Please type the word you wish to find: ") print(search in words) elif choice == 'Exit' or 'exit': ask_ok("Are you sure you want to exit? ") if True: escape = 1 else: print("Please choose an option from the list.") --- However, if I run the program using anything but 'entry', the program still runs the 'entry' subroutine. After the 'entry' subroutine is run once, no options work. Ex: --- >>> Welcome to Digital Dictionary V1.0! Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. entry Please type the word you wish to add: computer What does the word mean? a device for computing computer a device for computing Is this entry complete? yes Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. search Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. exit Type 'Entry' to add a word to the Dictionary, 'Search' to find a word, and 'Exit' to quit. ` >>> --- The only option which seems to work is the '`' subroutine, which I added to stop the program after running for a while. I believe it works because it was added before the 'entry' subroutine. If anyone can help me figure out why it won't run properly, I'd be really grateful. P.S: I haven't finished the 'search' subroutine, but I just want to get this small problem solved soon so I can -- http://mail.python.org/mailman/listinfo/python-list
Re: Help
Thank you everybody who replied. The problem is fixed now and the program is running correctly. I will also try to use your suggestions in the future to make sure I don't make the same mistake. Thanks again :). -- http://mail.python.org/mailman/listinfo/python-list
fcntl() and packing structs with unions.
I'm having some trouble building a proper argument for an ioctl call. The operation I'm working with is TUNSETIFF _IOW('T', 202, int) which takes a struct ifreq as the arg. Could someone familiar with the struct (usually defined in net/if.h) tell me how the heck to encode it using the struct/array module? An example would be fantastic. Thanks -- http://mail.python.org/mailman/listinfo/python-list
python extension modules within packages not loading
I've written a small python extension but I'm having difficulty loading it at runtime. The source for my extension is a module which is a member of a package is organized as follows. test/setup.py test/myutils/__init__.py test/myutils/netmodule.c my setup.py file for building / installing looks like this setup(ext_package = 'myutils', ext_modules = [ Extension('net', sources = [ 'myutils/netmodule.c' ]) ], packages = [ 'myutils']) as per the faq I've been building and installing it with python setup.py build python setup.py install which results in the following being installed into my site-packages directory. /usr/lib/python2.4/site-packages/myutils/__init__.py /usr/lib/python2.4/site-packages/myutils/__init__.pyc /usr/lib/python2.4/site-packages/myutils/net.so when I run the interpreter and try to import the modules however I get no joy. >>>import myutils >>>import myutils.net Traceback (most recent call last): File "", line 1, in ? ImportError: No module named net now annoyed I strace the interpreter during the loading of the module and see. stat64("myutils", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat64("myutils/__init__.py", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 stat64("myutils/__init__", 0xbf8d3a6c) = -1 ENOENT (No such file or directory) open("myutils/__init__.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("myutils/__init__module.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("myutils/__init__.py", O_RDONLY|O_LARGEFILE) = 3 clearly the above corresponds to my first import statement and it appears to have been successful. A little further along in the trace however I see the following. stat64("myutils", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat64("myutils/net", 0xbf8d3ebc)= -1 ENOENT (No such file or directory) open("myutils/net.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("myutils/netmodule.so", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("myutils/net.py", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) open("myutils/net.pyc", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) clearly the above corresponds to my second import statement but for some reason it fails with ENOENT when trying to open myutils/net.so which definately exists. Noticing it appears to be using a relative path I decided to try again and this time I chdir() to /usr/lib/python2.4/site-extensions directory before launching the interpreter and it then it works perfectly fine. Of course I shouldn't have to set my cwd to the site-extensions directory before using my extension module.. How do I fix this? What have I done wrong? Help very much appreciated, thanks. Tyler -- http://mail.python.org/mailman/listinfo/python-list
wxPython and how to return text entry to main program?
Hello All: I am currently working on a project to create an FEM model for school. I was thinking about using wxPython to gather the 12 input variables from the user, then, after pressing the "Run" button, the GUI would close, and the 12 input variables would then be available for the rest of the program. So far, what I have been able to do is mostly a reverse engineering job to get the frame to look right and return the text variable to a dialog box. I have read about a "redirect" that could be used to send the values to a file. But, then I would have to open the file and read in the data from there. This seems crude and lacking elegance. Any help on how to get the program to output the data back to the main python program and close when I press submit? My apologies if this is something of a simple question, but I have only started in on wxPython about a week ago, and Python this term. The codes I am using are below. Any help (or suggested reading material) is greatly appreciated. Cheers, t. MY MAIN PROGRAM #!/usr/bin/env python import femGUI app = femGUI.MyApp(False) dlg = femGUI.FemInput() dlg.Destroy() app.MainLoop() # Then do something with inputs here THE FEMINPUT GUI CLASS import wx class FemInput(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "Options Input Interface") panel = wx.Panel(self) # First create the controls # Title topLbl = wx.StaticText(panel, -1, "FEM 2D Basket Put Option ",size=(420,-1)) topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD)) # S1 lower and upper bounds for grid s1label = wx.StaticText(panel, -1, "S1 Low , S2 Low: ", size=(220,-1)) self.s1lower = wx.TextCtrl(panel, -1, "", size=(100,-1)); self.s2lower = wx.TextCtrl(panel, -1, "", size=(100,-1)); # S2 lower and upper bounds for grid s2label = wx.StaticText(panel, -1, "S1 High, S2 High: ", size=(220,-1)) self.s1upper = wx.TextCtrl(panel, -1, "", size=(100,-1)); self.s2upper = wx.TextCtrl(panel, -1, "", size=(100,-1)); # S1 and S2 volatility vlabel = wx.StaticText(panel, -1, "S1 Volatility, S2 Volatility: ", size=(220,-1)) self.v1vol = wx.TextCtrl(panel, -1, "", size=(100,-1)); self.v2vol = wx.TextCtrl(panel, -1, "", size=(100,-1)); # Risk free rate and correlation prlabel = wx.StaticText(panel, -1, "Interest Rate, Correlation: ", size=(220,-1)) self.risk= wx.TextCtrl(panel, -1, "", size=(100,-1)); self.corr= wx.TextCtrl(panel, -1, "", size=(100,-1)); # Strike and Exercise Date kTlabel = wx.StaticText(panel, -1, "Srike Price, Exercise Date: ", size=(220,-1)) self.strike= wx.TextCtrl(panel, -1, "", size=(100,-1)); self.finalT= wx.TextCtrl(panel, -1, "", size=(100,-1)); # deltaT and deltaX dTXlabel = wx.StaticText(panel, -1, "delta T, delta X: ", size=(220,-1)) self.deltaT= wx.TextCtrl(panel, -1, "", size=(100,-1)); self.deltaX= wx.TextCtrl(panel, -1, "", size=(100,-1)); # Execute program runBtn = wx.Button(panel, -1, "Run") self.Bind(wx.EVT_BUTTON, self.OnSubmit, runBtn) # Now do the layout. # mainSizer is the top-level one that manages everything mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(topLbl, 0, wx.ALL, 5) mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND|wx.TOP|wx.BOTTOM, 5) # femSizer is a grid that holds all of the address info femSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) femSizer.AddGrowableCol(1) # S1 and S2 LOWER label femSizer.Add(s1label, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) # the lower and upper S1 bounds are in a sub-sizer s1Sizer = wx.BoxSizer(wx.HORIZONTAL) s1Sizer.Add(self.s1lower, 1) s1Sizer.Add((10,10)) # some empty space s1Sizer.Add(self.s2lower, 1, wx.LEFT|wx.RIGHT, 5) femSizer.Add(s1Sizer, 1, wx.EXPAND) # S1 and S2 HIGH label femSizer.Add(s2label, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) # the lower and upper S1 bounds are in a sub-sizer s2Sizer = wx.BoxSizer(wx.HORIZONTAL) s2Sizer.Add(self.s1upper, 1) s2Sizer.Add((10,10)) # some empty space s2Sizer.Add(self.s2upper, 1, wx.LEFT|wx.RIGHT, 5) femSizer.Add(s2Sizer, 1, wx.EXPAND) # Volatility label femSizer.Add(vlabel, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) # the lower and upper S1 bounds are in a sub-sizer volSizer = wx.BoxSizer(wx.HORIZONTAL) volSizer.Add(self.v1vol, 1) volSizer.Add((10,10)) # some empty space volSizer.Add(self.v2vol, 1, wx.LEFT|wx.RIGHT, 5) femSizer.Add(volSizer, 1, wx.EXPAND) # Risk free Rate and corelation femSizer.Add(prlab
Re: wxPython and how to return text entry to main program?
Hi Mike: I actually just picked up the wxPython in Action book the other day and my main class is a hack of his "realworld_print.py" program, with some added bells and whistles. I will try to post on the wxPython mailing list and let them have a go at it. Cheers, tyler -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython and how to return text entry to main program?
Thanks everyone for your help! Cheers, t. -- http://mail.python.org/mailman/listinfo/python-list
vtkStructuredGrid usage question in MayaVi
Hello All: I hope this is a simple question, but I can't seem to figure it out. I am using MayaVi to visualize some data. I have finally manged to get the data to plot, but the axes are weird, and the scaling of the image is way off. I have been fooling around with the command below. grid = pyvtk.StructuredPoints((nex1,nex1,1), (0,s1high,0), (2, 2, 0.2)) This seems to be the key to having the data plotted nicely (scaled properly, axes numbered correctly, etc.). However, I cannot figure out what each of the tuples are for. Does anyone know? This would be a huge help for me. Thanks, Tyler -- http://mail.python.org/mailman/listinfo/python-list
Re: vtkStructuredGrid usage question in MayaVi
Just found it Still not sure what the third entries are, but it's a start! # create a vtk data file sp = pyvtk.StructuredPoints ((nx, ny, 1), (xmin, ymin, 0), (dx, dy, 1)) pd = pyvtk.PointData(pyvtk.Scalars(z, name='Scalars', lookup_table="default")) Tyler -- http://mail.python.org/mailman/listinfo/python-list
Reading Fortran Data
Hello All: After trying to find an open source alternative to Matlab (or IDL), I am currently getting acquainted with Python and, in particular SciPy, NumPy, and Matplotlib. While I await the delivery of Travis Oliphant's NumPy manual, I have a quick question (hopefully) regarding how to read in Fortran written data. The data files are not binary, but ASCII text files with no formatting and mixed data types (strings, integers, floats). For example, I have the following write statements in my Fortran code: I write the files as such: WRITE(90,'(A30)') fgeo_name WRITE(90,'(A30)') fmed_name WRITE(90,*) nfault,npoint WRITE(90,*) (xpt(n), n=1,npoint) WRITE(90,*) (ypt(n), n=1,npoint) and, WRITE(10,'(A30)') fname DO i=1,nfault WRITE(10,*) dbn(i),dtn(i),xfwnt(i),yfwnt(i),xfent(i),yfent(i),& &slpvlS(i),slpvlD(i),slpvlT(i),segdp1(i) END DO I then respectively read them into Fortran as: READ(70,'(A30)') fgeo_name READ(70,'(A30)') fmed_name READ(70,*) nfault,npoint READ(70,*) (x(n), n=1,npoint) READ(70,*) (y(n), n=1,npoint) and, READ(20,'(A30)') fname DO i=1,nfault READ(20,*) dbn(i),dtn(i),xfwnt(i),yfwnt(i),xfent(i),yfent(i),& &slpvlS(i),slpvlD(i),slpvlT(i),segdp1(i) END DO I also read them into IDL for visualization using the "READF" command. I was wondering how I might go about reading this into Python using NumPy. If this is not trivial, let me know and I'll just wait until the NumPy manual arrives. Cheers, t. -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading Fortran Data
Wow! Thanks for the help everyone. I will look into each of your comments in more detail in the morning, but I'll mention a few things I guess. The first is, the list-directed output was not necesarily my choice as some of the code is also used by my supervisor (and her colleagues) and I had to keep the IO similar. However, for "non-legacy" codes (even though is was upgraded to Fortran90), I can ensure you that I will employ a more portable format. Also, I am very interested in the Scientific.IO module mentioned and will look into it further along with f2py. Once again, I thank all of you for your replies, I think I even learnt a few things about Fortran here too Cheers, t. -- http://mail.python.org/mailman/listinfo/python-list
f2py and Fortran90 gfortran_filename error
Hello All: Since my last post I have attempted to use the f2py program which comes with numpy. I am able to create a .so file fine; however, when I import it into Python, I receive the following message: >>> import matsolve2 Traceback (most recent call last): File "", line 1, in ? ImportError: ./matsolve2.so: undefined symbol: _gfortran_filename The steps I used to create the matsolve2.so file are as follows: (1) Created a Fortran90 program matsolve.f90 Note: The program compiles fine and prints the proper output for the simple matrix specified. I have also attached below the file matsolve.f90 if it helps at all. (2) f2py matsolve.f90 -m matsolve2 -h matsolve2.pyf (3) f2py -c matsolve2.pyf --f90exec=/usr/bin/gfortran matsolve.f90 Note: I had to specify the f90 path as f2py did not automatically find it. Any suggestions are greatly appreciated. Cheers, t. ! MATSOLVE.f90 ! ! Start main program PROGRAM MATSOLVE IMPLICIT NONE INTEGER,PARAMETER :: n=3 INTEGER :: i,j REAL,DIMENSION(n) :: x,b REAL,DIMENSION(n,n) :: A,L,U ! Initialize the vectors and matrices with a test case from text ! Using the one given in Appendix A from Thompson. ! Known vector "b" b(1) = 12. b(2) = 11. b(3) = 2. ! Known coefficient matrix "A", and initialize L and U DO i=1,n DO j=1,n L(i,j) = 0. U(i,j) = 0. END DO END DO A(1,1) = 3. A(1,2) = -1. A(1,3) = 2. A(2,1) = 1. A(2,2) = 2. A(2,3) = 3. A(3,1) = 2. A(3,2) = -2. A(3,3) = -1. ! Call subroutine to create L and U matrices from A CALL lumake(L,U,A,n) ! Print results PRINT *, '---' DO i=1,n DO j=1,n PRINT *, i, j, A(i,j), L(i,j), U(i,j) END DO END DO PRINT *, '---' ! Call subroutine to solve for "x" using L and U CALL lusolve(x,L,U,b,n) ! Print results PRINT *, '---' DO i=1,n PRINT *, i, x(i) END DO PRINT *, '---' END PROGRAM MATSOLVE ! Create subroutine to make L and U matrices SUBROUTINE lumake(LL,UU,AA,n1) IMPLICIT NONE INTEGER,PARAMETER :: n=3 INTEGER :: i,j,k REAL :: LUSUM INTEGER,INTENT(IN) :: n1 REAL,DIMENSION(n,n),INTENT(IN) :: AA REAL,DIMENSION(n,n),INTENT(OUT) :: LL,UU ! We first note that the diagonal in our UPPER matrix is ! going to be UU(j,j) = 1.0, this allows us to initialize ! the first set of expressions UU(1,1) = 1. ! Find first column of LL DO i = 1,n1 LL(i,1) = AA(i,1)/UU(1,1) END DO ! Now find first row of UU DO j = 2,n1 UU(1,j) = AA(1,j)/LL(1,1) END DO ! Now find middle LL elements DO j = 2,n1 DO i = j,n1 LUSUM = 0. DO k = 1,j-1 LUSUM = LUSUM + LL(i,k)*UU(k,j) END DO LL(i,j) = AA(i,j) - LUSUM END DO ! Set Diagonal UU UU(j,j) = 1. ! Now find middle UU elements DO i = j+1,n1 LUSUM = 0. DO k = 1,j-1 LUSUM = LUSUM + LL(j,k)*UU(k,i) END DO UU(j,i) = (AA(j,i) - LUSUM)/LL(j,j) END DO END DO END SUBROUTINE lumake ! Make subroutine to solve for x SUBROUTINE lusolve(xx,L2,U2,bb,n2) IMPLICIT NONE INTEGER,PARAMETER :: n=3 INTEGER :: i,j,k REAL :: LYSUM,UXSUM REAL,DIMENSION(n):: y INTEGER,INTENT(IN) :: n2 REAL,DIMENSION(n),INTENT(IN) :: bb REAL,DIMENSION(n,n),INTENT(IN) :: L2,U2 REAL,DIMENSION(n),INTENT(OUT) :: xx ! Initialize DO i=1,n2 y(i) = 0. xx(i) = 0. END DO ! Solve L.y = b y(1) = bb(1)/L2(1,1) DO i = 2,n2 LYSUM = 0. DO k = 1,i-1 LYSUM = LYSUM + L2(i,k)*y(k) END DO y(i) = (bb(i) - LYSUM)/L2(i,i) END DO ! Now do back subsitution for U.x = y xx(n2) = y(n2)/U2(n2,n2) DO j = n2-1,1,-1 UXSUM = 0. DO k = j+1,n2 UXSUM = UXSUM + U2(j,k)*xx(k) END DO xx(j) = y(j) - UXSUM END DO END SUBROUTINE lusolve -- http://mail.python.org/mailman/listinfo/python-list
Re: f2py and Fortran90 gfortran_filename error
On Feb 28, 12:40 am, Robert Kern <[EMAIL PROTECTED]> wrote: > Tyler wrote: > > Hello All: > > > Since my last post I have attempted to use the f2py program which > > comes with numpy. > > It's better to ask these questions on numpy-discussion, instead. There are > more > f2py users per capita there. > > http://www.scipy.org/Mailing_Lists > > > > > I am able to create a .so file fine; > > however, when I import it into Python, I receive the following > > message: > > >>>> import matsolve2 > > Traceback (most recent call last): > > File "", line 1, in ? > > ImportError: ./matsolve2.so: undefined symbol: _gfortran_filename > > > The steps I used to create the matsolve2.so file are as follows: > > > (1) Created a Fortran90 program matsolve.f90 > > > Note: The program compiles fine and prints the proper output for the > > simple matrix specified. I have also attached below the file > > matsolve.f90 if it helps at all. > > > (2) f2py matsolve.f90 -m matsolve2 -h matsolve2.pyf > > (3) f2py -c matsolve2.pyf --f90exec=/usr/bin/gfortran matsolve.f90 > > > Note: I had to specify the f90 path as f2py did not automatically find > > it. > > You want to specify the *kind* of Fortran compiler such that f2py knows what > compile/link flags to use. Only use the --f90exec option to inform f2py that > the > actual executable is named something odd or is in an unexpected place, like > /opt/gfortran/bin/gfortran-4.3, for example. The correct option to use is > > --fcompiler=gnu95 > > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harmless enigma > that is made terrible by our own mad attempt to interpret it as though it had > an underlying truth." > -- Umberto Eco Hi Robert: Thanks for the advice and I'll try posting to the mailing list you mentioned. For what it's worth, the option, --fcompiler=gnu95 yileds the following error in the second calling of f2py: error: don't know how to compile Fortran code on platform 'posix' with 'gnu95' compiler. Supported compilers are: compaq,absoft,intel,gnu,sun,f,vast,ibm,lahey,intelv,intele,pg,compaqv,mips,hpux,intelev,nag) Cheers, t. -- http://mail.python.org/mailman/listinfo/python-list
Parse each line by character location
Hello All: I hope this is the right place to ask, but I am trying to come up with a way to parse each line of a file. Unfortunately, the file is neither comma, nor tab, nor space delimited. Rather, the character locations imply what field it is. For example: The first ten characters would be the record number, the next character is the client type, the next ten characters are a volume, and the next three are order type, and the last character would be an optional type depending on the order type. The lines are somewhat more complicated, but they work like that, and not all have to be populated, in that they may contain spaces. For example, the order number may be 2345, and it is space padded at the beginning of the line, and other might be zero padded in the front. Imagine I have a line: __2345H30_NC_ where the underscores indicate a space. I then want to map this to: 2345,H,30,NC, In other words, I want to preserve ALL of the fields, but map to something that awk could easily cut up afterwords, or open in a CSV editor. I am unsure how to place the commas based on character location. Any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Re: Parse each line by character location
Wow! Thanks for the suggestions everyone. Cheers, t. -- http://mail.python.org/mailman/listinfo/python-list
Re: Parse each line by character location
> So you have a classic (especially for COBOL and older FORTRAN) fixed > field record layout, no? Exactly, I believe COBOL. It is a daily reconciliation with an exchange and our system's orders. One of the problems of dealing with these old legacy systems that never seem to go away > > I presume the entire file is of a single layout? That would mean > only one splitting format is needed... Again, correct, I only need the one format as it does not change. I want to move it to a csv file because the application that we are implementing reads these natively, and does not have a built in mechanism to parse a file like this effectively. Further, this will allow me to add some other fields for our own use. As such, the final file will look somewhat different, but this step kinda threw me. I started out with AWK, and didn't know whether to laugh or cry. Thankfully, I was able to convince the "guys" to allow me to install Python on my dev workstation (although already on production SUSE servers). Cheers, t. -- http://mail.python.org/mailman/listinfo/python-list
Specifying an API for a straeming parser
Howdy folks, I'm working on a JSON Python module [1] and I'm struggling with an appropriate syntax for dealing with incrementally parsing streams of data as they come in (off a socket or file object). The underlying C-level parsing library that I'm using (Yajl [2]) already uses a callback system internally for handling such things, but I'm worried about: * Ease of use, simplicity * Python method invocation overhead going from C back into Python One of the ideas I've had is to "iterparse" a la: >>> for k, v in yajl.iterloads(fp): ... print ('key, value', k, v) >>> Effectively building a generator for the JSON string coming off of the `fp` object and when generator.next() is called reading more of the stream object. This has some shortcomings however: * For JSON like: '''{"rc":0,"data":}''' the iterloads() function would block for some time when processing the value of the "data" key. * Presumes the developer has prior knowledge of the kind of JSON strings being passed in I've searched around, following this "iterloads" notion, for a tree-generator and I came up with nothing. Any suggestions on how to accomplish iterloads, or perhaps a suggestion for a more sensible syntax for incrementally parsing objects from the stream and passing them up into Python? Cheers, -R. Tyler Ballance -- Jabber: rty...@jabber.org GitHub: http://github.com/rtyler Twitter: http://twitter.com/agentdero Blog: http://unethicalblogger.com [1] http://github.com/rtyler/py-yajl [2] http://lloyd.github.com/yajl/ pgpGivehhqfe6.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
Re: When to use mechanize and Windmill library during WebScraping ?
On Fri, 11 Dec 2009, Raji Seetharaman wrote: > Hi > > For 'Webscraping with Python' mechanize or urllib2 and windmill or selenium > libraries are used to download the webpages. > > http://www.packtpub.com/article/web-scraping-with-python Be sure to look at Scrapy too: http://scrapy.org Cheers, -R. Tyler Ballance -- Jabber: rty...@jabber.org GitHub: http://github.com/rtyler Twitter: http://twitter.com/agentdero Blog: http://unethicalblogger.com pgpBd1omxDfvT.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list
code review
Hello all: I was curious if someone wouldn't mind poking at some code. I have an idea for a game I want to write (and if this works I want to use this as a framework for another project), but I'd like to make sure I'm doing things correctly/there's not a better way to do things. My concern is I'm going to get way far into this, then realize I totally broke something. So, if someone wouldn't mind taking a peek I'd appreciate it. My concerns are: 1) style/cleanlyness: does everything look ok? 2) Workability: is there a better way to do what is there? 3) Speed: am I doing something that could be improved? I don't want to spend a ton of time looking for non-existent bottlenecks and trying to improve on them, but if I'm doing something that's bad, I'd like to fix it. The project page is at: http://code.google.com/p/pymud Any information is greatly appreciated. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: code review
On 6/29/2012 2:14 AM, Serhiy Storchaka wrote: The project page is at: http://code.google.com/p/pymud Any information is greatly appreciated. Do you mean No, I mean http://code.google.com/p/pymud -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: code review
On 6/29/2012 1:31 AM, Steven D'Aprano wrote: On Thu, 28 Jun 2012 20:58:15 -0700, alex23 wrote: On Jun 29, 12:57 pm, "Littlefield, Tyler" wrote: I was curious if someone wouldn't mind poking at some code. The project page is at:http://code.google.com/p/pymud Any information is greatly appreciated. I couldn't find any actual code at that site, the git repository is currently empty. OOPS, sorry. Apparently I'm not as good with git as I thought. Everything's in the repo now. -- http://mail.python.org/mailman/listinfo/python-list
Re: code review
I am no expert but from what have picked up so far from x import is frowned upon in most cases also this section in main strikes me as a bit odd and convoluted w = world() serv = server(client) w.server = serv serv.world = w I think you are cross referencing classes & would be better to investigate inheritance. From what I understand and how I've always employed it, inheritance is ment when you wish to give a class characteristics of another class. All I'm doing here is setting the world and server classes on each other, so they can call one another. This probably isn't needed in case of serv.server = w, but for sure the other way around. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: code review
On 7/3/2012 10:55 PM, Simon Cropper wrote: Some questions to Tyler Littlefield, who started this thread. Q1 -- Did you get any constructive feedback on your code? I did get some, which I appreciated. someone mentioned using PyLint. From reading, I found it was really really pedantic, so I used PyFlakes instead. Q2 -- Did you feel that the process of submitting your code for review met your expectation? There wasn't much more to review, so yes. The info I got was helpful and farther than it was before I started. Q3 -- Would you recommend others doing this either on this forum or other fora? It appears to me - third party watching the ongoing dialog - that the tread has gone right off topic (some time ago) and someone should really start a new thread under a new title/subject. Most of what I have read does not appear to be discussing your code or how you could improve your code. I basically just stopped after a while. It got into a my language is better than your language, so I didn't see much constructive info. I've started reading from the bottom though, where it looks like it's back, and I do appreciate the rest of the info given, as well. Thanks again for the feedback. Following the last few posts, I was wondering whether some other off-list dialog is going on or whether I am missing something. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
modeling complex data with sqlalchemy
Hello all: I had a quick question. In my game, I have an is-a setup, where all objects contain data like an id for sqlalchemy, a name, a description and a list of contents. In order to add functionality to an object, you add components. So for example, a player would have the Player and Living component associated with the basic object. It's sort of a way to give myself a way to add functionality without having a lot of multiple inheritance. This creates a problem for me though, since it looks like each component would have it's own table. How would you go about modeling the 1:n relationship between entity and each component? Also, I'm going to have a location property on the object, which is basically it's location (a reference to another Entity), or None if it has no parent. How would you set that up in SA so that location gets translated to an ID and then translated back to the required object? Might there be another easier way to model all this data? It looks like this database could get rather large, extremely quickly. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: VPS For Python
On 8/26/2012 1:41 AM, coldfire wrote: I will really appreciate if someone type the address of any of the following for use with python 1>Webhost 2>Shell Account 3>VPS I love Linode, it's amazing and you get decent resources for a decent price. If you sign up, I'd really appreciate it if you used my code. They also have a realloygood library at linode.com/library to show you how to set a lot of stuff up. http://www.linode.com/?r=7858d151c1ea11c0ce9a1398865b1cc7ad28c19f I am really new to all this Got web server and shell account but unable to figure out how to use it or deploy the Code, My problem is that I m using lot of third party Library which are mostly not supported or I don't know How to make it RUN over Internet -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: modeling complex data with sqlalchemy
Hello: Thanks for the info. IT doesn't really model the data I wanted. The contents was easy enough, I'm just going to set up a 1:n relationship on the Entity to the actual player. But for components, it's a bit different. Each component inherits the actual Component class, and has a number of attributes on it. I can't just put it in it's own. So I was going to set up a table per component and then just store an id and another id for what holds it. But my problem is modeling it. I also need the inherited data from Component. Would there be a way to do this? I could have: id, name, component_id and then SA could use the name as the table's name, and the id as the id of the component in the other table. How would I set this up with SA? Is it a good idea to go this route? On 8/25/2012 5:53 PM, Dennis Lee Bieber wrote: On Sat, 25 Aug 2012 14:47:35 -0600, "Littlefield, Tyler" declaimed the following in gmane.comp.python.general: Hello all: I had a quick question. In my game, I have an is-a setup, where all objects contain data like an id for sqlalchemy, a name, a description and a list of contents. Well, a "list of contents" comes down to a table of items with a foreign key to the item "containing" them... create table objects ( ID integer auto-increment primary key, namevarchar(?), description varchar(?) ) 1, Wulfraed, something or other 2, Bag of Holding, whatever 3, Sword, some cutting comments 4, Treasure Chest, everyone wants one create table holdings ( ID integer auto-increment primary key, holder integer foreign key objects(ID), holding integer foreign key objects(ID) ) 1, 1, 2 2, 1, 3 3, 2, 4 In order to add functionality to an object, you add components. So for example, a player would have the Player and Living component associated create table attribute_types ( ID integer auto-increment primary key, namevarchar(?), typechar(?),#or an enumeration if supported by the RDBM #and SQLAlchemy ) 1, Player, Boolean 2, Living, Boolean 3, EdgeWeapon, Boolean 4, Damage, DieRoll 5, ContainerSize, Integer 6, Class, Text create table attributes ( ID integer auto-increment primary key, describes integer foreign key objects(ID), attribute integer foreign key attribute_types(ID), value BLOB(?) ) 1, 1, 1, blob(True) 2, 1, 2, blob(True) 3, 3, 3, blob(True) 4, 3, 4, blob("1D8 + 4") 5, 2, 5, blob(-1) #-1 being unlimited, bag of holding 6, 4, 5, blob(6)#treasure chest holds 6 units of objects 7, 1, 6, blob("Ranger") Now, you could add another layer of indirection -- a table of pre-defined object /types/ (different types of containers, swords, other weapons), and have each instance (the ones shown in "objects") refer to the object type table, and the object type table is what the object attributes refers to. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
using uwsgi to get flask going
Hello all: This is my first shot with UWSGI and Python on Nginx, and I'm getting kind of confused. My uwsgi init script looks like: #!/bin/sh #/etc/init.d/uwsgi ### BEGIN INIT INFO # Provides: uwsgi # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO PID="/var/run/uwsgi/uwsgi.pid" SOCKET="/var/run/uwsgi/uwsgi.sock" DAEMON="/usr/local/bin/uwsgi" LOGFILE="/var/log/uwsgi.log" ARGS="--master --socket $SOCKET -d --workers 4 --pidfile $PID --vacuum --max-requests 400 --gid uwsgi --uid uwsgi --logto2 $LOGFILE --chdir2 /opt/nginx/html/falcon -w app:app" case "$1" in start) echo "Starting uwsgi" touch $SOCKET touch $LOGFILE chown uwsgi:uwsgi $LOGFILE chmod 660 $LOGFILE chown -R www-data:uwsgi $SOCKET chmod 660 $SOCKET start-stop-daemon -p $PID --start --exec $DAEMON -- $ARGS ;; stop) echo "Stopping uwsgi." start-stop-daemon --signal INT -p $PID --stop $DAEMON -- $ARGS ;; restart) echo "Stopping uwsgi." start-stop-daemon --signal INT -p $PID --stop $DAEMON -- $ARGS echo "Starting uwsgi" start-stop-daemon -p $PID --start --exec $DAEMON -- $ARGS ;; *) echo "Usage: /etc/init.d/uwsgi stop|stop|restart." exit 1 ;; esac I'm trying to chdir so I can use app:app (ap.py is the script, app is the application in app.py). From what I understand, uwsgi just spawns a Python process and runs app.py to handle requests? It doesn't spawn a process per instance? How easy would it be to force it to use PyPy for example? Also my nginx config: server { server_name www.dev.tds-solutions.net dev.tds-solutions.net; listen 80; access_log logs/dev.access.log; location / { root html/falcon; index index.html index.htm; try_files $uri @uwsgi; } location ~ /\.ht { deny all; } location @uwsgi { include /opt/nginx/conf/uwsgi_params; uwsgi_pass unix:/var/run/uwsgi/uwsgi.sock; } } anyone see anything wrong? Any info would be greatly appreciated. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
request for another code review
Hello all: I've gotten a bit farther into my python mud, and wanted to request another code review for style and the like. Mainly I'm concerned about player.py, world.py and components and other ways to handle what I'm trying to do. I didn't run pychecker just yet, so there are probably a ton of syntax errors; my problem was that world was importing room, and room imported world for functionality and that made things a mess. Ideas and suggestions for code cleanup and cleaner ways to do things would be appreciated. git clone https://code.google.com/p/pymud/ Thanks, -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: List Problem
On 9/23/2012 3:44 PM, jimbo1qaz wrote: On Sunday, September 23, 2012 2:31:48 PM UTC-7, jimbo1qaz wrote: I have a nested list. Whenever I make a copy of the list, changes in one affect the other, even when I use list(orig) or even copy the sublists one by one. I have to manually copy each cell over for it to work. Link to broken code: http://jimbopy.pastebay.net/1090401 No, actually that's the OK code. http://jimbopy.pastebay.net/1090494 is the broken one. I've not been following this thread fully, but why not just use x=list(y) to copy the list? The issue is that when you assign i=[1,2,3] and then j = i, j is just a reference to i, which is why you change either and the other changes. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
keeping information about players around
ytHello all: I've asked for a couple code reviews lately on a mud I've been working on, to kind of help me with ideas and a better design. I have yet another design question. In my mud, zones are basically objects that manage a collection of rooms; For example, a town would be it's own zone. It holds information like maxRooms, the list of rooms as well as some other data like player owners and access flags. The access flags basically is a list holding the uid of a player, as well as a bitarray of permissions on that zone. For example, a player might have the ability to edit a zone, but not create rooms. So I have a couple of questions based on this: First, how viable would it be to keep a sort of player database around with stats and that? It could contain the player's level, as well as other information like their access (player, admin, builder etc), and then when someone does a whois on the player I don't have to load that player up just to get data about them. How would I keep the information updated? When I delete a player, I could just delete the entry from the database by uid. Second, would it be viable to have both the name and the uid stored in the dictionary? Then I could look up by either of those? Also, I have a couple more general-purpose questions relating to the mud. When I load a zone, a list of rooms get stored on the zone, as well as world. I thought it might make sense to store references to objects located somewhere else but also on the world in WeakValueDictionaries to save memory. It prevents them from being kept around (and thus having to be deleted from the world when they lose their life), but also (I hope) will save memory. Is a weakref going to be less expensive than a full reference? Second, I want to set up scripting so that you can script events for rooms and npcs. For example, I plan to make some type of event system, so that each type of object gets their own events. For example, when a player walks into a room, they could trigger some sort of trap that would poison them. This leads to a question though: I can store scripting on objects or in separate files, but how is that generally associated and executed? Finally, I just want to make sure I'm doing things right. When I store data, I just pickle it all, then load it back up again. My world object has an attribute defined on it called picklevars, which is basically a list of variables to pickle, and my __getstate__ just returns a dictionary of those. All other objects are left "as-is" for now. Zones, (the entire zone and all it's rooms) get pickled, as well as players and then the world object for persistence. Is this the suggested way of doing things? I'll also pickle the HelpManager object, which will basically contain a list of helpfiles that can be accessed, along with their contents. Thanks, and appologies for all the questions. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: request for another code review
On 9/23/2012 9:48 PM, alex23 wrote: On Sep 23, 6:14 am, "Littlefield, Tyler" wrote: I've gotten a bit farther into my python mud, and wanted to request another code review for style and the like. Are you familiar with codereview.stackexchange.com ? I actually wasn't, thanks! (This isn't to dissuade you from posting such requests here, just to help increase the chance of eyeballs on your code.) -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: request for another code review
On 9/23/2012 9:48 PM, alex23 wrote: On Sep 23, 6:14 am, "Littlefield, Tyler" wrote: I've gotten a bit farther into my python mud, and wanted to request another code review for style and the like. Are you familiar with codereview.stackexchange.com ? I actually wasn't, thanks! (This isn't to dissuade you from posting such requests here, just to help increase the chance of eyeballs on your code.) -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: keeping information about players around
On 9/24/2012 3:14 PM, Dwight Hutto wrote: I have yet another design question. In my mud, zones are basically objects that manage a collection of rooms; For example, a town would be it's own zone. It holds information like maxRooms, the list of rooms as well as some other data like player owners and access flags. The access flags basically is a list holding the uid of a player, as well as a bitarray of permissions on that zone. For example, a player might have the ability to edit a zone, but not create rooms. So I have a couple of questions based on this: First, how viable would it be to keep a sort of player database around with stats and that? Well, what are the main items you need to retain for the player to return to the game? All of their contents are stored, which right now is done through Pickle. The stats is something different, as like I said, I don't want to unpickle an object every time I for example look at a zone and see what players have permissions on it. Also, If this is a browser app I'd go with phpmyadmin, and MySQL If a tkinter/wxpython/etc app, then maybe sqlite. PHPMyAdmin? Might I ask why? This is a mud, so it's all command based, so that's not even a question, but I'm kind of curious how PHPMyAdmin factors in there. It's a database creation tool from all I've ever seen of it, to define tables. Also, using it requires that I have it up on some server or another, and I'd really rather avoid that if I can. It could contain the player's level, as well as other information like their access (player, admin, builder etc), and then when someone does a whois on the player I don't have to load that player up just to get data about them. How would I keep the information updated? When I delete a player, I could just delete the entry from the database by uid. Second, would it be viable to have both the name and the uid stored in the dictionary? Then I could look up by either of those? Why would you use a dictionary, when it's DB manipulation you're after? It is? I don't remember mentioning database anything in my thread. Unless I missed it, I mentioned pickle once or twice. But either way, I'd use a dictionary to keep a copy of {uid:object} for objects and {uid:player} for players. Makes lookup by uid pretty easy, as well as for any loaded objects. Also, I have a couple more general-purpose questions relating to the mud. When I load a zone, a list of rooms get stored on the zone, as well as world. I thought it might make sense to store references to objects located somewhere else but also on the world in WeakValueDictionaries to save memory. It prevents them from being kept around (and thus having to be deleted from the world when they lose their life), but also (I hope) will save memory. Is a weakref going to be less expensive than a full reference? For any case, you're going to have a DB field with a value, so it doesn't look like a high value memory cost in the DB. Second, I want to set up scripting so that you can script events for rooms and npcs. For example, I plan to make some type of event system, so that each type of object gets their own events. For example, when a player walks into a room, they could trigger some sort of trap that would poison them. This leads to a question though: I can store scripting on objects or in separate files, but how is that generally associated and executed? Well, the event doesn't need to be stored unless there is a necessity to store the event, but if it's poisoned, then it's just a life penalty, then no need to store the event, just the score loss. I was asking about scripting the rooms, more than storing it. I need to have python code somewhere, somehow that attaches to the onEnter event in a room and subtracts hp from the player. Obviously you want that to be object specific and not have that script on everything. Finally, I just want to make sure I'm doing things right. When I store data, I just pickle it all, then load it back up again. My world object has an attribute defined on it called picklevars, which is basically a list of variables to pickle, and my __getstate__ just returns a dictionary of those. All other objects are left "as-is" for now. Zones, (the entire zone and all it's rooms) get pickled, as well as players and then the world object for persistence. Is this the suggested way of doing things? I'll also pickle the HelpManager object, which will basically contain a list of helpfiles that I might suggest you take a look at the Blender Game Engine(python API) at this point, unless you're just liking doing it the hard way to gain experience(just like I have). That's cool I guess, but I'm not taking your road and doing it the hard way for experience. The setup is more of a game engine, but beyond that, I don't think I need everything i get from a game library, especially since IIRC, Blender is mainly 3d focused? Design the DB, and let the scene render what needs to be rendered, or list d
Re: For Counter Variable
On 9/24/2012 6:25 PM, Dwight Hutto wrote: To highlight the vast gulf between what you think you are and what you actually produce. I produce working code, and if it works, then I don't just think...I know. Working code != good code. Just an observation. Also, I've noticed a vast differences between someone who can explain their answers as Alix has done on multiple threads you've replied to in the last 5 minutes, and someone who cobbles something together with "your variable isn't being shown right because there's no self.a," which actually really makes no sense at all. Just my $0.02. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: Who's laughing at my responses, and who's not?
On 9/24/2012 10:43 PM, Dwight Hutto wrote: It sounds pretentious, but over the past several days, I've been slammed on every post almost. All because of an argument over me not posting a little context in a conversation, that seemed short and chatty. I was just wondering, if it's just them, or if it's my netiquette. I think you'd have a leg to stand on here if you didn't start cursing at anyone who got on your wrong side. It wasn't really an issue until you threw that up. Granted you did take your cursing off list finally, but you still continued (and as of about 2 hours ago) continue to post trash like you did in response to Alix's message. If you want to argue something, by all means argue. But there's no need to resort to comments like you've made. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: new-style class or old-style class?
On 9/25/2012 8:44 AM, Jayden wrote: In learning Python, I found there are two types of classes? Which one are widely used in new Python code? Is the new-style much better than old-style? Thanks!! Perhaps this is useful: http://docs.python.org/reference/datamodel.html It's 3.3 I think. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
google api and oauth2
Hello all: I've been trying to figure out the oauth2client part of google's api, and I am really confused. It shows a flow, and even with the client flow, you need a redirect uri. This isn't important because I just want to get both an access and refresh token. Has anyone had any experience with this? Is it easier to use a more developed oauth2 library to handle this? If so, can anyone make any suggestions? If I understand everything correctly, it doesn't matter what library I would use to work with the oauth2 protocol, so I could break out of this workflow thing that looks like it's more designed for web apps. Finally, they caution you about being careful about your client id and your client secret; is there much in the way of obviscation or something I can do to keep this secret? -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: google api and oauth2
On 9/25/2012 2:05 PM, Demian Brecht wrote: This is a shameless plug, but if you want a much easier to understand method of accessing protected resources via OAuth2, I have a 55 LOC client implementation with docs and examples here:https://github.com/demianbrecht/sanction (Google is one of the tested providers with an access example). No complaints from me if it works. Honestly I was a bit discouraged at Google's decent lack of documentation and the quality of the code. Are you trying to access resources client side (through Javascript) or server side? Either way, the redirect URI *is* important. The first step is to have your user authorize your application using Google's authorization page. As one of the query parameters, you must specify the redirect URI (which must match those registered through Google's app console). I'm trying to access it through a desktop Python application, which made me really confused. There was something else that talked about returning the tokens in a different way, but it talked about returning them in the title of the webpage, and since I'd be spawning a browser to request authorization, I'd have to write something that would pull the window information and then parse out the token from the title, which doesn't sound to stable. Once the user has authorized your application, they're redirected back to your site (via the specified redirect URI), with a "code" attached as a query param. Once you get that code, you must exchange that with Google's token endpoint to retrieve the access and refresh tokens. Awesome. I could theoretically just create a webpage on my server to redirect people to with the query, but I'm still not quite sure how I'd retrieve that from the desktop application. No, it doesn't matter which library you use. Google's (imho) is overly verbose and difficult to grok (especially for someone new to either OAuth 2.0 or Python, or both). The client ID doesn't need to be kept private, but the secret does. You should *never* put this anywhere that can be read publicly. I plan on storing them both in variables. It's not going to be the best solution, but I plan to use python -O to create pyo files, which from what I understand are harder to decompile, and it'll be in a py2exe executable. Still not to hard to get at, but it's not right there either. On Tue, Sep 25, 2012 at 12:04 PM, Littlefield, Tyler mailto:ty...@tysdomain.com>> wrote: Hello all: I've been trying to figure out the oauth2client part of google's api, and I am really confused. It shows a flow, and even with the client flow, you need a redirect uri. This isn't important because I just want to get both an access and refresh token. Has anyone had any experience with this? Is it easier to use a more developed oauth2 library to handle this? If so, can anyone make any suggestions? If I understand everything correctly, it doesn't matter what library I would use to work with the oauth2 protocol, so I could break out of this workflow thing that looks like it's more designed for web apps. Finally, they caution you about being careful about your client id and your client secret; is there much in the way of obviscation or something I can do to keep this secret? -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: Article on the future of Python
On 9/26/2012 2:11 AM, Dwight Hutto wrote: Well, we can all use american as a standard, or maybe you'd prefer to borrow my Latin for Idiots handbook. But then again google has a Universal Communicator going, so, does it matter? Never in the field of human discussion has there been so much reason for so many to plonk so few. "Plonk" it if you want. Your homosexual ideologies have no effect on me. Butt, back to the discussion, there are quite a few ways to encode, as well as translate code. You remind me of a little kid. When anything doesn't go your way, we revert to homosexual comments (who said anything about homosexual anyway), and you keep bringing up this whole nut hair deal. I think it's you leaning that way buddy, especially since "most of us on here are guys." Plonk it in your mouth, and let the nut hairs tickle your throat. Take your trash somewhere else. You've provided nothing in terms of good feedback or responses, and I doubt you will provide more than insults. PS: Anyone know if rantingrik had relatives? ;) ChrisA -- http://mail.python.org/mailman/listinfo/python-list -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
teventlet: a light-weight method for handling events
Hello all: This was my first PyPi project to create. I'd like some feedback as to whether or not something like this is even moderately useful, and what I could do better with it. The blog article that details some of this is: http://tds-solutions.net/blog/?p=137 And the PyPi page: http://pypi.python.org/pypi/teventlet Essentially, Teventlet is just a handler that allows the registration of multiple callbacks; when something calls invoke, it dispatches all arguments to each individual callback. It's pretty small, and probably something anyone who is reasonably skilled could have written in a few minutes, but I wanted to put it out there anyway. Any ideas, suggestions/etc would be welcome. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: test
On 9/27/2012 3:36 PM, Devin Jeanpierre wrote: On Thu, Sep 27, 2012 at 5:28 PM, ForeverYoung wrote: Please ignore this post. I am testing to see if I can post successfully. Is there a reason you can't wait until you have something to say / ask to see if it works? You're spamming a large number of inboxes with nothing. I'm kind of thinking complaints about it are just doubling the spam to a large number of inboxes. You could've just doubled the spam in the OP's inbox and that would've been that. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: Article on the future of Python
On 9/27/2012 9:05 PM, Jason Friedman wrote: Fair enough, but it's the M in the LAMP stack I object to. I'd much rather have P. +1 I know this isn't the list for database discussions, but I've never gotten a decent answer. I don't know much about either, so I'm kind of curious why postgresql over mysql? -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: Stop feeding the trolls (Was: which a is used?)
On 9/27/2012 10:50 PM, Dwight Hutto wrote: On Fri, Sep 28, 2012 at 12:40 AM, Chris Angelico wrote: On Fri, Sep 28, 2012 at 1:47 PM, Dwight Hutto wrote: [ lots of screed that demonstrates that Dwight hasn't grokked the hacker culture ] Don't hack, but could very well if necessary. You couldn't hack your self out of a wet paper bag, and you're fooling noone. Sorry... buddy. You should go away now; You asked who is laughing at you the other day, and at that point you had the ability to salvage (or at least attempt to salvage) your reputation with a few people. You've pretty much blown that away at this point, so a belated answer to your question is everyone. Dwight, have a read of these documents. They may help you to understand how the python-list community operates, and perhaps more so, why most of the regulars here think the way they do. They have double digit I.Q.'s ? Actually, this may be of interest to quite a few people, so I'll post it on-list. Go right aheadbuddy. http://catb.org/~esr/faqs/ ChrisA -- http://mail.python.org/mailman/listinfo/python-list -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: Article on the future of Python
On 9/27/2012 10:37 PM, Chris Angelico wrote: On Fri, Sep 28, 2012 at 2:12 PM, Greg Donald wrote: On Thu, Sep 27, 2012 at 10:37 PM, Wayne Werner wrote: the only advice I can give on that is just learn to use both. I find there's little to lose in having experience with both. Most every good web framework out there supports lots of different databases through generic ORM layers.. so flipping back and forth to see which database is better for your particular app and workload is trivial. I plan to do that, just so I have both. I've had the experience of mysql, so I guess postgresql is up next. I was just really curious why so many people prefered it. Perhaps off topic (actually really off topic), but if I were to dump my tables from mysql out into flat-files, does postgresql use the same basic structure? IIRC there's a sql98 standard or something like that. Learning both is good, if for no reason than that learning more tends to be advantageous. As Greg said in his other post, PGSQL is a completely open source project. That's a significant point imho. Other points to consider: * MySQL is designed for dynamic web sites, with lots of reading and not too much writing. Its row and table locking system is pretty rudimentary, and it's quite easy for performance to suffer really badly if you don't think about it. But if your needs are simple, MySQL is probably enough. PostgreSQL uses MVCC to avoid locks in many cases. You can happily read from a row while it's being updated; you'll be unaware of the update until it's committed. * Postgres has solid support for advanced features like replication. I don't know how good MySQL's replication is, never tried it. Can't say. This might be completely insignificant. * The default MySQL engine, MyISAM, doesn't do proper transaction logging etc. InnoDB is better for this, but the internal tables (where your database *structure* is maintained) are MyISAM. This imposes a definite risk. You've lost me here; there are two different engines. From what I got from your post, innoDB just essentially wraps MyIsam with some pretty (or apparently not so pretty) locking stuff to help with transactions? * Both engines have good support in popular languages, including (dragging this back on topic, kicking and screaming) Python. For further details, poke around on the web; I'm sure you'll find plenty of good blog posts etc. But as for me and my house, we will have Postgres serve us. Will do, thanks for all the feedback (both on and off list). I'm not a huge database person; I've never really played around with much of it since there's a lot more to understand and I can't just mess with it like any other language, so I was unaware of a lot, and still am in terms of performance. I've obviously seen a ton of blog posts talking about the differences, but they tend to dive into the inner mechanics, something which I don't understand all that well. PS: Someone mentioned my messages were not indented properly; is this still the case? Apparently thunderbird allows ctrl+right bracket to outdent, so I assume my messages should be the outer ones with others being indented farther. ChrisA -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python source code easy to hack?
On 9/28/2012 9:19 AM, stu...@molden.no wrote: kl. 16:38:10 UTC+2 fredag 28. september 2012 skrev Jerry Hill følgende: This is true, but both java and .net are also relatively easy to decompile. Neither of them are very "obfuscated". In general though, why does it matter? Paranoia among managers? What are you trying to protect yourself against? Embarassment? Patent trolls? Unauthorized access to priviledged features? Industrial espionage? Sounds like a web solution is the best way. Use a thin client and run your NSA-level code on a server. It's worth pointing out though that even c/c++ isn't free. If someone wants to decompile or disassemble your code bad enough, it's going to happen. If you must keep anyone from ever seeing how your code works, the only way to do that is to keep all the sensitive bits running on a machine that you control. Indeed :) Sturla -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
design question:game skill system
Hello all: I'm looking at a skill/perk system, where the player builds up his char by using perk points to add abilities. Each perk is under a category, and generally costs go up as you increase the perk. So I'm trying to figure something out; first, I'd really like the cost calculation and all of that to be dynamic, so that I don't have to write a calculateCost per object. I'd also like to be able to specify dependencies and say a level, as well as other factors before a player can obtain a perk and have them self documenting. The idea is that a player could do something like: data perk extended health and it would tell them they require health at 50 before they can purchase extended health, as well as the cost, the increase per level and the total overall cost. Any ideas on how to set this up would be really appreciated. Finally, I'm curious how to store and calculate these. I thought about using a uid per perk, then storing something like: {uid:level} on the player, but means that I have to lookup the name somehow still in the main perk database, then use that uid to check if the player has it. Are there better ways of storing skills? I'm also thinking about calculation; currently the CalculateMaxHp method would have to add up all the possible perks for health, then add stats and all that. That could get really rough on performance if it's called often; would something like a cache work, where you have something like: {attribute:dirty}? So if I call CalculateHealth, it checks for the dirty flag, and if it doesn't exist just returns the previous max HP, but if the dirty flag is set, it recalculates? Then anything modifying health (level gains, perks, stat increases/etc) would just set the dirty flag and call calculate? Thoughts/ideas would be welcome. Thanks, -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
Re: design question:game skill system
I just wanted to say thanks to all the people that provided input, both aonand off list. It gave me a good direction to head in. Thanks again. On 10/2/2012 2:34 PM, Ian Kelly wrote: On Tue, Oct 2, 2012 at 2:00 PM, Littlefield, Tyler wrote: Hello all: I'm looking at a skill/perk system, where the player builds up his char by using perk points to add abilities. Each perk is under a category, and generally costs go up as you increase the perk. So I'm trying to figure something out; first, I'd really like the cost calculation and all of that to be dynamic, so that I don't have to write a calculateCost per object. I'd also like to be able to specify dependencies and say a level, as well as other factors before a player can obtain a perk and have them self documenting. The idea is that a player could do something like: data perk extended health and it would tell them they require health at 50 before they can purchase extended health, as well as the cost, the increase per level and the total overall cost. What are the cost calculations based on? If there are specific formulas then you would need to store them somehow, possibly just as a function to be called or string to be evaled, but if the security of the perk database is of concern then you could engineer a more sandboxed representation. For dependencies, you can keep them in a container. An extended health perk might look something like: cost_formula = "5 * level ** 2" dependencies = {HEALTH: 50, PLAYER_LEVEL: 15} benefits = {HEALTH: "7 * level"} where HEALTH and PLAYER_LEVEL are just some arbitrary known constants. Your core perks library would then be responsible for looking this information up, running the formulas, and performing whatever calculations on it are needed. Finally, I'm curious how to store and calculate these. I thought about using a uid per perk, then storing something like: {uid:level} on the player, but means that I have to lookup the name somehow still in the main perk database, then use that uid to check if the player has it. Are there better ways of storing skills? When you say uids, you mean UUIDs, right? I'm not sure what advantage there is in using abstracted unique identifiers for these. Assuming you have full control over what perks are added, you can ensure there will be no name clashes, so why not just use the name or a name-based tag to uniquely identify each perk? Regardless of how you identify them, though, your code is at some point going to have to go to the database to look them up, so I would suggest you just go ahead and write that code, and then you can add some caching later if it turns out to be needed. I'm also thinking about calculation; currently the CalculateMaxHp method would have to add up all the possible perks for health, then add stats and all that. That could get really rough on performance if it's called often; would something like a cache work, where you have something like: {attribute:dirty}? So if I call CalculateHealth, it checks for the dirty flag, and if it doesn't exist just returns the previous max HP, but if the dirty flag is set, it recalculates? Then anything modifying health (level gains, perks, stat increases/etc) would just set the dirty flag and call calculate? Sounds reasonable. I wouldn't use a separate flag attribute, though. When max HP becomes dirty, clear the cached value, and use the absence of a cached value to inform your code that it needs to recalculate. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
final question: logging to stdout and updating files
pHello all: I've seen frameworks like django reload files when it detects that they've been changed; how hard would it be to make my engine reload files that it detects were changed? I'm also curious how hard it would be to build in some error recovery. For example right now when an exception occurs, the player is sometimes just left hanging. It's a lot harder with Python for me, because I don't get the compile-time errors that I would with c++ for example to know that I did something wrong; while that's not always useful/and by far it doesn't catch everything, it does help. I'm familiar with things like pychecker, but it seems to be reporting a lot of issues that aren't issues. For example, I have a world module which is the core of the engine; it handles players, as well as keeps tracks of all rooms that are loaded in the game and that. Because player and world would have circular imports, I just pass the world object into player functions like logon/create. Pychecker tells me that the world parameter (which is a local var at that point) shadows the world variable in world; world is a singleton, so when you import world it just has a world = World() at the bottom of the module. also: I have the following code: logging.basicConfig(filename=path.join("logs", "mud.log"), level=logging.DEBUG) logger = logging.getLogger(__name__) logger.addHandler(logging.StreamHandler()) I like it displaying to stderr since usually when I'm doing this I'm in screen bouncing back and forth between the output and the tt++ session, but right now I can't get a couple of things; I'm not sure how to set it to log and all other messages to stderr as I did for the file, and I'd like to use a rotating log handler so that it'll rotate when the files are say above 16 KB or something. Is it possible to do something like this; perhaps make it compress the file before it writes to disk, or call a command to do so, so that it wouldn't hang the entire mud while it compresses? Thanks, and sorry again for all the questions. -- Take care, Ty http://tds-solutions.net The aspen project: a barebones light-weight mud engine: http://code.google.com/p/aspenmud He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave. -- http://mail.python.org/mailman/listinfo/python-list
keeping twisted and wxPython in sync
Hello all: I have a couple questions. First, is there a way to know if connectTCP failed? I am writing a client with Twisted and would like to be able to notify the user if they couldn't connect. Second, I set the protocol on my factory after a connection has been made. So when I send my user and password, that is when I connect. Is there a way to handle waiting for the connection to complete? -- Take care, Ty Web: http://tds-solutions.net The Aspen project: a light-weight barebones mud engine http://code.google.com/p/aspenmud Sent from my toaster. -- http://mail.python.org/mailman/listinfo/python-list
Dynamic URL shortening
Hello all: I started working on a project with someone else quite recently, and he has a request. The project requires an URL shortener, and he would like it to be dynamic for both users and developers. Apparently some applications on the mac allow for the user to input some data on a URL shortener and use that specific service to shorten URLS. So I'm curious if anyone has had any experience with this in python/can recommend a library to look at. Secondly, my requirement to make this dynamic for developers. The way I did this was to use a metaclass that the base URLShortener will inherit, which will add itself to a shortener registry. This works well enough, and all I really need to do is something like: shortener = factory.getShortener("bitly") url = shortener.shorten("http://google.com";) How viable is this solution? It seems like it's nice enough, are there other approaches to handling something like this? -- Take care, Ty my website: http://tds-solutions.net my blog: http://tds-solutions.net/blog skype: st8amnd127 My programs don't have bugs; they're randomly added features! -- http://mail.python.org/mailman/listinfo/python-list
parsing packets
Hello all: I'm working on a server that will need to parse packets sent from a client, and construct it's own packets. The setup is something like this: the first two bytes is the type of the packet. So, lets say we have a packet set to connect. There are two types of connect packet: a auth packet and a connect packet. The connect packet then has two bytes with the type, another byte that notes that it is a connect packet, and 4 bytes that contains the version of the client. The auth packet has the two bytes that tells what packet it is, one byte denoting that it is an auth packet, then the username, a NULL character, and a password and a NULL character. With all of this said, I'm kind of curious how I would 1) parse out something like this (I am using twisted, so it'll just be passed to my Receive function), and how I get the length of the packet with multiple NULL values. I'm also looking to build a packet and send it back out, is there something that will allow me to designate two bytes, set individual bits, then put it altogether in a packet to be sent out? -- Take care, Ty my website: http://tds-solutions.net my blog: http://tds-solutions.net/blog skype: st8amnd127 My programs don't have bugs; they're randomly added features! -- http://mail.python.org/mailman/listinfo/python-list
Looking for open-source Python projects to help out with
Hello: I've got a bit of time on my hands, so I'm curious what sorts of projects there are that people needs help with. I'd like to choose something that doesn't have a ton of red tape, but is stable, which is why I ask here instead of just Googling open source projects. My main interests lie in accessibility, Utilities and security. -- Take care, ~Ty Web: http://tds-solutions.net Sent from my toaster. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to structure packages
On 9/7/2011 9:56 AM, bclark76 wrote: I'm learning python, and was playing with structuring packages. Basically I want to have a package called mypackage that defines a number of classes and functions. so I create: mypackage __init__.py myfunc.py MyClass.py my __init__.py is blank. my MyClass.py looks like: import blah class MyClass(blahblah): blah blah blah then I have a run.py that looks like from mypackage import MyClass x = MyClass() This doesn't work because MyClass is mypackage.MyClass.MyClass. There's this MyClass module 'in the way'. You can use the __init__.py to promote that class up. so: from myclass import myclass So that means that myclass will just be in mypackage.myclass, and thus your from mypackage import myclass would work perfectly. I'm not sure if this is how you're supposed to do it, but it works. I'm trying to follow the rule that every file defines only one class. I could define MyClass in __init__.py, but then what if I wanted to define more classes in the mypackage package? My one class per file rule goes out the window. Is this rule wrongheaded, or is there another way to do this? Thanks. -- Take care, Ty Web: http://tds-solutions.net Sent from my toaster. -- http://mail.python.org/mailman/listinfo/python-list
Re: Absolutely Insane Problem with Gmail
>ourEmail = ' myemaila...@gmail.com' >ourEmail = ' q...@xxx.com' You redefine this twice. You also don't define a variable down lower. ># to_address = ourEmail, > from_address = ourEmail, > to_address = emailText, I could be wrong, but emailText isn't defined. Perhaps a better variable naming setup would help you some. so: in short, set up a to_address and from_address, populate those however you need to, then change the variable names. -- http://mail.python.org/mailman/listinfo/python-list
Re: having both dynamic and static variables
> It's worth having some syntax for constants. I'd suggest >using "let": >let PI = 3.1415926535897932384626433832795028841971693993751 in to many languages, let is just a setter. why not just const pye = 3.14... -- http://mail.python.org/mailman/listinfo/python-list
Re: How Translate This PHP
>How do I translate this PHP code? >if($ok){ >echo "returnValue=1"; >}else{ >echo "returnValue=0"; >} print("return value = "+str(ok)); -- http://mail.python.org/mailman/listinfo/python-list
Re: What do you use with Python for GUI programming and why?
Is there a push to one toolkit or the other? TKInter from what I understand comes with Python already. There is also PYGui and WXPython; it really depends on what you want and what you like the best. -- http://mail.python.org/mailman/listinfo/python-list
Re: Pyserial
>The windows msi install fails saying there is no python install found >in the registry. Is there a workaround for this? Can I edit the >registry and manually enter the information? I've came to realize that the 64-bit version of python does not work with 32-bit modules in terms of the installer because the key doesn't exist. Just grab the 32-bit python and you're set with modules. -- http://mail.python.org/mailman/listinfo/python-list
Re: Writing to a file
>with open(test_absname, 'w') as test: what's the difference in that and test = ...? I can see why you mentioned the os.path for cross-platform, but I don't understand why someone would use with over =. On 3/25/2011 7:11 PM, eryksun () wrote: On Friday, March 25, 2011 11:07:19 AM UTC-4, jyou...@kc.rr.com wrote: f = open('~/Desktop/test.txt', 'w') f.write('testing 1... 2... 3...') f.close() Consider using "with" to automatically close the file and os.path for cross-platform compatibility: import os.path user_home = os.path.expanduser('~') test_absname = os.path.join(user_home, 'Desktop', 'test.txt') with open(test_absname, 'w') as test: test.write('testing 1... 2... 3...') -- Thanks, Ty -- http://mail.python.org/mailman/listinfo/python-list
using python to post data to a form
Hello: I have some data that needs to be fed through a html form to get validated and processed and the like. How can I use python to send data through that form, given a specific url? the form says it uses post, but I"m not really sure what the difference is. would it just be: http://mysite.com/bla.php?foo=bar&bar=foo? If so, how do I do that with python? -- Thanks, Ty -- http://mail.python.org/mailman/listinfo/python-list
Re: using python to post data to a form
>Sending POST data can be done as follows (I'm changing bar=foo to Thanks for this, and the links. On 4/4/2011 12:24 AM, Chris Rebert wrote: On Sun, Apr 3, 2011 at 10:36 PM, Littlefield, Tyler wrote: Hello: I have some data that needs to be fed through a html form to get validated and processed and the like. How can I use python to send data through that form, given a specific url? the form says it uses post, but I"m not really sure what the difference is. They're different HTTP request methods: http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods The key upshot in this case is that GET requests place the parameters in the URL itself, whereas POST requests place them in the body of the request. would it just be: http://mysite.com/bla.php?foo=bar&bar=foo? No, that would be using GET. If so, how do I do that with python? Sending POST data can be done as follows (I'm changing bar=foo to bar=qux for greater clarity): from urllib import urlopen, urlencode form_data = {'foo' : 'bar', 'bar' : 'qux'} encoded_data = urlencode(form_data) try: # 2nd argument to urlopen() is the POST data to send, if any f = urlopen('http://mysite.com/bla.php', encoded_data) result = f.read() finally: f.close() Relevant docs: http://docs.python.org/library/urllib.html Cheers, Chris -- http://blog.rebertia.com -- Thanks, Ty -- http://mail.python.org/mailman/listinfo/python-list
Re: Sending pictures using sockets
On 4/6/2011 4:58 PM, craf wrote: >Hello. > >I'm testing the sockets in Python and I've seen the way in which >works to send string. My question is if anyone knows where >can find some information on how to send pictures through >Sockets. I use Python 2.7 and have read the information regarding >Sockets of the Python website, but I can not begin. Pictures are just like strings; grab it, send it in binary and you are set. >Any help is welcome > >Greetings. >Cristian Abarzúa F -- Thanks, Ty -- http://mail.python.org/mailman/listinfo/python-list
Re: fighting game made with python
>yep, if somebody moves one more thing. there's going to be a fight... bitch in your own thread, please? We've already heard you complain plenty, no need to take it to other threads too. On 4/7/2011 9:10 AM, harrismh777 wrote: neil harper wrote: is there any fighting games(street fighter, mortal kombat, etc) made in python? yep, if somebody moves one more thing. there's going to be a fight... :) -- Thanks, Ty -- http://mail.python.org/mailman/listinfo/python-list
Re: fighting game made with python
>Python would b ea bad choice for most of any fighting game, but >could see use as a configuration or internal scripting engine. Python's objects are rather large, which sort of makes for some slow work. Maybe a configuration setup, but Lua and Angelscript are better suited to high-end games where scripting is required because of their smaller footprint. -- http://mail.python.org/mailman/listinfo/python-list
Re: Egos, heartlessness, and limitations
RR: I do have to ask, before I feed the troll, where the hell is your spellchecker? And you were talking about people being lazy? The irony is killing me. Now, you've been told you can fork Idol if you so choose, and you've been told to write up information on how you want to replace TKInter as well as start the ball rolling in that direction. Why don't you return under your rock, or do one of these rather than insulting everyone here and demanding people sit down with -you- to formulate a "battle plan?" -- http://mail.python.org/mailman/listinfo/python-list
Re: Egos, heartlessness, and limitations
>We all have jobs James, and we still find the time to help others out Whose we? Can you point me to a thread within the last 6 months where you actually -helped- someone? >I think he has evolved into a complete jerk (if you ask me) 1) We didn't ask you. 2) If he's been under this rock of his and won't come out to "rub shoulders with the little people, as you say," how do you know he's a jerk? >but most importantly, learn to laugh at yourself. we all laugh at you, even if you don't, so no worries. -- http://mail.python.org/mailman/listinfo/python-list
Re: Egos, heartlessness, and limitations
>And who pissed in Guido's punch bowl anyway? Why is he such an elitist >now? Why can he not come over once and a while and rub shoulders with http://www.youtube.com/watch?v=FMEe7JqBgvg -- http://mail.python.org/mailman/listinfo/python-list
Re: De-tupleizing a list
>What is the most Pythonic way to loop through the list returning a >list like this?: here's how I'd do it: >>> i [(1, 'a'), (2, 'b'), (3, 'c')] >>> for item in i: ... a+=list(item) ... ... >>> a [1, 'a', 2, 'b', 3, 'c'] -- http://mail.python.org/mailman/listinfo/python-list
obviscating python code for distribution
Hello all: I have been considering writing a couple of programs in Python, but I don't want to distribute the code along with them. So I'm curious of a couple things. First, does there exist a cross-platform library for playing audio files, whose license I would not be violating if I do this? Second, would I be violating the twisted, wxpython licenses by doing this? Finally, is there a good way to accomplish this? I know that I can make .pyc files, but those can be disassembled very very easily with the disassembler and shipping these still means that the person needs the modules that are used. Is there another way to go about this? -- Take care, Ty my website: http://tds-solutions.net my blog: http://tds-solutions.net/blog skype: st8amnd127 “Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.” “If Java had true garbage collection, most programs would delete themselves upon execution.” -- http://mail.python.org/mailman/listinfo/python-list
Re: obviscating python code for distribution
I'm putting lots of work into this. I would rather not have some script kiddy dig through it, yank out chunks and do whatever he wants. I just want to distribute the program as-is, not distribute it and leave it open to being hacked. On 5/15/2011 9:29 PM, Ben Finney wrote: "Littlefield, Tyler" writes: I have been considering writing a couple of programs in Python, but I don't want to distribute the code along with them. This topic has been raised many times before, and there is a response which is now common but may sound harsh: What is it you think you would gain by obfuscating the code, and why is that worthwhile? What evidence do you have that code obfuscation would achieve that? Finally, is there a good way to accomplish this? I know that I can make .pyc files, but those can be disassembled very very easily with the disassembler and shipping these still means that the person needs the modules that are used. Is there another way to go about this? Not really, no. You would be best served by critically examining the requirement to obfuscate the code at all. -- Take care, Ty my website: http://tds-solutions.net my blog: http://tds-solutions.net/blog skype: st8amnd127 “Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.” “If Java had true garbage collection, most programs would delete themselves upon execution.” -- http://mail.python.org/mailman/listinfo/python-list
Re: obviscating python code for distribution
Hello: Thanks all for your information and ideas. I like the idea of open source; I have a fairly large (or large, by my standards anyway) project that I am working on that is open source. Here's kind of what I want to prevent. I want to write a multi-player online game; everyone will essentually end up connecting to my server to play the game. I don't really like the idea of security through obscurity, but I wanted to prevent a couple of problems. 1) First I want to prevent people from hacking at the code, then using my server as a test for their new setups. I do not want someone to gain some extra advantage just by editing the code. Is there some other solution to this, short of closed-source? Thanks, -- http://mail.python.org/mailman/listinfo/python-list
Re: obviscating python code for distribution
>Write your "game" for the "web". >Write is as a SaaS (Software as a Service) - even if it's free and open source. I understood you loud and clear. And that makes a lot of assumptions on my game and the design. I don't really care to host this over the web. I want a centralized server that would perform the logic, where I can offload the playing of sounds (through a soundpack that's already installed) to the client-side. Not only that, but a lot of web technologies that would be used for this wouldn't really work, as I am doing this for the blind; Flash as well as a lot of the popular setups are not very accessible. -- http://mail.python.org/mailman/listinfo/python-list
Re: obviscating python code for distribution
Hello: I wanted to make the client in python, and the server possibly, though I'm not really sure on that. I was not worried about the code for the server being stolen, as much as I was worried about people tinkering with the client code for added advantages. Most of the logic can be handled by the server to prevent a lot of this, but there are still ways people could give themselves advantages by altering the client. -- http://mail.python.org/mailman/listinfo/python-list
Re: obviscating python code for distribution
>Funny you should mention this "now" I don't go around parading the info, until I have to. >Yes I agree Flash is not very accessible (never has been). >Web Standards web apps and such however are quite >accessible! If I was making a browser-based game, yes. As I'm not though... Anyway, thanks to everyone else who answered this thread. I've not done much like this besides muds, and all the logic is on the server there, I think I will build the client in python, open source it for people to fix/add to if they want and make sure to keep the server as secure as it can be. -- http://mail.python.org/mailman/listinfo/python-list
Re: FW: help please
Not to be pedantic or anything, and I may not be able to help regardless, but it looks like your space key is fixed, and I don't really care to pick through and try to play hangman with your message. On 5/17/2011 3:43 AM, hamed azarkeshb wrote: From: hamed3...@hotmail.com To: webmas...@python.org Subject: help please Date: Tue, 17 May 2011 13:20:22 +0430 hi dear inwant to useautomation with catiaby python,but i dont know,h*ow do we can creat catsafearrayvariant in python?* please help me.i need urhelp by one example. thank u forany thing -- Take care, Ty my website: http://tds-solutions.net my blog: http://tds-solutions.net/blog skype: st8amnd127 “Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.” “If Java had true garbage collection, most programs would delete themselves upon execution.” -- http://mail.python.org/mailman/listinfo/python-list
Re: FW: help please
>I can't remember exactly in which release 'perfect English skills' were >added to Python runtime requirements, could you please refresh my memory? the one that requires people use the space key and check over their messages before they hit the enter key. Not so bad a request, I don't think. I am using a screen reader--it takes the text and puts it in speech. It uses the space as it's separation between words, as we all do, so wheniseetextlikethis it just jumbles it altogether. The point was to request that the OP try to formulate a good request, or get the space key fixed, both of which would've helped. -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] [RELEASED] Python 3.2.1 rc 1
>For an extensive list of changes and features in the 3.2 line, see >http://docs.python.org/3.2/whatsnew/3.2.html Might I presume that clicking the link would show the required changes? -- http://mail.python.org/mailman/listinfo/python-list
Re: obviscating python code for distribution
>might be secure as long as attackers cannot, say: You forgot UFOs. Anyway, again, thanks to everyone for the advice, this is good reading. Incidentally, I don't know to much about security. I know about rate limiting and dos attacks, as well as some others, but I think there's a lot more that I don't know--can someone kind of aim me in the right direction for some of this? I want to be able to take techniques, break my server and then fix it so that can't be done before I head to public with this. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
Alan Balmer <[EMAIL PROTECTED]> wrote or quoted: > On Tue, 04 Oct 2005 17:14:45 GMT, Roedy Green > >I try to explain Java each day both on my website on the plaintext > >only newsgroups. It is so much easier to get my point across in HTML. > > > >Program listings are much more readable on my website. > > My copy of javac seems to prefer plain text, and so do I ;-) Plain text is a badly impoverished medium for explaining things in. For one thing, code on my web site tends to get syntax highlighted. There's no way I could do that in plain text. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Steven D'Aprano <[EMAIL PROTECTED]> wrote or quoted: > On Sun, 09 Oct 2005 07:19:29 +, Roedy Green wrote: > > Rich Teer <[EMAIL PROTECTED]>: > >>WHat the hell has that got to do with HTML email? Sending photos > >>is an example of what attachments are for. > > > > Normally you send photos to grandma with captions under each photo. > > No, normally YOU send photos to grandma with captions under each photo. > My grandma doesn't put captions in her photo album, and she doesn't need > captions on her photos in email. > > > That is far more convenient for the technopeasant receiver than > > dealing with multiple attachments. > > Only if your photos are so obscure and confusing that they need captions. > > "Here's Johnny with the dog. Here is Johnny with the dog again. This one > is Johnny on his own. Here is the dog. Oh look, it is Johnny with the dog > again -- that's the dog on the left, in case it isn't clear. Just for a > change, this is Johnny wearing a hat. It is blue with a feather in it, > in case you couldn't tell from, oh I don't know, looking at the actual > picture." What have you got against captions? Giving photos captions is a *very* common practice. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > The technial problems have been solved for over a decade. NeXT shipped > systems that used text/richtext, which has none of the problems that > HTML has. The problems are *social* - you've got to arrange for > people to use mail/news readers that understand a rich text format > that isn't a vector for viruses. It's not HTML that has problems, it's Microsoft's crappy software. Writing virus-free HTML renderers is not hard - but of course Microsoft can still screw it up. Don't blame HTML for viruses - *every* document format Microsoft has anything to do with becomes a vector for viruses. They *even* managed to get virulent spreadsheets and word processor documents! -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > Roedy Green <[EMAIL PROTECTED]> writes: > > Read my essay. > > http://mindprod.com/projects.html/mailreadernewsreader.html > > > > I talk around those problems. > > Actually, you present a design that forces a solution that makes them > do what you want down their throats, never mind what they want, or > what they've been doing. It shows an amazing ignorance about the > internet and how people behave on it. Like most antispam proposals, it > won't actually stop spam, just force spammers to concentrate on > different channels. You seem to have randomly broken quoting for > people who download mail and read it offline, and for any medium > that's unreliable or doesn't reliably deliver messages "in order" - > which includes mail and news. Virus writers will love the ability to > change peoples address books remotely. Since - in Roedy's essay - messages are digitally signed, authority to advise about any email address updates would presumably be confined to those people with access to the sender's private key. Even /without/ any form of authentication, a standard change-of-address message - which is understood by mail readers - is a fine and sensible idea. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Roedy Green <[EMAIL PROTECTED]> wrote or quoted: > Read my essay. > http://mindprod.com/projects.html/mailreadernewsreader.html FYI, this bit: ``Like ICQ, someone cannot send you mail without your prior permission. They can't send you mail because they don't have your public key to encrypt the mail.'' ...is pretty confusing - because "public key" is a term with a technical meaning in cryptography - and a public key really *is* public. If you want to allow email only from a list of senders, then you use a simple white list. Cryptography is not needed or desirable if this is the intended goal. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Paul Boddie <[EMAIL PROTECTED]> wrote or quoted: > Roedy Green wrote: > > Just how long do you want to stall evolution? Do you imagine people > > 200 years from now will be still be using pure ASCII text unable to > > find a solution to JavaScript viruses (turn off JS), pop-up( disable > > popups) etc.? > > People in their sky-cars turning off JavaScript in their browsers: what > a thought! Javascript can be turned off in *mail readers* - by their manufacturers. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > Roedy Green <[EMAIL PROTECTED]> writes: > > On Sat, 08 Oct 2005 19:56:50 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote > >>Show us *examples*! Do you create a style sheet for every site you > >>visit that overrides there classes? What? > > > > Why don't you download a copy of Opera, see > > http://mindprod.com/jgloss/opera.html > > What makes you think I don't have a copy of Opera? Just so happens > I've got a registred copy on my newest computer. > > > Then try out the feature. Click View | style | user > > My copy of Opera doesn't have that menu entry. I suspect you're making > platform-specific suggestions. > > Trying it on a different platform, it looks like it does what I said > earlier: user mode simply disables the authors style sheets. None of > the "merging" you suggested was going on is actually happening. The "user mode" uses style sheets you specify. There's a whole bunch of built-in ones - and you can cascade them: ``User style sheets ``There is also the inclusion of 12 packaged user style sheets and an easy menu application interface (View > Style). These sheets can be cascaded together, with or without the page's styles. They are mostly for accessibility, accessible web design and plain coolness: Emulate text browser, Nostalgia, Accessibility Layout, Show images and links only, High contrast, Hide non-linking images, Disable tables and Use default forms design. There are also three style sheets that are worth mentioning specially: Hide certain-sized elements, Debug with outline, and Show structural elements. Hide certain-sized elements is basically that CSS-powered inline ad-killer that Eric A. Meyer came up with a few years ago. Debug with outline uses the newly added support for the "outline" property to display key elements. Finally, Show structural elements, which with the acrobatic use of generated content, attribute selectors and counters, shows the HTML tags inline, as well as the meta and link data, and a report on the number of font tags and nested tables. Now this is cool!'' - http://www.evolt.org/article/Opera_7_Released/1/54851/ -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > Roedy Green <[EMAIL PROTECTED]> writes: > > On Sat, 08 Oct 2005 17:41:38 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote: > >>If you've got a browser with a better solution, what's the browser, > >>and what's the solution? > > Try Opera. You can merge the two. > > Merge the two CSS files? Most browsers do that - that's why they call > them "cascading" style sheets. Got a sample style sheet that you use > that prevernts authors from overriding things? Custom style sheets are usually applied after those in the document - when they are both being applied. That way, the custom style sheet has the final word. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > Tim Tyler <[EMAIL PROTECTED]> writes: > > In comp.lang.java.programmer Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > >> Roedy Green <[EMAIL PROTECTED]> writes: > >> > Read my essay. > >> > http://mindprod.com/projects.html/mailreadernewsreader.html > >> > > >> > I talk around those problems. > >> > >> Virus writers will love the ability to change peoples address books > >> remotely. > > > > Since - in Roedy's essay - messages are digitally signed, authority > > to advise about any email address updates would presumably be confined > > to those people with access to the sender's private key. > > It's not confined to just people - software can do this as well. In > particular, you should expect that the users mail agent will have to > have access to the key, so it can automatically send out the change of > address notice when the user changes their address (it actually needs > it to send any mail). Viruses regularly make users mail agents do > thing. "Change my address" becomes much more entertaining when that > triggers sending out change of addresses notices to everyone in the > address book. More likely, though, there'll be an API for getting the > key so that users can change mail agents without invalidating the > public key that everyone they correspond with has for them, and the > virus will just use that API. Viruses can mail out change of address messages to everyone in the compromised machine's address book today. Of course, viruses don't bother doing that - since it's stupid and pointless. If you've compromised someone's machine there are typically lots more rewarding things to do with it than spoof change-of-address notices. Top of the cracker's list seems to be: * Attack organisations; * Relay spam; * Attempt to compromise other machines; -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > Tim Tyler <[EMAIL PROTECTED]> writes: > > In comp.lang.java.programmer Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > >> The technial problems have been solved for over a decade. NeXT shipped > >> systems that used text/richtext, which has none of the problems that > >> HTML has. The problems are *social* - you've got to arrange for > >> people to use mail/news readers that understand a rich text format > >> that isn't a vector for viruses. > > > > It's not HTML that has problems, it's Microsoft's crappy software. > > HTML is a problem on *other* peoples crappy software as well. It > wasn't designed to carry code content, but has been hacked up to do > that. Are there any examples of HTML email causing security problems - outside of Microsoft's software? I can think of one: the JPEG virus. However, that affected practically any program that could render JPEGs - not just HTML. > > Writing virus-free HTML renderers is not hard - but of course > > Microsoft can still screw it up. > > Sure - just disable all the features that make people want to use HTML > instead of something else. Not so: you disable Java, Javascript and plugins. You leave the ability to format, colour and hint documents. This is not /that/ difficult. > > Don't blame HTML for viruses - *every* document format Microsoft has > > anything to do with becomes a vector for viruses. > > Which would mean that every open format that MS has had anything to do > with comes a vector for viruses. Somehow, I'm not buying it. I exaggerate only slightly. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
In comp.lang.java.programmer Peter T. Breuer <[EMAIL PROTECTED]> wrote or quoted: > Uh - when microsoft produced dos 1.0, or whatever it was, I was sitting > at my Sun 360 workstation (with 4M of RAM, later upgraded to 8M), > running SunOS 3.8 or thereabouts. > > And a mean game of tetris it played too. Chess wasn't worth the > humiliation at level 5. > > I believe every researcher in britain got one as a matter of course, but > they only replaced the perq machines that everyone had had to put up > with before then. The vaxen running hpux or so were plentiful too, and > had fine monitors, tending more to the PC shape. We'd made our own word > processor machines and spreadsheet automatons before that. It didn't > take that many components, just a good engineer and a room full of > lackeys with soddering irons. The BBC were selling kits too (what were > they? Ataris?), not that I ever fell for that. Acorn computers. Manufacturers of the best computer I ever owned. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
In comp.lang.java.programmer Steven D'Aprano <[EMAIL PROTECTED]> wrote or quoted: > I'm aware of talk that Dell is selling Linux PCs at Walmart for less than > the same hardware plus Windows. Talk is cheap -- I'm not aware of anyone > who has actually seen these Linux PCs. I'd love to know either way. See: ``Dell's Open PC Costs More Than Windows Box'' - http://hardware.slashdot.org/article.pl?sid=05/10/08/034211&tid=190&tid=137 -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
In comp.lang.java.programmer Richard Gration <[EMAIL PROTECTED]> wrote or quoted: > On Sun, 16 Oct 2005 11:51:16 +0000, Tim Tyler wrote: > > Acorn computers. Manufacturers of the best computer I ever owned. > > I'm willing to bet that was an Arc ... ? I never used one but everyone > I've ever talked to who used one said it was fantastic. Myself I was > pretty impressed with the BBC B ... I had a BBC B - and then a couple of Archimedies computers. The BBC computer was cool. However, the Archimedies had a 32-bit RISC chip in 1987, was quite affordable, and did rather blow the socks off its predecessor. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
In comp.lang.java.programmer Jeroen Wenting wrote or quoted: > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > > "Jeroen Wenting" writes: [Microsoft] > >> no, they got their by clever marketing [snip] > > > > What you call "clever marketing" the DOJ calls "monopolistic > > practices". The courts agreed with the DOJ. Having had several large > > PC manufacturers refuse to sell me a system without some form of > > Windows because MS made it impossible for them to compete if they > > didn't agree to do so, I agree with the courts and the DOJ. > > And were later forced to rescind. [...] That is inaccurate. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
Tim Roberts <[EMAIL PROTECTED]> wrote or quoted: [Microsoft] > Part of their behavior really escape me. The whole thing about browser > wars confuses me. Web browsers represent a zero billion dollar a year > market. Why would you risk anything to own it? Power. Minshare. Controlling the planet's gateway to the internet. That sort of thing. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
In comp.lang.java.programmer Roedy Green <[EMAIL PROTECTED]> wrote or quoted: > MS has held BACK computer evolution by tying their OS so heavily to > the Pentium architecture. The chip architecture has nowhere near > enough registers. MS refused to believe the Internet was more than a > passing fad. They are still frantically patching security holes in > their OS over a decade later. Another big problem appears to be sitting on their customers and milking them - rather than working on improving things. There has been some progress with their OS - but it seems to be going very slowly. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Paul Rubin <http://[EMAIL PROTECTED]> wrote or quoted: > Tim Tyler <[EMAIL PROTECTED]> writes: > > Are there any examples of HTML email causing security problems - outside > > of Microsoft's software? > > There was a pretty good one that went something like > > Click this link to download latest security patch! >http://www.mxx.com.>Microsoft Security Center > > where "mxx" is "microsoft" with the letter "i" replaced by some > exotic Unicode character that looks exactly like an ascii "i" in normal > screen fonts. The attacker had of course registered that domain and > put evil stuff there. I didn't think unicode domain names existed. It seems that they are in the pipeline: ``After much debate and many competing proposals, a system called Internationalizing Domain Names in Applications (IDNA) was adopted as the chosen standard, and is currently, as of 2005, in the process of being rolled out.'' - http://en.wikipedia.org/wiki/Internationalized_domain_names It looks like the security issues are probably going to be dealt with via technical fixes: ``On February 17, 2005, Mozilla developers announced that they would ship their next versions of their software with IDN support still enabled, but showing the punycode URLs instead, thus thwarting any attacks while still allowing people to access websites on an IDN domain. This is a change from the earlier plans to disable IDN entirely for the time being.'' - http://en.wikipedia.org/wiki/Internationalized_domain_names Anyway, I'm inclined to suggest this is a DNS problem. It would apply to any format that allowed rendering of domain names using the unicode character set they are intended to be displayed using. Even without unicode, the "homograph attack" is still viable, due to things like the "l"/"I" issue in many fonts - as pointed out on: http://www.centr.org/docs/2005/02/homographs.html -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
In comp.lang.java.programmer Ross Bamford <[EMAIL PROTECTED]> wrote or quoted: > Roedy, I would just _love_ to see the response from the industry when you > tell them they should dump their whole mail infrastructure, and switch > over to a whole new system (new protocols, new security holes, new > problems start to finish). [...] That's essentially what the IM folk did. It seems quite possible that future email systems will evolve out of existing IM ones. Essentially, IM can do pretty-much everything email can these days, but the reverse is not true at all. IM also seems more evolvable than email is managing to be. About all email has going for it these days is an open format and a large existing user base. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Jargons of Info Tech industry
Gordon Burditt <[EMAIL PROTECTED]> wrote or quoted: > Before worrying about the possible bugs in the implementations, > worry about security issues present in the *DESIGN*. Email ought > to be usable to carry out a conversation *SAFELY* with some person out > to get you. Thus features like this are dangerous (in the *design*, > not because they *might* hide a buffer-overflow exploit): > > - Hyperlinks to anything *outside* the email in which the link > resides ("web bugs"). Acceptable risk, IMO. > - Any ability to automatically generate hits on sender-specified > servers when the email is read. I hadn't though of that one. As well as use in DDOS attacks, that can help let spammers know if they have reached a human :-| Even a link in a plain text email can be used (though with reduced effectiveness) in such a context :-( -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
Mike Meyer <[EMAIL PROTECTED]> wrote or quoted: > Wrong. The only obligation Microsoft has is to their shareholders. > That obligation has nothing to do with computing - it's to make a > profit. It's MS's habit of doing things in pursuit of profit that, > while short of force, are borderline fraud, and are illegal, immoral, > unethical, bad for their business partners, bad for their customers, > bad for the industry and bad for society that causes people to > characterize them as "evil". Microsoft still comes in at number 2 - on: http://dmoz.org/Society/Issues/Business/Allegedly_Unethical_Firms/ Few companies are more despised than Microsoft. -- __ |im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply. -- http://mail.python.org/mailman/listinfo/python-list
3d Transformation
Got a 3d algorithmns question. Algorithmn will be implemented in python, so a library would be great if it works on windows. Basically my function would be defined as such. Problem is one of coordinate transformation. Give a 3d vector, which reprents the +z axis in the source coordinate system, and a rotation value around that axis for determinging the x and y axises, I wish to translate a point from that geometry into "world" geometry, or in other words absolute coordinates. Input data is a 3d path with banking data that will be sampled at regular points for purposes of building other geometry. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- http://mail.python.org/mailman/listinfo/python-list
looking for programmer
Hi There, I'm looking for someone to write some wx/python code on a small job, but want to avoid a spam invasion. I was thinking of setting up a temp yahoo account for people to respond to. Is this the right way of going about this, or is there somewhere else I should be looking? Thanks Peter. -- http://mail.python.org/mailman/listinfo/python-list