DBI module deprecated at Python 2.5--what to use in its place?
I have a variety of Python 2.4 scripts that utilitize the DBI and ODBC modules together. Although I don't have Python 2.5, I've been informed the DBI module has been deprecated at 2.5. A few questions: 1) Although deprecated, will it work at all in 2.5? Does the fact that it is deprecrated mean it has been removed entirely, or does Python 2.5 simply issuing a warning? 2) What do I use in place of DBI for my Python 2.4. scripts that import modules DBI and ODBC together. I don't use DBI directly. It was simply a dependency for the ODBC module as best I knew. Thanks. Dana -- http://mail.python.org/mailman/listinfo/python-list
Re: DBI module deprecated at Python 2.5--what to use in its place?
On Jul 8, 12:30 am, John Machin wrote: > Deprecated certainly doesn't mean removed. > For a start, none of (DBI, ODBC, dbi, odbc) are standard Python- > supplied modules. Perhaps you are referring to the odbc (and dbi) from > the pywin32 package? Where did you get them from? If you can't > remember, try this: Thanks John. I mean the lower-case dbi and odbc modules from pywin32. Sorry for being vague. I assumed incorrectly they were part of the standard library because they came with pywin32. > If this is what you're talking about, you should be asking on the > pywin32 dicussion list (http://mail.python.org/mailman/listinfo/python- > win32). Thanks again. > General advice: if you are thinking of upgrading your Python version, > go straight to 2.6. odbc is AFAIK stuck at version 1.0 of the Python > DB API; consider switching to pyodbc (http://code.google.com/p/ > pyodbc/) Thanks thrice. We "have" to use the version of Python our software vendor supports. Presently, that's pywin32 version 2.5. Dana -- http://mail.python.org/mailman/listinfo/python-list
Re: DBI module deprecated at Python 2.5--what to use in its place?
On Jul 10, 12:15 pm, "M.-A. Lemburg" wrote: > If you're looking for a stable and maintained ODBC for Python, > have a look at our mxODBC extension or mxODBC Connect package: > http://www.egenix.com/products/python/mxODBC/http://www.egenix.com/products/python/mxODBCConnect/ I'm looking for a free module. Is yours a commercial product? Thanks. Dana -- http://mail.python.org/mailman/listinfo/python-list
DDE syntax help
Hello, I am trying to convert an Excel SpreadSheet to Python. The formula in Excel for one of the cells is =DDE("ser1","ser2","ser3"). The name of the server is ser1, ser2 is the topic, and ser3 is an item. I already tried using: >>> import dde >>> ddes = dde.CreateServer() >>> ddes.Create("ser1") >>> ddec = dde.CreateConversation(ddes) >>> ddec.ConnectTo("ser1","ser3") >>> ddec.Connected() 1 All is ok so far. However: >>> ddec.Request("ser2") Traceback (most recent call last): File "", line 1, in ? error: Request failed >>> ddec.Exec("ser2") Traceback (most recent call last): File "", line 1, in ? error: Exec failed >>> Does anyone know the syntax to request information from a DDE server? I could not find any useful examples in the documentation. Thank you, Dana __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 -- http://mail.python.org/mailman/listinfo/python-list
getting data from a port in use
Hi to all, I am trying to use Python to get the data received at a specific port (in use) on my computer. I already tried below code which seems to hang at the statement accepting connections. I don't know what else I can try. Any suggestions will be welcome. import socket, select, os PORT = 2005 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((socket.gethostname(), PORT)) s.listen(1) work_socket, addr = s.accept() data = s.recv(1024) print data s.close() Thank you, Dana __ Do you Yahoo!? Meet the all-new My Yahoo! - Try it today! http://my.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
RE: getting data from a port in use
--- Tony Meyer <[EMAIL PROTECTED]> wrote: > > I am trying to use Python to get the data received at a > > specific port (in use) on my computer. I already tried below > > code which seems to hang at the statement accepting > > connections. > > Seems to hang, or does hang? Using print statements will tell you > whether > that's where it's getting stuck or not. > > > I don't know what else I can try. Any > > suggestions will be welcome. > > > > import socket, select, os > > > > PORT = 2005 > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) > > s.bind((socket.gethostname(), PORT)) > > s.listen(1) > > work_socket, addr = s.accept() > > data = s.recv(1024) > [...] > > This should be 'data = work_socket.recv(1024)'. > > This script works for me with that change. (i.e. I can run it with port > 2005 already in use, connect to the port, and it will finish without > error). > > =Tony.Meyer > > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://mail.python.org/mailman/listinfo/python-list
RE: getting data from a port in use
Yes. It hangs at accept. I always end up doing end task because it never passes the "accept" statement. When I set the port I use netstat (netstat -bn) to get the ports that are in use. I use PythonWin 2.4. I am still puzzled about the fact that it runs fine for you. You are right about using the work_socket instead of s. My program never ran to that line so I did not notice the error. Thank you, Dana --- Tony Meyer <[EMAIL PROTECTED]> wrote: > > I am trying to use Python to get the data received at a > > specific port (in use) on my computer. I already tried below > > code which seems to hang at the statement accepting > > connections. > > Seems to hang, or does hang? Using print statements will tell you > whether > that's where it's getting stuck or not. > > > I don't know what else I can try. Any > > suggestions will be welcome. > > > > import socket, select, os > > > > PORT = 2005 > > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > > s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) > > s.bind((socket.gethostname(), PORT)) > > s.listen(1) > > work_socket, addr = s.accept() > > data = s.recv(1024) > [...] > > This should be 'data = work_socket.recv(1024)'. > > This script works for me with that change. (i.e. I can run it with port > 2005 already in use, connect to the port, and it will finish without > error). > > =Tony.Meyer > > __ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo -- http://mail.python.org/mailman/listinfo/python-list
getting data from a port in use
Yes. I want to write a very small web sniffer that gets data from a specified port. I already looked at some of the existing ones on Internet, but they are not in Python (I am trying to learn Python!) and they have a lot more features that I want. Thanks for your suggestion. I will check out pcap library. Dana On 2005-02-01, Dana Marcusanu <[EMAIL PROTECTED]> wrote: > I am trying to use Python to get the data received at a specific port (in > use) on my computer. What do you mean "in use"? You mean you want to evesdropt on data that's being sent to an existing connection? If so, you'll need to use something like the pcap library. > I already tried below code which seems to hang at the > statement accepting connections. I don't know what else I can try. Any > suggestions will be welcome. > import socket, select, os > PORT = 2005 > s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) > s.bind((socket.gethostname(), PORT)) > s.listen(1) > work_socket, addr = s.accept() > data = s.recv(1024) No matter what you're trying to do, this isn't right. Once the connection has been accepted, you have to read data from the socket returned by the accept() call. > print data > s.close() -- Grant Edwards grante Yow! Actually, what at I'd like is a little toy visi.comspaceship!! __ Do you Yahoo!? Yahoo! Mail - 250MB free storage. Do more. Manage less. http://info.mail.yahoo.com/mail_250 -- http://mail.python.org/mailman/listinfo/python-list