Jump to content

Problem reading data from file


Recommended Posts

Hi,

I'm having trouble reading data from a file that will be used for parametric processing and I can't seem to get the vs.Read() function to work. Here is a portion of my script.


import vs
import os

isFileSelected, fileName = vs.GetFileN("Select the part list file:", "~/Documents", "txt")
if isFileSelected:
vs.Open( fileName )
partName = vs.Read()
width = vs.Read()
length = vs.Read()

The file seems to open as expected, but I then I get the following:

File "", line 7, in

AttributeError: 'module' object has no attribute 'Read'

The file I'm reading is tab delimited and currently contains just the part names and their associated width and length.

I have a feeling I missing something simple like formatting or an include.

Also, I have quite a bit programming experience with VectorScript but would like to transition to Python. Is there a good source for example Vectorworks Python scripts beyond the few that are on the developers page?

Thanks in advance,

Jozsef

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...