"wrong argument type nil (expected String)" from Dir.chdir

Ask a Question related to Ruby, Design and Development.

  1. #1

    Default "wrong argument type nil (expected String)" from Dir.chdir

    I'm running Ruby 1.6.8.

    Can anybody tell me why this line:

    Dir.chdir("/")

    results in the error "wrong argument type nil (expected String)" when
    running in the debugger (ruby -r debug), but not when running in irb?

    WTF?

    --
    Tim Kynerd Sundbyberg (småstan i storstan), Sweden [email]tkynerd@spamcop.net[/email]
    Sunrise in Stockholm today: 8:00
    Sunset in Stockholm today: 15:06
    My rail transit photos at [url]http://www.kynerd.nu[/url]

    Tim Kynerd Guest

  2. Similar Questions and Discussions

    1. #39588 [NEW]: unpack("a*", "abc\0") does not work as expected
      From: pprasse at actindo dot de Operating system: linux 2.6.10 PHP version: 4.4.4 PHP Bug Type: Scripting Engine problem Bug...
    2. #38820 [NEW]: chdir(".") and chdir("..") don't work with Apache 2.0+
      From: ras at fyn dot dk Operating system: Win XP SP2 PHP version: 5.1.6 PHP Bug Type: Directory function related Bug...
    3. CFINPUT type="radio" w/ "value" requires "label"
      On a Flash form, when you specify type='radio' and value='whatever', the value of the 'value' attribute will be displayed as a label if no 'label'...
    4. "Arguments are of the wrong type, out of acceptable range" error
      I'm getting an "Arguments are of the wrong type, out of acceptable range, in conflicts with each other " error , pointing to the sql statement in...
    5. convert visual basic "string" data type to DB2 "blob"
      Does anyone know if a visual basic string data type can be converted to DB2 blob datatype? I have all data in XML files and I use Visual Basic to...
  3. #2

    Default Re: "wrong argument type nil (expected String)" from Dir.chdir

    Hi,

    In message ""wrong argument type nil (expected String)" from Dir.chdir"
    on 03/11/24, Tim Kynerd <vxbrw58s02@sneakemail.com> writes:

    |Can anybody tell me why this line:
    |
    |Dir.chdir("/")
    |
    |results in the error "wrong argument type nil (expected String)" when
    |running in the debugger (ruby -r debug), but not when running in irb?

    Can't reproduce. Could you give me more information? Your platform,
    and exact version of ruby interpreter (shown by ruby -v).

    matz.


    Yukihiro Matsumoto Guest

  4. #3

    Default Re: "wrong argument type nil (expected String)" from Dir.chdir

    On Mon, 24 Nov 2003 09:20:03 +0900, Yukihiro Matsumoto wrote:
    > Hi,
    >
    > In message ""wrong argument type nil (expected String)" from Dir.chdir"
    > on 03/11/24, Tim Kynerd <vxbrw58s02@sneakemail.com> writes:
    >
    > |Can anybody tell me why this line:
    > |
    > |Dir.chdir("/")
    > |
    > |results in the error "wrong argument type nil (expected String)" when
    > |running in the debugger (ruby -r debug), but not when running in irb?
    >
    > Can't reproduce. Could you give me more information? Your platform,
    > and exact version of ruby interpreter (shown by ruby -v).
    >
    > matz.
    Thanks Matz.

    Sorry, should have posted a bit more information to start with. I'm
    running under SuSE Linux 8.2, kernel 2.4 (can't find the full version
    number). ruby -v reports:

    ruby 1.6.8 (2002-12-24) [i686-linux]

    After having problems with a similar statement as the first statement in a
    program, I tried creating a new program with just the one line I posted
    above. That shorter program also returns the "wrong argument type nil
    (expected String)" error. However, typing the same line into irb works
    fine and returns 0 (and after doing so, typing Dir.getwd into irb returns
    the expected "/").

    Grateful for any help you can provide.

    --
    Tim Kynerd Sundbyberg (småstan i storstan), Sweden [email]tkynerd@spamcop.net[/email]
    Sunrise in Stockholm today: 8:03
    Sunset in Stockholm today: 15:04
    My rail transit photos at [url]http://www.kynerd.nu[/url]

    Tim Kynerd Guest

  5. #4

    Default Re: "wrong argument type nil (expected String)" from Dir.chdir

    On Mon, 24 Nov 2003 07:24:18 +0100, Tim Kynerd wrote:
    > On Mon, 24 Nov 2003 09:20:03 +0900, Yukihiro Matsumoto wrote:
    >
    >> Hi,
    >>
    >> In message ""wrong argument type nil (expected String)" from Dir.chdir"
    >> on 03/11/24, Tim Kynerd <vxbrw58s02@sneakemail.com> writes:
    >>
    >> |Can anybody tell me why this line:
    >> |
    >> |Dir.chdir("/")
    >> |
    >> |results in the error "wrong argument type nil (expected String)" when
    >> |running in the debugger (ruby -r debug), but not when running in irb?
    >>
    >> Can't reproduce. Could you give me more information? Your platform,
    >> and exact version of ruby interpreter (shown by ruby -v).
    >>
    >> matz.
    >
    > Thanks Matz.
    >
    > Sorry, should have posted a bit more information to start with. I'm
    > running under SuSE Linux 8.2, kernel 2.4 (can't find the full version
    > number). ruby -v reports:
    >
    > ruby 1.6.8 (2002-12-24) [i686-linux]
    >
    > After having problems with a similar statement as the first statement in
    > a program, I tried creating a new program with just the one line I
    > posted above. That shorter program also returns the "wrong argument type
    > nil (expected String)" error. However, typing the same line into irb
    > works fine and returns 0 (and after doing so, typing Dir.getwd into irb
    > returns the expected "/").
    >
    > Grateful for any help you can provide.
    Sorry to be following up to myself, but here's a bit more info (that just
    came to me in the shower ;-) ).

    The following program:

    newdir = "/"
    Dir.chdir(newdir)

    throws the same error in the debugger, but on the *first* line with the
    string assignment. This gives me the strong feeling that something very
    non-obvious is going on.

    Also, a trip to /usr/src tells me I'm running kernel 2.4.20.

    --
    Tim Kynerd Sundbyberg (småstan i storstan), Sweden [email]tkynerd@spamcop.net[/email]
    Sunrise in Stockholm today: 8:03
    Sunset in Stockholm today: 15:04
    My rail transit photos at [url]http://www.kynerd.nu[/url]

    Tim Kynerd Guest

  6. #5

    Default Re: "wrong argument type nil (expected String)" from Dir.chdir


    "Tim Kynerd" <vxbrw58s02@sneakemail.com> schrieb im Newsbeitrag
    news:pan.2003.11.24.07.03.02.137518@kynerd.no-ip.com...
    > Sorry to be following up to myself, but here's a bit more info (that
    just
    > came to me in the shower ;-) ).
    >
    > The following program:
    >
    > newdir = "/"
    > Dir.chdir(newdir)
    >
    > throws the same error in the debugger, but on the *first* line with the
    > string assignment. This gives me the strong feeling that something very
    > non-obvious is going on.
    Sounds strange indeed.
    > Also, a trip to /usr/src tells me I'm running kernel 2.4.20.
    Is that the same as "uname -a" reports?

    robert

    Robert Klemme Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139