Jump to content

Recommended Posts

Posted

Good day to all,

My problem is when i using open fuction:

(setq file1 (open "D:\\112.csv" "r"))

and then error messenger is:

; ----- Error around expression -----
; (AL-FILE2OBJ FILEOBJ)
; in file : 
; Z:\003Kojin\028 Huu Quoc\ソフト\Lisp\Dao1.lsp
;
; error : bad argument type <#<FILE "D:/112.csv">> ; expected <STRING> at [open]

 

Anyone can help me fix that?

 

Posted

@Hữu Quốc Please send more specific information, preferably the whole lisp function and any related functions. At first glance, I do not see why that statement would cause an "Bad argument type" error. Perhaps you have a typo in your first (read-line file1), but I can't troubleshoot this issue with only one line of code. 

Posted (edited)
25 minutes ago, pkenewell said:

At first glance, I do not see why that statement would cause an "Bad argument type" error.

 

Maybe file isn't there or a different name might cause an error. Double check the path to the file.

 

(if (findfile (setq path "D:\\112.csv"))
  (setq file1 (open path "r"))
  (prompt (strcat "\n" path " Not Found"))
)

 

but like @pkenewell said need the full code.

Edited by mhupp
Posted (edited)
11 minutes ago, mhupp said:

If the file isn't there or a different name it would cause an error. Double check the path to the file.

@mhupp that is true, but  I think that generates a different error code (or no error code - see test below) than a "bad argument type" on a string value.

Command: (open "C:\\nofilehere.csv" "r")
nil

 

from (open) function in help:

image.thumb.png.7fe593f2d0add56e6e8d67c183ec8563.png

Edited by pkenewell
  • Agree 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...