Re: Need Help with Python/C API
On Thu, 18 Jan 2006, pycraze wrote: Hi! I don't really understand what you need/want. Can you explain in more details? >I Need to know how do i create a dictionary... eg: > n = pali_hash > n={} > n={1:{ } } -> i need to know how to make a key of a dictionary, to a > dictionary using Python/C API's Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list
Addressing the modem via pyserial
Hi! I asked previously how to address the COM port from Python and I was directed to pyserial. It is very elegant and I guess it works very well. However, it seems that what I try to do is more complicated than I first thought. I want to make my modem place a call using the number '1234'. The modem is connected to COM3 on my computer. So I tried the following: --- import serial ser = serial.Serial(2) # COM3 ser.timeout = 2 # otherwise the read(2) which follows blocks for ever ser.write("atdt1234") reply = ser.read(2) print reply ser.close() print "ok" --- In the HyperTerminal which comes with Win XP Pro, I can set up a connection to COM3 and there type the 'atdt1234' command. It works (I get a call since I have the modem connected to a device with a phone on it). My question is actually: will an at-command like 'atdt1234' translate to ser.write('atdt1234')? Secondly, a modem question: I have found a lot of web pages about at-commands listing the hayes command set. Still many of them do not seem to work on two different modems I have tried. Like '&$' should display an overview of the commands supported by the modem. Ii tried this in the HyperTerminal where I can place the above mentioned call, and I get 'ERROR'. I also get 'ERROR' for most other commands I try. Any ideas? Thanks, Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list
Addressing a COM port from Python
Hi! I am writing some tests and I need to place calls through the modem. Is there an API for addressing the COM ports on my machine, so that I can issue AT-commands to the modem? If this can not be done from Python, I am sure it can be done from C/C++/Java. Any tutorials/examples that you know of? Maybe calling C from Python? I am working on Win XP Pro, with Activestate Python 2.4. Thanks, Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list
py2exe and Amara
Hi! I am using Amara 1.1.6 in a project. I made an executable with py2exe but when I try to run it I am referred to the log file, which states: Traceback (most recent call last): File "makeTestSpec.py", line 281, in ? File "makeTestSpec.py", line 114, in __init__ File "makeTestSpec.py", line 125, in loadTests File "amara\__init__.pyc", line 50, in parse NameError: global name 'IsXml' is not defined The lines reffered to are: 281: mainWindow = MakeTestSpec(root) 114: self.loadTests() 125: doc = amara.parse(fileName) I import amara like this: 'import amara'. These three files have been zipped into the library.zip file: bindery.pyc, binderytools.pic, binderyxpath.pyc, which are the amara files. Any suggestions as to how to make this executable work? Everything else seems to work fine; if I disable the XML stuff from my script, all the rest seems to work, even Pmw loads up correctly. Thanks, Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie Question: CSV to XML
On Fri, 6 Jan 2006, ProvoWallis wrote: Hi! > Would anyone be willing to give me some feedback about this little > script that I wrote to convert CSV to XML. I'll happily admit that I > still have a lot to learn about Python so I'm always grateful for > constructive feedback. I have started using a module called Amara for xml manipulation. I am pleased with how elegant it is, compared to what I have used before. Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list
Python based Compiler tools
Hi! I have some experience with PLY. What other alternatives are there, and which is the "best" (that is most feature rich, easiest to use, ...)? Thanks, Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list
Re: Amara (XML) problem on Solaris
On Wed, 14 Dec 2005, Alan Franzoni wrote: > Also, are you sure the code is correct? I've taken a peek at the Amara's > website, and the create_document() function seems to lie within the > binderytools module. I think the line should look like: > > depending on the way you imported the module, but your previous code, if > really working on Windows, makes me think you did something like: > > import amara.binderytools as amara > > or something like that? > Please post some more code, if you can. This is a simple test: import amara doc = amara.create_document() doc.xml_append(doc.xml_create_element(u"units")) print "OK" On Windows XP Pro it runs like this: C:\owera\test\xaps2-test>python amara-test1.py OK C:\owera\test\xaps2-test> On Solaris it runs like this: bash-2.03$ python amara-test1.py Traceback (most recent call last): File "amara-test1.py", line 3, in ? doc = amara.create_document() AttributeError: 'module' object has no attribute 'create_document' bash-2.03$ Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list
Amara (XML) problem on Solaris
Hi! I have ActiveState Python 2.4.1 on Win XP Pro, with Amara 1.1.6. I have a script which works fine. I am trying to run the same script on a Solaris machine, with Python 2.4.2 and Amara 1.1.6. It gives me this error: bash-2.03$ python generateXML.py Traceback (most recent call last): File "generateXML.py", line 16, in ? doc = amara.create_document() AttributeError: 'module' object has no attribute 'create_document' bash-2.03$ Any ideas what is going on? Thanks, Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list
Re: Capturing output from stderr
On Mon, 5 Dec 2005, Doru-Catalin Togea wrote: Found a solution: os.system("some command 1>out.txt 2>err.txt") > On solaris, I call a program from python with > > os.system("some command > outputFile.txt" ) > > This redirects the output of "some command"'s stdout to "outputFile.txt". > However I need to redirect or somehow capture the output from "some > command"'s stderr to this file too. How can I do that? > > Thanks, > Catalin > > > -- <<<< == >>>> << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> <<<< == >>>> -- http://mail.python.org/mailman/listinfo/python-list
Capturing output from stderr
Hi! On solaris, I call a program from python with os.system("some command > outputFile.txt" ) This redirects the output of "some command"'s stdout to "outputFile.txt". However I need to redirect or somehow capture the output from "some command"'s stderr to this file too. How can I do that? Thanks, Catalin -- http://mail.python.org/mailman/listinfo/python-list
XML processing
Hi! I need to do some XML programming, and I have installed the PyXML package. However I read some stuff on the web that using the modules in PyXML is slow and not elegant and it uses up lots of memory, and I don't know what else. Is the current implementation of PyXML legging behind in comparison to similar tools in available for other languages? Thanks, Catalin -- == << We are what we repeatedly do. >> << Excellence, therefore, is not an act >> << but a habit. >> == -- http://mail.python.org/mailman/listinfo/python-list