Python 属性错误:模块';x';没有属性';y';

Python 属性错误:模块';x';没有属性';y';,python,google-cloud-platform,Python,Google Cloud Platform,我正在尝试将python函数移到Google云函数上,我似乎遇到了别名问题 我有一个模块,其init中包含以下内容: import tweetBot.generator, tweetBot.poster # Add aliases when this module is imported tweetBot.ebooksGen = tweetBot.generator.ebooksGen tweetBot.genreGen = tweetBot.generator.genreGen tweetB

我正在尝试将python函数移到Google云函数上,我似乎遇到了别名问题

我有一个模块,其init中包含以下内容:

import tweetBot.generator, tweetBot.poster

# Add aliases when this module is imported
tweetBot.ebooksGen = tweetBot.generator.ebooksGen
tweetBot.genreGen = tweetBot.generator.genreGen
tweetBot.variantGen = tweetBot.generator.variantGen

tweetBot.postTweet = tweetBot.poster.postTweet
然后用一个简单的
导入tweetBot
导入它

在我本地的机器上运行这个,它工作得很好,功能绝对没有问题。输出完全正确,一切正常

然而,当使用谷歌云函数运行这个程序时,我得到了以下错误:

AttributeError:模块“tweetBot”没有属性“genreGen”

这对我来说毫无意义,因为它是在导入中绝对定义的。此外,我知道这是可行的,因为它在我的本地机器上运行得非常好,完全来自同一个回购协议

忽略那些糟糕的代码,至少它是有效的。我只是不明白为什么我在谷歌云上运行它时会出现属性错误,而在本地它是绝对正常的

谢谢


编辑:在将别名调用替换为原始调用(例如
tweetBot.generator.genreGen
)之后,我仍然有相同的问题

  File "/workspace/JadeBots.py", line 18, in postGenreDefining
    tweetText, altGenreGameDebug, altGenreExtraDebug, gameText, genreText, altPostDebug = tweetBot.generator.genreGen(gameFile, genreFile, genreExtraFile, altPostFreq, altGenreGameFreq, altGenreExtraFreq)
AttributeError: module 'tweetBot' has no attribute 'generator' 

谷歌云函数在创建函数时似乎没有下载子模块


下载源代码会导致子模块文件夹为空,这解释了为什么会发生arrtibute错误。

在创建函数时,Google云函数似乎没有下载子模块

下载源代码会导致子模块文件夹为空,这解释了发生arrtibute错误的原因