SketchUcation Premium Membership

 

 

File.dirname(__FILE__) returns nil?

File.dirname(__FILE__) returns nil?

Postby Whaat » Thu Apr 26, 2012 3:48 pm

Thread title says the problem. I received a support email and it seems as though this code is returning nil on his system. Has anyone experienced this and figured out why?

Thanks.
Whaat
 
Posts: 966
Joined: Wed Nov 14, 2007 9:51 pm
Location: Saskatchewan, Canada
Name: Dale Martens
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: File.dirname(__FILE__) returns nil?

Postby TIG » Thu Apr 26, 2012 3:51 pm

Is it inside a compiled rbs file or a rb file.
If it's used inside a rbs it might refer to the wrong 'variable', as its not then specific to that loading file.
What is the exact context ?
TIG
User avatar
TIG
Global Moderator
 
Posts: 13929
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: File.dirname(__FILE__) returns nil?

Postby Whaat » Thu Apr 26, 2012 5:05 pm

TIG wrote:Is it inside a compiled rbs file or a rb file.
If it's used inside a rbs it might refer to the wrong 'variable', as its not then specific to that loading file.
What is the exact context ?

It's in an RB file (I believe you have it :) ) that is located in the plugins/sketchuv folder:

The code inside the file is:

Code: Select all
Sketchup.load(File.join(File.dirname(__FILE__),"sketchuv.rbs"))


and the user is getting this error when SketchUp loads:

Error Loading File sketchuv_load.rb
(eval):3076:in `join': can't convert nil into String

I have since found out that the user is using SU8.1 and OSX 10 (not too helpful info)
Whaat
 
Posts: 966
Joined: Wed Nov 14, 2007 9:51 pm
Location: Saskatchewan, Canada
Name: Dale Martens
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: File.dirname(__FILE__) returns nil?

Postby Dan Rathbun » Thu Apr 26, 2012 5:55 pm

I don't think that is the line with the error.

Check in "sketchuv.rbs", around line 3075 (give or take a few lines,) for a join statement.

You need to note the line number, in the file that loads "sketchuv_load.rb" add 1 (for the 1 line in "sketchuv_load.rb",) then subtract that number of lines from the 3076 reported in the Sketchup.load error. That will give you a better idea of the number of lines into the rbs file, where the error should be.
User avatar
Dan Rathbun
Top SketchUcator
 
Posts: 4069
Joined: Tue Oct 06, 2009 3:06 am
Location: Florida, USA
Name: Dan Rathbun
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: education
Level of SketchUp: Advanced

Re: File.dirname(__FILE__) returns nil?

Postby Whaat » Thu Apr 26, 2012 6:47 pm

Weird, now the user says the problem is not occurring anymore without any explanation. Lovely! :roll:

Sorry for wasting your time Dan,TiG. Thanks for the help!
Whaat
 
Posts: 966
Joined: Wed Nov 14, 2007 9:51 pm
Location: Saskatchewan, Canada
Name: Dale Martens
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Need SketchUp Books, Models, Styles or Textures? Check out our One Stop Shop for SketchUp.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012


Return to Developers' Forum

Who is online

Users browsing this forum: IntraLogiStix , plyn and 2 guests