[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Invalid Data Source Name

Bryan Richardson

12/20/2007 9:42:00 PM

[Note: parts of this message were removed to make it a legal post.]

Hello,

Does anyone know what causes the "Invalid Data Source Name" exception? I
get this from OptionParser. Here's my code:

opts = OptionParser.new
opts.on('--load-file FILE') do |file|
<do something with file>
end

begin
opts.parse!(ARGV)
rescue Exception => e
puts e, "", opts
exit 0
end

when I run this, I get the following output:

#:~/devel$ ./program --load-file test.txt
Invalid Data Source Name


Usage: program [options]
-- load-file FILE
#:~/devel$

Any suggestions?! Thanks! -- BTR

2 Answers

Adam Shelly

12/20/2007 10:09:00 PM

0

On 12/20/07, Bryan Richardson <btricha@gmail.com> wrote:
> Hello,
>
> Does anyone know what causes the "Invalid Data Source Name" exception? I
> get this from OptionParser. Here's my code:
>
> opts = OptionParser.new
> opts.on('--load-file FILE') do |file|
> <do something with file>
> end
>

my guess is that the exception is coming from your mysterious <do
something with file>, since I can't recreate the behavior no matter
what filename I pass, even an invalid one.

Bryan Richardson

12/20/2007 11:46:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

Thanks for responding. Actually, I'm an idiot and wasn't passing "DB:PG:"
along with the name of my database. You are correct in that the problem was
in my "<do something with file> section of the code. Sorry for the useless
post!!! -- BTR

On Dec 20, 2007 3:09 PM, Adam Shelly <adam.shelly@gmail.com> wrote:

> On 12/20/07, Bryan Richardson <btricha@gmail.com> wrote:
> > Hello,
> >
> > Does anyone know what causes the "Invalid Data Source Name" exception?
> I
> > get this from OptionParser. Here's my code:
> >
> > opts = OptionParser.new
> > opts.on('--load-file FILE') do |file|
> > <do something with file>
> > end
> >
>
> my guess is that the exception is coming from your mysterious <do
> something with file>, since I can't recreate the behavior no matter
> what filename I pass, even an invalid one.
>
>