Read File (File) component not working


#1

The Read File (File) component is throwing 2 errors in the latest Rhino for Mac WIP (5.2 5c95W).

The errors are:

  1. Before solution exception:Error running vbnc:Cannot find specified file
  2. There is no valid parser available

This is happening on OS X 10.10.5 trying to read a basic .txt file in both “per line” or “whole file” mode.


(Luis Fraguada) #2

Thanks for reporting. This is a known issue: http://mcneel.myjetbrains.com/youtrack/issue/MR-2471


#3

Oh, I checked the list of known issues but couldn’t find it there.

When you do implement it, can you make sure for it to support network paths (ie. UNC paths), because the Windows version is really rubbish at that. It works, but freezes GH for several minutes (same for image sampler).


(qythium) #4

2 years later and apparently the issue hasn’t been fixed yet…
In case anyone comes across this, here’s a really simple 2-line Python script that achieves the same thing for text files (i.e. non-binary, no parsing done):

with open(path, 'r') as fp:
    contents = fp.read()
  • just replace read() with readlines() for Per Line functionality)


(Jplengephilau) #5

Thanks for this! I just started using Grasshopper and I created an account just to thank you!


(Yafimski) #6

Hi @qythium

I’ve tried running exactly the script you mention but I get as an error:

  1. Runtime error (UnboundNameException): name ‘path’ is not defined
    Traceback:
    line 1, in script

What could be the problem…?

Thanks!


#7

Did you rename the default ‘x’ input as ‘path’? And the ‘a’ output as ‘contents’?


rdFile.gh (4.4 KB)


(Yafimski) #8

Thanks Joseph that was it.