jython

how to tell if a string is base64 or not.

Hi guys I have many emails coming in from different sources. they all have attachments, many of them have attachment names in chinese, so these names are converted to base64 by their email clients. When I receive these emails, I wish to decode the name. but there are other names which are not base64. How can I differentiate whether a s...

Dictionary or If statements, Jython

Hi Guys, I am writing a script at the moment that will grab certain information from HTML using dom4j. Since Python/Jython does not have a native switch statement I decided to use a whole bunch of if statements that call the appropriate method, like below: if type == 'extractTitle': extractTitle(dom) if type == 'extractMetaTags': ...

email body from a parsed email object in jython

I have an object. fp = open(self.currentEmailPath, "rb") p = email.Parser.Parser() self._currentEmailParsedInstance= p.parse(fp) fp.close() self.currentEmailParsedInstance, from this object I want to get the body of an email, text only no html.... How do I do it? something like this? newmsg=self._current...

Groovy advantages over Jython or Jruby?

Why would I choose to use Groovy when I could use Jython or Jruby? Does the language provide any inherent advantages to make up for the fact that Jython and Jruby skills are applicable to their parent languages outside of the JVM? Keep in mind that I purposely keeping this question generic, but if there are any advantages that exist in...

python (jython) archiving library.

Is there a neat archiving library that automatically handles archiving a folder or directories for you out there? I am using Jython, so Java libs are also open for use. -UPDATE- Also Im looking for timestamp archiving. ie archive-dir/2008/11/16/zipfilebypreference.zip then the next day call it again and it creates another folder. Im s...

loadComponentFromURL falls over and dies, howto do CPR?

hi guys Well I testing my jython program, that does some neat [".xls", ".doc", ".rtf", ".tif", ".tiff", ".pdf" files] -> pdf (intermediary file) -> tif (final output) conversion using Open Office. We moved away from MS Office due to the problems we had with automation. Now it seems we have knocked down many bottles related to show sto...

help me translate Java code making use of bytes into jython code

how do I translate this code into jython? ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file + ".zip")); byte[] buf = new byte[1024]; int len; //Create a new Zip entry with the file's name. ZipEntry zipEntry = new ZipEntry(file.toString()); //Create a buffered input stream out of the file ...

Modern, high performance bloom filter in Python?

I'm looking for a production quality bloom filter implementation in Python to handle fairly large numbers of items (say 100M to 1B items with 0.01% false positive rate). Pybloom is one option but it seems to be showing its age as it throws DeprecationWarning errors on Python 2.5 on a regular basis. Joe Gregorio also has an implementat...

Are there problems developing Django on Jython?

The background I'm building a fair-sized web application with a friend in my own time, and we've decided to go with the Django framework on Python. Django provides us with a lot of features we're going to need, so please don't suggest alternative frameworks. The only decision I'm having trouble with, is whether we use Python or Jyth...

Is there a good NumPy clone for Jython?

I'm a relatively new convert to Python. I've written some code to grab/graph data from various sources to automate some weekly reports and forecasts. I've been intrigued by the Jython concept, and would like to port some Python code that I've written to Jython. In order to do this quickly, I need a NumPy clone for Jython (or Java). I...

Ghostscript PDF -> TIFF throws an untrappable exception, when consuming files with asian fonts

Ghostscript curls up and dies, throwing an exception to stdout which I cannot catch and log. I am pretty sure it gets sick when I give it asian fonts. Has anybody backed into this problem and solved it? ...

How do I skip processing the attachments of an email which is an attachment of a different email.

using jython I have a situation where emails come in with different attachments. Certain file types I process others I ignore and dont write to file. I am caught in a rather nasty situation, because sometimes people send an email as an attachment, and that attached email has legal attachments. What I want to do is skip that attached e...

email.retr retrieves strange =20 characters when the email body has chinese characters in it.

self.logger.info(msg) popinstance=poplib.POP3(self.account[0]) self.logger.info(popinstance.getwelcome()) popinstance.user(self.account[1]) popinstance.pass_(self.account[2]) try: (numMsgs, totalSize)=popinstance.stat() self.logger.info("POP contains " + str(numMsgs) + " emails") for thisNu...

JDBC & MSSQL seem to be truncating large fields

I'm using jython 2.2.1, and jdbc 1.2 and connecting to a mssql 2000 database, writing the contents of an email to it. When I get to the body of the email which can be quite large sometimes I need to truncate the data at 5000 chars. Except mssql & jdbc gang up on me like school yard bullies, when i check the database loads of my data is m...

How do I determine if an email is Base64 encoded?

I am having difficulty determining if the body of a text email message is base64 encoded. if it is then use this line of code; making use of jython 2.2.1 dirty=base64.decodestring(dirty) else continue as normal. This is the code I have atm. What line of code will allow me to extract this from the email: "Content-Transfer-Encoding...

jython date conversion

Given a string as below, I need to convert: 1 Dec 2008 06:43:00 +0100 to MM/DD/YYYY HH:MM:SSAM using jython what is the best way to do this? ...

How do I handle Microsoft outlook winmail.dat? Any other surprises?

Hi guys Ive decided that I really dont like microsoft and their ways. Please could you give me directions on how to handle winmail.dat in emails, is there a jython library or a java library that will allow me to handle this. Ive just completed a email processing program, written in jython 2.2.1 on java 5. During the final load test, I ...

mssql handles line returns rather awkwardly

Here is the problem: for your reference: http://www.freeimagehosting.net/uploads/b443e7a1fe.jpg database entries 1,2 and 3 are made using jython 2.2.1 using jdbc1.2. database entry 4 is made using vb the old to be replace program using odbc. We have found that if I copy and paste both jython and vb MailBody entries to wordpad directl...

log4j with timestamp per log entry

Hi! this is my log output INFO main digestemails - process inbox INFO main digestemails - checking for emails in c:\development\DCMail\email\KN-Source INFO main digestemails - digesting [email protected] INFO main digestemails - extracting attachments INFO main digestemails - no attachments or no attachments su...

Get image properties with Jython

Hi All, I am using Jython to move images around and organise them. I would like to extract some information from the images like dimensions and file size. How would I go about doing this with Jython? Cheers ...