2015-09-13 71 views
0

金字塔项目我这是在其他系统中运行良好金字塔项目。我已经将该项目移至使用anaconda-python的系统。除此之外,所有其他需要的库和包都存在。金字塔项目失败,出现以下错误开始..错误而开始在Pycharm

Traceback (most recent call last): 
    File "C:\Program Files (x86)\JetBrains\PyCharm 4.5.4\helpers\pycharm\pycharm_load_entry_point.py", line 8, in <module> 
    load_entry_point(dist, "console_scripts", name)() 
    File "C:\Users\abc\Anaconda\lib\site-packages\pyramid\scripts\pserve.py", line 58, in main 
    return command.run() 
    File "C:\Users\abc\Anaconda\lib\site-packages\pyramid\scripts\pserve.py", line 257, in run 
    vars = self.get_options() 
    File "C:\Users\abc\Anaconda\lib\site-packages\pyramid\scripts\pserve.py", line 197, in get_options 
    return parse_vars(restvars) 
    File "C:\Users\abc\Anaconda\lib\site-packages\pyramid\scripts\common.py", line 15, in parse_vars 
    % arg) 
ValueError: Variable assignment '\\Pyramid1\\development.ini' invalid (no "=") 

Process finished with exit code 1 

development.ini文件:

### 
# app configuration 
# http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/environment.html 
### 

[app:main] 
use = egg:Pyramid1 

pyramid.reload_templates = true 
pyramid.debug_authorization = false 
pyramid.debug_notfound = false 
pyramid.debug_routematch = false 
pyramid.default_locale_name = en 
pyramid.includes = 
    pyramid_debugtoolbar 
    pyramid_tm 
    pyramid_chameleon 
# mysql+mysqldb://<user>:<password>@<host>[:<port>]/<dbname> 
sqlalchemy.url = mysql+mysqldb://root:@127.0.0.1:3306/db1 
sqlalchemy2.url = mysql+mysqldb://root:@127.0.0.1:3306/db2 
# By default, the toolbar only appears for clients from IP addresses 
# '127.0.0.1' and '::1'. 
# debugtoolbar.hosts = 127.0.0.1 ::1 

### 
# wsgi server configuration 
### 

[server:main] 
use = egg:waitress#main 
host = 0.0.0.0 
port = 6543 

### 
# logging configuration 
# http://docs.pylonsproject.org/projects/pyramid/en/1.5-branch/narr/logging.html 
### 

[loggers] 
keys = root, sqlalchemy 

[handlers] 
keys = console 

[formatters] 
keys = generic 

[logger_root] 
level = INFO 
handlers = console 

[logger_pyramid1] 
level = DEBUG 
handlers = 
qualname = pyramid1 

[logger_sqlalchemy] 
level = INFO 
handlers = 
qualname = sqlalchemy.engine 
# "level = INFO" logs SQL queries. 
# "level = DEBUG" logs SQL queries and results. 
# "level = WARN" logs neither. (Recommended for production systems.) 

[handler_console] 
class = StreamHandler 
args = (sys.stderr,) 
level = NOTSET 
formatter = generic 

[formatter_generic] 
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s 

我在森蚺使用python 27。和pycharm 4.5.4

回答

0

你有单节定义了两次pyramid.includes:

尝试:

[app:main] 
use = egg:Pyramid1 

pyramid.reload_templates = true 
pyramid.debug_authorization = false 
pyramid.debug_notfound = false 
pyramid.debug_routematch = false 
pyramid.default_locale_name = en 
pyramid.includes = pyramid_debugtoolbar 
    pyramid_tm 
    pyramid_chameleon 
... 
+0

我试过了。这没有奏效。还是一样的错误。 –

+0

你可以发布你的更新的development.ini文件吗?生病测试本地 –

+0

我已编辑在我的身边 –

0

诊断此类问题的方法是打开源文件错误所在(C:\Users\abc\Anaconda\lib\site-packages\pyramid\scripts\common.py)并添加一些日志记录。根据Pyramid git repo有问题的功能是parse_vars。做这样的事情,这将提供即时的见解:

脚本语言的
def parse_vars(args): 
    """ 
    Given variables like ``['a=b', 'c=d']`` turns it into ``{'a': 
    'b', 'c': 'd'}`` 
    """ 
    print("parse_vars called with:", args) 
    result = {} 
    for arg in args: 
     print("parsing:", arg) 
     if '=' not in arg: 
      print("Not happy with %s, going to raise an exception" % arg) 
      raise ValueError(
       'Variable assignment %r invalid (no "=")' 
       % arg) 
     name, value = arg.split('=', 1) 
     result[name] = value 
    return result 

奇迹,你甚至可以捅到Python的标准库函数:)只是不要忘了改回来时,即可大功告成。

现在,看着你的回溯,它变得很明显,该函数得到错误的输入 - 而不是格式'a=b'的字符串它得到'\\Pyramid1\\development.ini'。如果你看看到pserve.py,你会看到这是它更相关的解析传递给脚本的命令行参数 - 您的应用程序甚至还没有加载您的.ini文件呢。