Package: jython
Version: 2.1.0-20
Severity: normal

I tried this script in jython which failed:

import urllib

file = open("test.txt")
line = file.readline()
while (len(line) > 1) :
        cas = line.strip()
        code = cas.replace("-", "")
        url = "http://webbook.nist.gov/cgi/cbook.cgi/nist-3d.mol?Str3File="; + 
code
        print(url)
        output = open(cas + ".mol", "w")
        for pageline in urllib.urlopen(url) :
                output.write(pageline)
        line = file.readline()

(and it works in Python itself...)

The error I get is:

>>> while (len(line) > 1) :
...     cas = line.strip()
...     code = cas.replace("-", "")
...     url = "http://webbook.nist.gov/cgi/cbook.cgi/nist-3d.mol?Str3File="; + 
code
...     print(url)
...     output = open(cas + ".mol", "w")
...     for pageline in urllib.urlopen(url) :
...             output.write(pageline)
...     line = file.readline()
...
http://webbook.nist.gov/cgi/cbook.cgi/nist-3d.mol?Str3File=110543
Traceback (innermost last):
  File "<console>", line 7, in ?
  File "/usr/lib/python2.1/urllib.py", line 71, in urlopen
  File "/usr/lib/python2.1/urllib.py", line 176, in open
  File "/usr/lib/python2.1/urllib.py", line 277, in open_http
AttributeError: module 'httplib' has no attribute 'HTTP'

Egon                                                                    

PS. Thanx for this great work! As a Java developer Jython gives me an excellent 
development tool!

-- System Information:
Debian Release: 3.1
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.10-9-amd64-k8-smp
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages jython depends on:
ii  gij                       4:3.3.5-3      The GNU Java bytecode interpreter
ii  gij-3.3 [java1-runtime]   1:3.3.5-12     The GNU Java bytecode interpreter
ii  gij-3.4 [java1-runtime]   3.4.3-12       The GNU Java bytecode interpreter
ii  j2re1.4 [java2-runtime]   1.4.2.01-1     Blackdown Java(TM) 2 Runtime Envir
ii  kaffe-pthreads [java1-run 2:1.1.4.RC1-1  A POSIX threads enabled version of
ii  libreadline-java          0.8.0.1-3      GNU readline and BSD editline wrap
ii  perl                      5.8.4-8        Larry Wall's Practical Extraction 
ii  python2.1                 2.1.3dfsg-1    An interactive high-level object-o
ii  sablevm [java1-runtime]   1.11.3-1       Free implementation of Java Virtua
ii  sun-j2sdk1.5 [java2-runti 1.5.0+update02 Java(TM) 2 SDK, Standard Edition, 

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to