Help creating Controllers on Windows

21 views
Skip to first unread message

Will Canada

unread,
Jul 21, 2015, 3:21:05 PM7/21/15
to pylons-...@googlegroups.com
Good day,

Over the last few months, in my free time at work, I have created an instance of https://code.google.com/p/harstorage/ . I have this installed and working successfully.
I have since been looking to modify harstorage, so that I can successfully run casperjs scripts from a web interface.

Everything has gone swimmingly, I have been able to execute the scripts from the web, ect.. however, when I go to create a new controller to add the functionality to the project, I get various issues.

The paster controller command does not seem to work.

When ever I attempt to create a new controller using this method I get  
c:\Python27\Lib\site-packages\harstorage-1.0-py2.7.egg\harstorage\config>paster controller casperjs
Traceback (most recent call last):
  File "C:\python27\Scripts\paster-script.py", line 9, in <module>
    load_entry_point('pastescript==1.7.5', 'console_scripts', 'paster')()
  File "C:\Python27\lib\site-packages\pastescript-1.7.5-py2.7.egg\paste\script\command.py", line 93, in run
    commands = get_commands()
  File "C:\Python27\lib\site-packages\pastescript-1.7.5-py2.7.egg\paste\script\command.py", line 135, in get_commands
    plugins = pluginlib.resolve_plugins(plugins)
  File "C:\Python27\lib\site-packages\pastescript-1.7.5-py2.7.egg\paste\script\pluginlib.py", line 82, in resolve_plugins
    pkg_resources.require(plugin)
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 946, in require
    needed = self.resolve(parse_requirements(requirements))
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 798, in resolve
    requirements = list(requirements)[::-1]
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2920, in parse_requirements
    "version spec")
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2880, in scan_list
    raise RequirementParseError(msg)
pkg_resources.RequirementParseError: \ must not appear on the last nonblank line

I have an egg_info directory setup in the project, before having that I could not get this far.

Manually creating a controller and adding it to the routes and attempting to access the path results in 
Error - <type 'exceptions.AttributeError'>: 'module' object has no attribute 'CasperjsController'
File 'C:\\Python27\\lib\\site-packages\\weberror-0.10.3-py2.7.egg\\weberror\\errormiddleware.py', line 162 in __call__
  app_iter = self.application(environ, sr_checker)
File 'C:\\Python27\\lib\\site-packages\\beaker-1.7.0-py2.7.egg\\beaker\\middleware.py', line 155 in __call__
  return self.wrap_app(environ, session_start_response)
File 'C:\\Python27\\lib\\site-packages\\routes-2.1-py2.7.egg\\routes\\middleware.py', line 136 in __call__
  response = self.app(environ, start_response)
File 'C:\\Python27\\lib\\site-packages\\pylons-1.0-py2.7.egg\\pylons\\wsgiapp.py', line 106 in __call__
  controller = self.resolve(environ, start_response)
File 'C:\\Python27\\lib\\site-packages\\pylons-1.0-py2.7.egg\\pylons\\wsgiapp.py', line 239 in resolve
  return self.find_controller(controller)
File 'C:\\Python27\\lib\\site-packages\\pylons-1.0-py2.7.egg\\pylons\\wsgiapp.py', line 282 in find_controller
  mycontroller = getattr(sys.modules[full_module_name], class_name)
AttributeError: 'module' object has no attribute 'CasperjsController'


CGI Variables
-------------
  CONTENT_LENGTH: '0'
  CONTENT_TYPE: '; charset="utf-8"'
  HTTP_ACCEPT: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
  HTTP_ACCEPT_ENCODING: 'gzip, deflate, sdch'
  HTTP_ACCEPT_LANGUAGE: 'en-US,en;q=0.8'
  HTTP_CACHE_CONTROL: 'max-age=0'
  HTTP_CONNECTION: 'keep-alive'
  HTTP_COOKIE: 'phaseInterval=-1'
  HTTP_HOST: 'localhost:5000'
  HTTP_USER_AGENT: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36'
  PATH_INFO: '/casperjs/exe'
  REMOTE_ADDR: '127.0.0.1'
  REQUEST_METHOD: 'GET'
  SERVER_NAME: '0.0.0.0'
  SERVER_PORT: '5000'
  SERVER_PROTOCOL: 'HTTP/1.1'


WSGI Variables
--------------
  application: <beaker.middleware.SessionMiddleware object at 0x000000000402E9B0>
  beaker.get_session: <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0x000000000402E9B0>>
  beaker.session: {'_accessed_time': 1437413361.372, '_creation_time': 1437413361.372}
  paste.httpserver.proxy.host: 'dummy'
  paste.httpserver.proxy.scheme: 'http'
  paste.httpserver.thread_pool: <paste.httpserver.ThreadPool object at 0x000000000402EB70>
  paste.registry: <paste.registry.Registry object at 0x0000000004300278>
  paste.throw_errors: True
  pylons.environ_config: {'session': 'beaker.session', 'cache': 'beaker.cache'}
  pylons.pylons: <pylons.util.PylonsContext object at 0x0000000004300940>
  pylons.routes_dict: {'action': u'exe', 'controller': u'casperjs'}
  routes.route: <routes.route.Route object at 0x000000000402E6A0>
  routes.url: <routes.util.URLGenerator object at 0x0000000004300438>
  webob.adhoc_attrs: {'language': 'en-us'}
  wsgi process: 'Multithreaded'
  wsgiorg.routing_args: (<routes.util.URLGenerator object at 0x0000000004300438>, {'action': u'exe', 'controller': u'casperjs'})

being written to the log file. I have been searching on how to get around this for a while now and have no luck. Any suggestions would be greatly welcome.

Thanks!

Will Canada

unread,
Jul 30, 2015, 3:18:06 PM7/30/15
to pylons-discuss, wi...@decipherone.com

This ended up being a syntax error in the controller file on the controller definition. Although the automated paster controller command doesn't work, manual creation is working fine.
Reply all
Reply to author
Forward
0 new messages