Jump to content
avictorgm

Export text to txt using python

Recommended Posts

Hello people, 

 

I just edit because I found this way.

 

import vs
import os

Vendor = 'ACME'
Price = 123.45
Tax = 1.07

fileName = 'Classes.txt'


def Example():
	vs.GetFile(fileName)
	if not vs.DidCancel():
		vs.Rewrite(Vendor, 0)
		#vs.WriteBin(Vendor)
		#vs.WriteMac(Vendor)
		#vs.WriteLnMAC(Vendor)
		#vs.Write(Vendor)
		vs.Close(fileName)

Example()

 

 

 

But, the next attributes get this message:   "AttributeError: module 'vs' has no attribute 'WriteBin'. "

 

-vs.Write

-vs.WriteLnMac

-vs.WriteBin

-vs.WriteMac

 

With write I don't get error, but also no result.

-vs.Rewrite

 

 

Edited by avictorgm
I found this other way

Share this post


Link to post

Hi avictorgm,

 

I would recommend the python functions for file stuff:


 

with open ("file.txt", 'w') as file:

    file.writeline ("xxx");

 

Edited by PatW

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×