-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
I have a program that I'd would like to enhance flexibility in calling.
Is there a way to leverage optionparser so it can accept input from both
command line and a configuration file?
Current code block is:
#
# Parse command li
to")
(options, args) = parser.parse_args()
print options.qmanager
If so, the code generates the following deletion error.
Traceback (most recent call last):
File "C:\Documents and Settings\Andrew Robert\My
Documents\receiver.py", line 326, in ?
(options, args) =
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi everyone,
Just to be complete, I figured I would share the solution to use option
parser for both command line and configuration file option passing.
I hope it may be of use to someone in the future.
parser = OptionParser()
if len(sys.argv) ==
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi everyone,
I am in the process of creating a file transmit/receiver program using
MQSeries.
The way it works is through creation of an XML message.
Elements within the XML message contain things such as file name, size,
and the file contents.
The
scripts\receiver.py", line 238, in ?
test = TriggerMessage.decode(data)
TypeError: unbound method decode() must be called by TriggerMessage
instance as first argument (got str instance instead)
Does this make any sense?
The variable data passed to the class is valid and is used elsewhere
correctly.
- --
Than
self.envdata, self.userdata, self.qmgr
\
= struct.unpack(format,self.data)
- --
Thank you,
Andrew Robert
Systems Architect
Information Technologies
MFS Investment Management
Phone: 617-954-5882
E-mail: [EMAIL PROTECTED]
Linux User Number: #201204
-BEGIN PGP SIGNATURE-
Version:
or
similar module?
I've begun reading about using re expressions at
http://www.amk.ca/python/howto/regex/ but I am still hazy on implementation.
Any help you can provide would be greatly appreciated.
- --
Thank you,
Andrew Robert
Systems Architect
Information Technologies
MFS Investment Manag
statement but I am not sure why.
int(a,16)
33
If the 0X21 is the actual hex value, then why convert to integer?
Is this the ASCII table reference to the hex value?
- --
Thank you,
Andrew Robert
Systems Architect
Information Technologies
MFS Investment Management
Phone: 617-954-5882
E-mai
me ; at least in this special case (Python lacks something like the
> -l switch).
>
> With bash it's a bit easier. (maybe there's also a way with cmd.com to
> write multiple lines)?
>
> $ python -c "import re,sys
> for line in sys.stdin: print re.sub(r'([^\w\s]
>>
>> Not familiar with lamda :).
>
> You ae absolutely right.
> It creates an un-named(or anonymous function). :-)
>
>> The un-named function does in-place transformation of the character to
>> the established hex value.
>
> Its actually the call
stdout.write() instead of print:
> for line i open(r'e:\pycode\sigh.txt','rb'):
> line = re.sub(r'([^\w\s])', lambda s: '%%%2X' % ord(s.group()), line)
> sys.stdout.write(line)
>
> Kent
>
- --
Thank you,
Andrew Robert
Systems Arc
any chance, do you see where the syntax issue is?
Kent Johnson wrote:
> Andrew Robert wrote:
> Use int(s, 16) to convert a base 16 string to an integer, and chr() to
> convert the int to a string. So something like this:
> lambda s: chr(int(s.group(), 16)))
>
> Kent
>
>
a format string.
>
> The syntax error is caused by mismatched parentheses.
>
> Kent
>
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
- --
Thank you,
Andrew Robert
Systems Architect
Infor
But I'd also recommend writing a helper function here. Just because you
> can do this in one line doesn't mean you have to. *grin* It might be
> useful to change the lambda back to a helper function.
>
- --
Thank you,
Andrew Robert
Systems Architect
Information Techn
.
The hex to char pass does not appear to work at all.
No error is generated. It just appears to be ignored.
Kent Johnson wrote:
> Andrew Robert wrote:
>
> You have an argument in the wrong place. Stop trying to do everything in
> one line! Put the lambda in a def'd
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
Thanks for all of your patience on this.
I finally got it to work.
Here is the completed test code showing what is going on.
Not cleaned up yet but it works for proof-of-concept purposes.
#!/usr/bin/python
import re,base64
# Eva
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Linda,
You can append your path to include the location of the module.
An example of this would be:
sys.path.append(r'\\share\somedirectory')
linda.s wrote:
> Hi,
> How to import a module which was not in the current working directory?
> Thanks
appears to be
defunct.
- --
Thank you,
Andrew Robert
Systems Architect
Information Technologies
MFS Investment Management
Phone: 617-954-5882
E-mail: [EMAIL PROTECTED]
Linux User Number: #201204
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (MingW32)
Comment: GnuPT 2.7.2
it plays nice
with existing perl code already in place.
Not my choice, but what can you do.
Any help you can provide on this would be greatly appreciated.
--
Thank you,
Andrew Robert
#!c:\python24\python
# Program: sender.py
# Authors: Andrew Robert and Dariusz Suchojad
#
# Function: T
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Now that is a real pity.
Wish I were talented enough to do it myself.
Mike Hansen wrote:
> On Jun 12, 2006, at 5:53 AM, Andrew Robert wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> Hi everyone,
f accomplishing the same thing?
- --
Thank you,
Andrew Robert
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (MingW32)
Comment: GnuPT 2.7.2
iD8DBQFEkFgfDvn/4H0LjDwRAophAKCZbJaMWBr2G8dLjHO3VtOA98/+1gCbBsys
4B/Q6g9m+3DW+PzcnCpki6k=
=t0E4
-END PGP SIGNATURE-
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Excellent.. much better than testing each value independently.
Thank you.
Mike Hansen wrote:
>
>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Robert
>>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
You may also want to try a error handling like this.
It is platform clean and uses the system standard logging routines.
import os, logging, logging.handlers
def eventlogger(level,message):
"""
Sent trapped events to NT application
if
csums.checksum_compare(sys.argv[0],sum,check,file_name) == True:
queue.commit()
sys.exit(0)
else:
queue.backout()
mqevlog.event("error","CheckSums of
r
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
What you need to do is append your existing path.
for example:
import sys
sys.path.append(r'd:\python_modules')
You can then import any modules that reside in that path as if they
where part of the standard library.
Andy
-BEGIN PGP SIGNATURE--
Perhaps this?
stat = os.stat(self.file_name)
file_size = stat[6]
Thank you,
Andrew Robert
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
there were anything specifically created.
Any insight you might have on this would be greatly appreciated.
- --
Thank you,
Andrew Robert
Systems Architect
Information Technologies
MFS Investment Management
Phone: 617-954-5882
E-mail: [EMAIL PROTECTED]
Linux User Number: #201204
-BEGIN PGP
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
I have a text file being broadcast on a web site and I would like to download
it
and save it as an MS Word file.
The download from web is relatively painless.
#!C:\Python24\Python
import sys
from urllib import urlopen
if len(sys
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Thanks for your help on this.
Here is the completed code in case anyone is interested.
#! C:\Python24\python
#
# program: mswword.py
# Author: Andrew Robert
#
# Ver Date ProgrammerModification
# 1.0 07/20/06 AAR
ormat document from it.
The program is not platform dependent but it does require installation
of the PyRTF module.
I hope someone finds this useful/interesting.
#!C:\Python24\python
#
# program: rtfmaker.py
# Author: Andrew Robert
#
# Function: Take a supplied file and dump its contents to an RTF
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Nimrodx,
In case you haven't found a solution yet, I developed a program to
encode/decode stuff similar to this.
You may want to take a look at it at
http://home.townisp.com/~arobert/python/file_encoder.py
nimrodx wrote:
> Hi Alan,
>
> I fou
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Mike Hansen wrote:
>
>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Alan Gauld
>> Sent: Tuesday, August 29, 2006 1:26 AM
>> To: anil maran
>> Cc: tutor@python.org
>> Subject: Re: [Tutor] omnic
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Chris Hengge wrote:
> I've been doing some searching for ways to access existing SQL server
> databases, but I'm finding so many different ways to do it, is there one
> that anyone recommends for a "new to python" programmer? I've used VB
> and C# for
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Chris Hengge wrote:
> I've been doing some searching for ways to access existing SQL server
> databases, but I'm finding so many different ways to do it, is there one
> that anyone recommends for a "new to python" programmer? I've used VB
> and C# for
Bryan Leber wrote:
>
> Hello, I am trying to create a script that reads from the command line
> and puts the sysargv into a list. I have this part done. I have added
> code for testing and one of those testing procedures is to print the
> list out in a text file. Not all field are required and may
to smaller chunks would improve efficiency.
- --
Thank you,
Andrew Robert
Senior MQ Engineer
Information Technologies
MFS Investment Management
Phone: 617-954-5882
E-mail: [EMAIL PROTECTED]
Linux User Number: #201204
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (MingW32)
Comment: GnuPT
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Never mind.. :)
found it at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/224800
However, if someone has something better, I would be very interested.
Andrew Robert wrote:
> Hi guys,
>
> Awhile back, I believe I saw a cookbo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
How about something like this?
Create a function and then call it with the required optins of server
url, sender address, destination address, subject, and message text?
def send(serverURL=None, sender='', to='', subject='', text=''):
"""
F
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi guys,
I am looking to experiment with pysvn and was wondering if anyone knew
of a location for code samples/snippets using it?
I'm reviewing the pysvn programmers guide and tutorial but some live
examples would be great.
If anyone can point me at
attempt a write on the share and clean up
after itself but I am hoping for a more elegant solution.
Any insight anyone can provide on this would be greatly appreciated.
--
Thank you,
Andrew Robert
Senior MQ Engineer
Information Technologies
Massachussetts Financial Services
Phone: 617-954-5882
his kind of
operation or is this it?
The key/value pairs in these examples are contrived for purposes of
this discussion but the end goal is to piece together server and
directory path information for use with pysvn.
I have a Perl programmer who is learning Python and he is griping that
this kind
ligent.
> >
> > Are there a more efficient/compact ways of doing this kind of
> > operation or is this it?
> >
>
> Maybe you like:
> print "\\".join([config[val] for val in ["val2","val1","val3"]])
>
> --
> Andre Engels,
42 matches
Mail list logo