Tcl 包要求HTTP不工作
我在使用“包需要http”时遇到问题。如果我只有一个带有该行的tcl文件,则会出现以下错误:Tcl 包要求HTTP不工作,tcl,Tcl,我在使用“包需要http”时遇到问题。如果我只有一个带有该行的tcl文件,则会出现以下错误: can't set "formMap": variable is array while executing "variable formMap [array get map]" (procedure "init" line 15) invoked from within "init" (in namespace eval "::http" script line 42) invoked from wi
can't set "formMap": variable is array
while executing
"variable formMap [array get map]"
(procedure "init" line 15)
invoked from within
"init"
(in namespace eval "::http" script line 42)
invoked from within
"namespace eval http {
# Allow resourcing to not clobber existing data
variable http
if {![info exists http]} {
array set http {
-ac..."
(file "/usr/local/naviserver4910/lib/tcl8/8.4/http-2.7.13.tm" line 16)
invoked from within
"source -encoding utf-8 /usr/local/naviserver4910/lib/tcl8/8.4/http-2.7.13.tm"
("package ifneeded http 2.7.13" script)
invoked from within
"package require http"
("uplevel" body line 2)
invoked from within
"uplevel {
package require http
invalid command name "http::geturl"
while executing
"http::geturl "https://google.com""
("uplevel" body line 4)
invoked from within
"uplevel {
catch {namespace delete ::http}
package require http
http::geturl "https://google.com"
set user_id [ad_conn user_id]
set events_o..."
(procedure "code::tcl::/web/dev/nnab-codebook/packages/ctrl-ars/www/inde..." line 2)
invoked from within
"uplevel {
if { [file exists $__adp_stub.tcl] } {
# ensure that data source preparation procedure exists and is up-to-date
..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare"
invoked from within
"template::adp_parse [file rootname [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 6)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "::nsf::procs::rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$extra_url""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$extra_url"
set tcl_url2file([ad_conn url]) [ad_conn file]
set ..."
有人能帮我解决这个问题吗?多谢各位
编辑-->包括以下内容:
catch {namespace delete ::http}
我遵循了以下程序包要求http:
http::geturl "https://google.com"
但是,我现在得到以下错误:
can't set "formMap": variable is array
while executing
"variable formMap [array get map]"
(procedure "init" line 15)
invoked from within
"init"
(in namespace eval "::http" script line 42)
invoked from within
"namespace eval http {
# Allow resourcing to not clobber existing data
variable http
if {![info exists http]} {
array set http {
-ac..."
(file "/usr/local/naviserver4910/lib/tcl8/8.4/http-2.7.13.tm" line 16)
invoked from within
"source -encoding utf-8 /usr/local/naviserver4910/lib/tcl8/8.4/http-2.7.13.tm"
("package ifneeded http 2.7.13" script)
invoked from within
"package require http"
("uplevel" body line 2)
invoked from within
"uplevel {
package require http
invalid command name "http::geturl"
while executing
"http::geturl "https://google.com""
("uplevel" body line 4)
invoked from within
"uplevel {
catch {namespace delete ::http}
package require http
http::geturl "https://google.com"
set user_id [ad_conn user_id]
set events_o..."
(procedure "code::tcl::/web/dev/nnab-codebook/packages/ctrl-ars/www/inde..." line 2)
invoked from within
"uplevel {
if { [file exists $__adp_stub.tcl] } {
# ensure that data source preparation procedure exists and is up-to-date
..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare"
invoked from within
"template::adp_parse [file rootname [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 6)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "::nsf::procs::rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$extra_url""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$extra_url"
set tcl_url2file([ad_conn url]) [ad_conn file]
set ..."
看起来您/NaviServer正在解释器中以某种方式重新加载http包,该解释器已经加载了不同版本的http包。真奇怪 更奇怪的是,http库最年轻的版本可以追溯到2004年;它在http 2.5.0中进行了更改,并在2005年初升级到该版本。(显然是我做的,但我真的不记得了。)更改应用于Tcl 8.4和8.5版本(以及8.6和更高版本),因此我非常确定您使用的古老版本确实不值得使用。这是那些足够老的版本的上限,足以触发你所看到的行为;他们可能比这更老 总而言之,这确实很奇怪。您实际上不应该将包的不同版本加载到单个Tcl解释器中。这并不是一个特别受支持的使用模式(主要是因为大多数软件包无法很好地卸载它们的状态,因为很难很好地完成)
解决方法是在
程序包需要之前执行此操作:
catch {namespace delete ::http}
你好,多纳尔,谢谢你的回复。我已经在代码中包含了更改,但仍然有错误。我已经在帖子的顶部包含了错误消息。非常感谢。