SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Python 3.2 and Converting RTF files to XML or Web Markup?

    I've just installed Python 3.2 and I'm trying to use the "rtf2xml.py" package found at http://pypi.python.org/pypi/rtf2xml on my Windows 64-bit box to no avail. I've installed Python 3.2 itself using their *.MSI installer and all appears okay with the installation but I'm having problems getting that rtf2xml package to work. I tried to execute the setup.py file in the rtf2xml extracted directory from my Desktop but it didn't appear to do anything except quickly flash open what I'm assuming is a Python CMD window. With that being said, I decided to go into the "scripts" directory of the rtf2xml download and simply take the rtf2xml file that was in that directory, append .py to it, and throw it into the Python 3.2 base directory's "C:\Python 3.2\Tools\Scripts" location. Doing this made it show up in the help()/modules readout but I'm still having problems actually using the darn thing.

    Anyone know where I'm dropping the ball here?

    Python 3.2 is installed at the following location:
    C:\Python_3.2\

    The scripts are at the following location:
    C:\Python_3.2\Tools\Scripts\rtf2xml.py
    C:\Python_3.2\Tools\Scripts\.rtf2xml <-- (Some sort of config file that I guess is supposed to be readable by the above, which is why I put it in the same directory--for convenience's sake.)

    I've been trying to use a mix between CMD and the IDLE GUI as follows (none of which work):
    C:\Python_3.2>python rtf2xml.py install
    C:\Users\py_idiot>C:\Python_3.2\python C:\Python_3.2\python\Tools\Scripts\rtf2xml.py C:\Users\py_idiot\Desktop\dump4.rtf

    Long story short, I'm just trying to take an RTF file I exported from a semi-old program and convert it to either XML or HTML, etc.

    Any insight into how to successfully do this is appreciated.

  2. #2
    SitePoint Wizard Wolf_22's Avatar
    Join Date
    Jul 2005
    Posts
    1,710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,278
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    Off Topic:

    Quote Originally Posted by wolf
    I tried to execute the setup.py file in the rtf2xml extracted directory from my Desktop but it didn't appear to do anything except quickly flash open what I'm assuming is a Python CMD window.
    Do you know of the raw_input() trick? It's a Python 2x thing to keep those cmd windows open, if you've got that at the end of some script (because instead of exiting, it'll wait for input).
    I don't know if input() from Python3 can do similar?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •