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

"IndexError: tuple index out of range" on missing arguments #371

Closed
Ragnoroct opened this issue Jan 14, 2018 · 8 comments · Fixed by #372
Closed

"IndexError: tuple index out of range" on missing arguments #371

Ragnoroct opened this issue Jan 14, 2018 · 8 comments · Fixed by #372
Labels

Comments

@Ragnoroct
Copy link

image

When trying to run a subcommand without the correct amount of arguments I get a python exception.

Using conda and python 3.6
plumbum version: - plumbum=1.6.5=py36_0

@laktak
Copy link

laktak commented Jan 19, 2018

I'm having the same issue.

Workaround for now:

pip3 install --user 'plumbum==1.6.4' --upgrade

@henryiii henryiii added the Bug label Jan 19, 2018
@henryiii
Copy link
Collaborator

henryiii commented Jan 22, 2018

I'll try to get to it soon, it looks like a critical bug. I've been relocating to France from the US and have had very little internet at home for the past couple of weeks.

@henryiii
Copy link
Collaborator

Could you copy and paste a little example code to show the problem? It looks like you had a 27 line example from the screen shot. Would expedite preparing a fix.

@Ragnoroct
Copy link
Author

Ragnoroct commented Feb 6, 2018

laktak's solution worked.

This is my code.

#!/c/Users/Willy/Miniconda3/envs/scraper/python

from plumbum import cli
from plumbum import local
from pathlib import Path
import os
from scraper.scraper import scrape

class Toolman(cli.Application):
    verbose = cli.Flag(["v", "verbose"], help = "If given, I will be very talkative")

    def main(self):
        pass

@Toolman.subcommand("scrape")
class Scrape(cli.Application):
    """Scrapes the bls.gov website for data"""
    cache = cli.Flag(["c", "cache"], help = "Use sqlite3 cache for responses.")

    def main(self):
        print("Beginning Scraping")
        scrape(self.cache)
        print("Scraping Finished")

@Toolman.subcommand("deploy")
class Deploy(cli.Application):
    """Deploys Master Origin Branch -> Host defined in ~/.ssh/config"""

    def main(self, host):
        print(f"Deploying to {host}")
    
@Toolman.subcommand("validate")
class Validate(cli.Application):
    """Validates Series Data"""

    def main(self, dirPath):
        print("Validating:", dirPath)

        #Check if absolute path
        if not os.path.isabs(dirPath):
            pwd = local["pwd"]
            pwdPath = pwd().replace('\n', '')
            dirPath = os.path.normpath(os.path.join(pwdPath, dirPath))  
        print("Checking:", dirPath)

if __name__ == "__main__":
    Toolman.run()

@henryiii
Copy link
Collaborator

henryiii commented Feb 7, 2018

@Ragnoroct, have you tried the latest master? It should be fixed there. I'll check your code in the next few days and make sure it passes the latest master.

@laktak
Copy link

laktak commented Feb 7, 2018

@henryiii could you push the fix to pypi? thanks

@henryiii
Copy link
Collaborator

Should be pushed to pypi now.

@laktak
Copy link

laktak commented Feb 12, 2018

Works great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants