avictorgm Posted November 16, 2018 Share Posted November 16, 2018 (edited) 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 November 16, 2018 by avictorgm I found this other way Quote Link to comment
PatW Posted November 16, 2018 Share Posted November 16, 2018 (edited) Hi avictorgm, I would recommend the python functions for file stuff: with open ("file.txt", 'w') as file: file.writeline ("xxx"); Edited November 16, 2018 by PatW Quote Link to comment
Myke Posted January 12, 2022 Share Posted January 12, 2022 Is there any way for the imported file to be another file extension? In my testing the FileOpenDialog only looks for .txt and nothing else. I would like to use json as it would match the json that is being exported. Quote Link to comment
Jayme McColgan Posted January 20, 2022 Share Posted January 20, 2022 (edited) @Myke i use the built in python functions to open files. i have a few plugins that are opening and creating files and I'm not using any of the VS functions to do that. what exactly are you trying to do and i can whip up an example for you. Edited January 20, 2022 by Jayme McColgan Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.