gpt4 book ai didi

python - 如何修复三重引号 ""上的 python 无效语法“

转载 作者:太空宇宙 更新时间:2023-11-03 12:48:32 26 4
gpt4 key购买 nike

<分区>

我在尝试使用 make 构建 rabbitmq 服务器时在 codegen.py 上遇到错误。我正在为 i686-pc-cygwin 使用 64 位 Windows 7、Python33、erl5.10.3、cygwin 和 GNU Make 4.0。我读到 python 接受三引号。我该如何解决这个问题?

D:\cygwin\bin\make
Makefile:378: deps.mk: No such file or directory
python codegen.py body ../rabbitmq-codegen//amqp-rabbitmq-0.9.1.json ../rabbitmq
-codegen//credit_extension.json src/rabbit_framing_amqp_0_9_1.erl
File "codegen.py", line 110
%%"""
^
SyntaxError: invalid syntax
Makefile:144: recipe for target 'src/rabbit_framing_amqp_0_9_1.erl' failed
make: *** [src/rabbit_framing_amqp_0_9_1.erl] Error 1

codegen.py 直到出现错误的地方(最后一行代码):

##  The contents of this file are subject to the Mozilla Public License
## Version 1.1 (the "License"); you may not use this file except in
## compliance with the License. You may obtain a copy of the License
## at http://www.mozilla.org/MPL/
##
## Software distributed under the License is distributed on an "AS IS"
## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
## the License for the specific language governing rights and
## limitations under the License.
##
## The Original Code is RabbitMQ.
##
## The Initial Developer of the Original Code is GoPivotal, Inc.
## Copyright (c) 2007-2013 GoPivotal, Inc. All rights reserved.
##

from __future__ import nested_scopes

import sys
sys.path.append("../rabbitmq-codegen") # in case we're next to an experimental revision
sys.path.append("codegen") # in case we're building from a distribution package

from amqp_codegen import *
import string
import re

# Coming up with a proper encoding of AMQP tables in JSON is too much
# hassle at this stage. Given that the only default value we are
# interested in is for the empty table, we only support that.
def convertTable(d):
if len(d) == 0:
return "[]"
else:
raise Exception('Non-empty table defaults not supported ' + d)

erlangDefaultValueTypeConvMap = {
bool : lambda x: str(x).lower(),
str : lambda x: "<<\"" + x + "\">>",
int : lambda x: str(x),
float : lambda x: str(x),
dict: convertTable,
unicode: lambda x: "<<\"" + x.encode("utf-8") + "\">>"
}

def erlangize(s):
s = s.replace('-', '_')
s = s.replace(' ', '_')
return s

AmqpMethod.erlangName = lambda m: "'" + erlangize(m.klass.name) + '.' + erlangize(m.name) + "'"

AmqpClass.erlangName = lambda c: "'" + erlangize(c.name) + "'"

def erlangConstantName(s):
return '_'.join(re.split('[- ]', s.upper()))

class PackedMethodBitField:
def __init__(self, index):
self.index = index
self.domain = 'bit'
self.contents = []

def extend(self, f):
self.contents.append(f)

def count(self):
return len(self.contents)

def full(self):
return self.count() == 8

def multiLineFormat(things, prologue, separator, lineSeparator, epilogue, thingsPerLine = 4):
r = [prologue]
i = 0
for t in things:
if i != 0:
if i % thingsPerLine == 0:
r += [lineSeparator]
else:
r += [separator]
r += [t]
i += 1
r += [epilogue]
return "".join(r)

def prettyType(typeName, subTypes, typesPerLine = 4):
"""Pretty print a type signature made up of many alternative subtypes"""
sTs = multiLineFormat(subTypes,
"( ", " | ", "\n | ", " )",
thingsPerLine = typesPerLine)
return "-type(%s ::\n %s)." % (typeName, sTs)

def printFileHeader():
print """%% Autogenerated code. Do not edit.
%%
%% The contents of this file are subject to the Mozilla Public License
%% Version 1.1 (the "License"); you may not use this file except in
%% compliance with the License. You may obtain a copy of the License
%% at http://www.mozilla.org/MPL/
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and
%% limitations under the License.
%%
%% The Original Code is RabbitMQ.
%%
%% The Initial Developer of the Original Code is GoPivotal, Inc.
%% Copyright (c) 2007-2013 GoPivotal, Inc. All rights reserved.
%%"""

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com