小编Chr*_*ris的帖子

AttributeError:'module'对象没有属性'tests'

我正在运行此命令:

python manage.py test project.apps.app1.tests
Run Code Online (Sandbox Code Playgroud)

它会导致此错误:

AttributeError:'module'对象没有属性'tests'

下面是我的目录结构.我还在我安装的应用配置中添加了app1.

Traceback (most recent call last):
    File "manage.py", line 10, in <module> execute_from_command_line(sys.argv)
    File "/home/username/local/dev/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
    File "/home/username/local/dev/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/home/username/local/dev/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 50, in run_from_argv
    super(Command, self).run_from_argv(argv)
    File "/home/username/local/dev/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
    File "/home/username/local/dev/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 71, in execute
    super(Command, self).execute(*args, **options)
    File "/home/username/local/dev/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
    File "/home/username/local/dev/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 88, in handle
    failures = test_runner.run_tests(test_labels)
    File "/home/username/local/dev/local/lib/python2.7/site-packages/django/test/runner.py", …
Run Code Online (Sandbox Code Playgroud)

python django python-2.7 python-unittest

95
推荐指数
5
解决办法
9万
查看次数

Requirements.txt大于等于然后小于?

我的需求文件中有这一行

django>=1.10,<1.11
Run Code Online (Sandbox Code Playgroud)

这是否意味着我需要拥有Django版本>= 1.10然后不到1.11

python django requirements.txt

16
推荐指数
1
解决办法
3498
查看次数

使用 q-select 通过 onChange 运行方法(Quasar Framework)

当我更改所选值时,该函数未运行。我该如何解决?这是我的代码:

<q-select
  v-model="single"
  :options="['def', 'abc', '456', '123']"
  use-chips
  label="Select One"
  @input="showChannel()"
/>
Run Code Online (Sandbox Code Playgroud)

JavaScript 代码:

methods: {
  showChannel(val) {
    console.log(val);
  }
}
Run Code Online (Sandbox Code Playgroud)

javascript onchange node.js vue.js quasar-framework

14
推荐指数
3
解决办法
2万
查看次数

XML提交给亚马逊MWS很好,但价格没有更新

我创建了自己的各种各样的复制品,但价格没有在亚马逊方面更新.

根据亚马逊提交后的响应,我的代码似乎运行得很好.我希望这里有人知道为什么它实际上没有更新价格.

这是提交的XML:

<?xml version="1.0" encoding="utf-8" ?>
<AmazonEnvelope
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
    <Header>
        <DocumentVersion>1.01</DocumentVersion>
        <MerchantIdentifier>MERCHANTID</MerchantIdentifier>
    </Header>
    <MessageType>Price</MessageType>
    <Message>
        <MessageID>1</MessageID>
        <Price>
            <SKU>mysku</SKU>
            <StandardPrice currency="USD">350.50</StandardPrice>
        </Price>
    </Message>
</AmazonEnvelope>
Run Code Online (Sandbox Code Playgroud)

继承人的回应:

GetFeedSubmissionResultResponse{}(ResponseMetadata: <Element_?/ResponseMetadata_0x7fee61f74248>, GetFeedSubmissionResultResult: <Element_?/GetFeedSubmissionResultResult_0x7fee61f74248>, AmazonEnvelope: 
{'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:noNamespaceSchemaLocation': 'amzn-envelope.xsd'}, DocumentVersion: '1.02', MerchantIdentifier: 'M_EXAMPLE_1234', Header: '\n\t', MessageType: 'ProcessingReport', MessageID: '1', DocumentTransactionID: '4200000000', StatusCode: 'Complete', MessagesProcessed: '1', MessagesSuccessful: '1', MessagesWithError: '0', MessagesWithWarning: '0', ProcessingSummary: '\n\t\t\t', ProcessingReport: '\n\t\t', Message: '\n\t')
Run Code Online (Sandbox Code Playgroud)

我不知道在这个实例中显示我的代码是否会有所帮助,因为我从亚马逊获得了成功的回复.无论如何:

...

# Provide credentials.
conn = MWSConnection(
    aws_access_key_id=AWS_ACCESS_KEY_ID,
    aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
    Merchant=AMZ_SELLER_ID
)

# Get the service resource
sqs …
Run Code Online (Sandbox Code Playgroud)

django python-3.x amazon-mws

10
推荐指数
2
解决办法
794
查看次数

谁能帮我从 Google Ads API 调试“之前加载了原型描述符”

运行此代码时出现此错误:

$googleAdsClient->getGoogleAdsServiceClient()->search($customerId, $query, $page_size);
Run Code Online (Sandbox Code Playgroud)

错误信息: proto descriptor was previously loaded (included in multiple metadata bundles?): google/ads/googleads/v5/enums/policy_topic_evidence_destination_not_working_dns_error_type.proto

$googleAdsClient 是 的一个实例\Google\Ads\GoogleAds\Lib\V5\GoogleAdsClient

getGoogleAdsServiceClient方法来自于ServiceClientFactoryTrait特质/Google/Ads/GoogleAds/Lib/V5/ServiceClientFactoryTrait.php

我在跑:

php 7.4.1
grpc module version => 1.34.0
protobuf version => 3.14.0
Run Code Online (Sandbox Code Playgroud)

通过 Composer 安装的其他库:

google/grpc-gcp                       0.1.5      gRPC GCP library for channel management
google/protobuf                       v3.13.0.1  proto library for PHP
googleads/google-ads-php              v5.0.0     Google Ads API client for PHP
grpc/grpc                             1.30.0     gRPC library for PHP
Run Code Online (Sandbox Code Playgroud)

我对描述符或 protobuf 库的了解不够,无法理解此错误。它在几天前才开始发生,我认为我们没有做出任何会影响这一点的更改。任何帮助/指导将不胜感激。

编辑:忘记链接到 SDK https://github.com/googleads/google-ads-php

编辑:更新了以下库:

google/apiclient                     v2.9.1     Client …
Run Code Online (Sandbox Code Playgroud)

php laravel protobuf-c grpc google-ads-api

6
推荐指数
1
解决办法
642
查看次数

为什么 Composer 安装突然失败?

composer install在我的本地环境和生产环境中运行,它们都失败了。这是今天才开始的。我已经查看了代码更改,并且 Composer 文件没有更改。任何人都可以对此有所了解......我不知道它可能是什么。我以为 github 宕机了,但我确实成功安装了一些软件包。我收到这样的错误:

...

  • 安装 phpunit/php-timer (2.1.2): 下载 (100%)
  • 安装 phpunit/php-text-template (1.2.1): 下载 (100%)
  • 安装 phpunit/php-file-iterator (2.0.2): Downloading (0%) Failed to download phpunit/php-file-iterator from dist: could not authentication against github.com 现在尝试从源下载
  • 安装 phpunit/php-file-iterator (2.0.2):从缓存中克隆 050bedf145
  • 安装这些er/tokenizer(1.1.3):下载(0%)无法从dist下载这些er/tokenizer:无法对github.com进行身份验证现在尝试从源下载
  • 安装这些er/tokenizer (1.1.3):从缓存中克隆 11336f6f84
  • 安装 sebastian/code-unit-reverse-lookup (1.0.1):下载 (0%) 无法从 dist 下载 sebastian/code-unit-reverse-lookup:无法对 github.com 进行身份验证 现在尝试从源下载
  • 安装 sebastian/code-unit-reverse-lookup (1.0.1):从缓存中克隆 4419fcdb5e
  • 安装 phpunit/php-code-coverage (6.1.4):下载 (0%) 无法从 dist 下载 phpunit/php-code-coverage:无法对 github.com 进行身份验证 现在尝试从源下载
  • 安装 phpunit/php-code-coverage (6.1.4):从缓存中克隆 807e6013b0
  • 安装学说/实例化器 (1.3.0): 下载 (0%) 无法从 dist …

php git github composer-php docker

4
推荐指数
1
解决办法
1353
查看次数

HTML5 FileReader问题

我正在使用谷歌浏览器浏览器,我在控制台中运行以下代码,这似乎工作,但当我在脚本中运行它不

reader = new FileReader();
reader.readAsDataURL($("input[name='image']")[0].files[0]);
alert(reader.result)
somevarname=reader.result
Run Code Online (Sandbox Code Playgroud)

控制台将结果显示为数据URL,但在脚本中,javascript不会将结果分配给变量,而alert是一个空字符串.我究竟做错了什么?

javascript google-chrome filereader

3
推荐指数
1
解决办法
6730
查看次数

我正在学习函数式编程,我想知道是否有更好的方法可以做到这一点?

有没有更“实用”的方式来做到这一点?是的,我知道它是PHP,并且我正试图将一个方形钉插入圆孔中。即使它不是功能性语言,我也希望更加注重功能性。

$c = [];
foreach ($classes as $cl) {
    $c[$cl->Id] = $cl->Name;
}
Run Code Online (Sandbox Code Playgroud)

php arrays functional-programming

0
推荐指数
1
解决办法
44
查看次数