spenczar / lektor-s3

Plugin to deploy a Lektor project to an S3 bucket
MIT License
44 stars 10 forks source link

Error after posixification changes #13

Closed heldinz closed 8 years ago

heldinz commented 8 years ago

I received the following error when deploying to S3 with the latest change to path posixification changes:

Traceback (most recent call last):
  File "/usr/local/bin/lektor", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/lektor/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/lektor/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/lektor/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/lektor/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/lektor/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/lektor/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/local/lib/lektor/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/lektor/lib/python2.7/site-packages/lektor/cli.py", line 290, in deploy_cmd
    for line in event_iter:
  File "/Users/alice/Projects/lektor-s3/lektor_s3.py", line 254, in publish
    diff = self.compute_diff(local, remote)
  File "/Users/alice/Projects/lektor-s3/lektor_s3.py", line 146, in compute_diff
    key = posixify(self.key_prefix + f)
  File "/Users/alice/Projects/lektor-s3/lektor_s3.py", line 279, in posixify
    return posixpath.join(*split_path(path))
TypeError: join() takes at least 1 argument (0 given)

It was never entering the while loop in split_path because os.path.split(path) was always returning an array where the first element was an empty string. I fixed this for myself by changing the initialization of last_split from an empty string to None. The tests pass but I'm not 100% sure if it's the way to go since I don't really know why the problem occurred in the first place. I have opened a PR anyway.

florin-suciu commented 8 years ago

Jut wanted to say I ran into the same error yesterday. I'm on windows with a fresh install of lektor and lektor s3. @heldinz fix worked for me too.