Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What does this mean

12 REPLIES 12
Reply
Message 1 of 13
tasmanian devil
773 Views, 12 Replies

What does this mean

Howdy~
Can someone please tell me what this error message usally means: "error: bad argument type: stringp nil"?

Thanks
The Devil
12 REPLIES 12
Message 2 of 13

It means the function where the crash occured requires a string data type... but its value is empty or nil.
Message 3 of 13
t.willey
in reply to: tasmanian devil

You are passing a variable that is nil to something that wants a string.

Example
Command: (strcat "hi" nil)
; error: bad argument type: stringp nil
Message 4 of 13
Anonymous
in reply to: tasmanian devil

You get a similar message if a value that should be a text string is not empty or nil, but is some
other kind of data (e.g. a real number, an integer, a list), with that wrong value shown after the
'stringp' part. That comes up, for example, if you have a numerical value that you want to put into
a text string, and you feed it to a function like (strcat) or a Text command, but you forget to use
something like (rtos) or (itoa) on it first, to convert it into a text string. Those won't accept a
number except as a text string that happens to be made of numerical characters.

--
Kent Cooper


wrote...
It means the function where the crash occured requires a string data type... but its value is empty
or nil.
Message 5 of 13

Howdy~
Is there something that I can look for that I can take out as those edit boxes are not needed. I know that other edit boxes need to have a string to work correctly, but I just want to get rid of the two edit boxes that are no longer needed. I am looking through 175 pages of one lsp routine so anything that I know that I can just look for would help.

Thanks
The Devil
Message 6 of 13
Anonymous
in reply to: tasmanian devil

tasmanian devil wrote:
> Howdy~
> Is there something that I can look for that I can take out as those edit boxes are not needed. I know that other edit boxes need to have a string to work correctly, but I just want to get rid of the two edit boxes that are no longer needed. I am looking through 175 pages of one lsp routine so anything that I know that I can just look for would help.
>
> Thanks
> The Devil

Start VLIDE.
In vlide's Debug -menu check "Break on Error".
Load your program as .lsp files (not .fas or .vlx).
Run the program until you hit the error.
In Vlide's debug Toolbar click the "Last Break" icon.
(Or Debug menu>Last Break Source, or Alt-F9)
this should take you to the problem site.

- in an error situation, View>Trace Stack is also often useful.



--
Message 7 of 13

Howdy~
I tried what you had suggested and the only thing I get is the same error message that AutoCAD gives me. Help.

Thanks
The Devil
Message 8 of 13
pnorman
in reply to: tasmanian devil

Can you post the code (and please use the [ code ] tags) or attach the lisp file that's causing the problem. I think we need more information in order to give more help.
Message 9 of 13

Howdy~
Are you sure you want me to post the whole code¿

Thanks
The Devil
Message 10 of 13
pnorman
in reply to: tasmanian devil

Oh I see "175 pages". Can't image a lisp file with 175 pages!! Anyway I do not know of an easy way to find the error other than using vlide's debugging tools as others have suggested.

So maybe attach the lisp file?...
Anyone else have a better idea?
Message 11 of 13
Anonymous
in reply to: tasmanian devil

tasmanian devil wrote:
> Howdy~
> I tried what you had suggested and the only thing I get is the same error message that AutoCAD gives me. Help.
>

Well, of course you get the same error, if you haven't changed the
program text.

The idea here was to leave the VLIDE window open, so after you sign off
the error report, control goes to VLIDE, where Alt-F9 should take you to
the point in the program where the error was noticed.

So, how about taking a screen capture (Alt-PrintScreen) from the Trace
stack display?

More generally, if your program is 175 pages all in a single function,
the best thing you could do is scrap the whole thing. Well-written Lisp
programs are typically collections of smallish functions; I once
measured a CL program I wrote, there the average length of a function
was 14 lines (not pages!). AutoCAD stuff tends to be more repetive, but
even there a function should usually fit on the display screen.

--
Message 12 of 13

Howdy~
I would rewrite the lsp routine as it has not been updated in sixteen years. I am new to the whole lsp routine and have no idea how to rewrite the whole thing since it is a VERY complex routine in the first place. I will try what you had mentioned and get back with a post.

Thanks
The Devil
Message 13 of 13
wkiernan
in reply to: tasmanian devil

Wow yeah, I would really like to see a 175-page .lsp file. The biggest .lsp file I ever wrote was only about 4000 lines long. If you don't want to post it here, could you send a copy to wkiernan@ij.net?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost