Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX - 'str' object does not support item assignment #127

Closed
semperos opened this issue Mar 3, 2014 · 5 comments · Fixed by #128
Closed

OSX - 'str' object does not support item assignment #127

semperos opened this issue Mar 3, 2014 · 5 comments · Fixed by #128

Comments

@semperos
Copy link

semperos commented Mar 3, 2014

System specs:

  • Mac OSX 10.8.5
  • Python 2.7.2 (built-in)
  • Fig 0.2.2

My fig.yml:

image: stackbrew/ubuntu
ports:
  - 3306:3306
  - 6379:6379
links:
   - mysql
   - redis
mysql:
  image: orchardup/mysql
redis:
  image: orchardup/redis

When running fig up, I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/fig", line 9, in <module>
    load_entry_point('fig==0.2.2', 'console_scripts', 'fig')()
  File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 39, in main
    command.sys_dispatch()
  File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch
    self.dispatch(sys.argv[1:], None)
  File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 26, in dispatch
    super(Command, self).dispatch(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 24, in dispatch
    self.perform_command(*self.parse(argv, global_options))
  File "/Library/Python/2.7/site-packages/fig/cli/docopt_command.py", line 27, in perform_command
    handler(command_options)
  File "/Library/Python/2.7/site-packages/fig/cli/main.py", line 287, in up
    (old, new) = self.project.recreate_containers(service_names=options['SERVICE'])
  File "/Library/Python/2.7/site-packages/fig/cli/utils.py", line 22, in get
    x = self._property_cache[f] = f(self)
  File "/Library/Python/2.7/site-packages/fig/cli/command.py", line 75, in project
    return Project.from_config(self.project_name, config, self.client)
  File "/Library/Python/2.7/site-packages/fig/project.py", line 64, in from_config
    service['name'] = service_name
TypeError: 'str' object does not support item assignment

I tried removing everything from the fig.yml shy of the image entry, and the same error occurs regardless. Any help would be greatly appreciated.

@bfirsh
Copy link

bfirsh commented Mar 3, 2014

Everything in your fig.yml needs to be inside a service. So if, for example, your main service is a web app, it should look like this:

web:
  image: stackbrew/ubuntu
  ports:
    - 3306:3306
    - 6379:6379
  links:
    - mysql
    - redis
mysql:
  image: orchardup/mysql
redis:
  image: orchardup/redis

We should throw a better error message here though, so I'm going to leave this open.

@semperos
Copy link
Author

semperos commented Mar 3, 2014

There I go, not reading the documentation carefully enough. Thank you for a polite response and for taking the effort to improve the error messages.

@bfirsh
Copy link

bfirsh commented Mar 3, 2014

No worries – thanks for helping debug!

@bfirsh
Copy link

bfirsh commented Mar 3, 2014

Is there any part of the documentation that wasn't clear enough that we could improve?

@semperos
Copy link
Author

semperos commented Mar 3, 2014

Not sure I have specific changes I would make to your docs, but I can explain how I misread them. I thought the idea of the fig.yml was to define a primary service that might happen to be backed by other, auxiliary services, like MySQL or Redis, in which case I didn't even see the web key in the example fig.yml and thought top-level entries were for the main application image/container. The fact that everything is defined in a service makes sense.

yuval-k pushed a commit to yuval-k/compose that referenced this issue Apr 10, 2015
Fixes docker#127

Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants