首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“未找到模块”中的诡计

“未找到模块”中的诡计
EN

Stack Overflow用户
提问于 2017-08-08 18:25:20
回答 1查看 725关注 0票数 1

我正在为" Gnubik“程序编写Guile扩展脚本,在尝试使用来自”文本端口“模块的" get -string-all”函数时出错:当我从命令行启动Gnubik时,会打印错误文本,程序不会启动。当这个函数被使用在一个Guile shell脚本中时--这个问题不会发生。我安装了两个Guile软件包: 2.0和2.2。

错误文本如下:

代码语言:javascript
复制
Backtrace:
In ice-9/boot-9.scm:
 160: 10 [catch #t #<catch-closure c86380> ...]
In unknown file:
   ?: 9 [apply-smob/1 #<catch-closure c86380>]
In ice-9/eval.scm:
 505: 8 [#<procedure b5e540 at ice-9/eval.scm:499:4 (exp)> (use-modules #)]
In ice-9/psyntax.scm:
1107: 7 [expand-top-sequence ((use-modules (ice-9 textual-ports))) () ...]
 990: 6 [scan ((use-modules (ice-9 textual-ports))) () ...]
 279: 5 [scan ((# #) #(syntax-object *unspecified* # #)) () (()) ...]
In ice-9/boot-9.scm:
3622: 4 [process-use-modules (((ice-9 textual-ports)))]
 712: 3 [map #<procedure c1ab40 at ice-9/boot-9.scm:3622:25 (mif-args)> ((#))]
3623: 2 [#<procedure c1ab40 at ice-9/boot-9.scm:3622:25 (mif-args)> (#)]
2903: 1 [resolve-interface (ice-9 textual-ports) #:select ...]
In unknown file:
   ?: 0 [scm-error misc-error #f ...]

ERROR: In procedure scm-error:
ERROR: no code for module (ice-9 textual-ports)

欺诈代码:

代码语言:javascript
复制
(use-modules (ice-9 textual-ports))

(call-with-input-file "/tmp/tst.txt" 
    (lambda (port)
        (define s (get-string-all port))))

如何纠正这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-08-08 18:40:13

根据文档“(使用-模块(rnrs io端口))”。

为我工作。

编辑:在guile-2.0中,我看到get-string-all是由'(rnrs io端口)‘模块提供的,但在guile-2.2中,它是由'(rnrs io端口)’和'(ice-9文本-端口)‘模块提供的。

所以有两个问题。首先,您试图在guile-2.0中加载“(ice-9文本端口)”模块,因为它只由guile-2.2提供,因此无法工作。其次,您的lambda表单中没有表达式,它只需要返回get-string-all应用程序的值。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45575513

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档