Skip to content
Advertisement

Tag: command-line

Can I run Jupyter notebook cells in commandline?

I am deploying a Python package, and I would like to run a simple test to see if all cells in my notebook will run without errors. I would like to test this via commandline as I have issues running a notebook in virtualenv. Is there are simple command-line way to test this? Note to the moderator: this question has

NLTK: Package Errors? punkt and pickle?

Basically, I have no idea why I’m getting this error. Just to have more than an image, here is a similar message in code format. As it is more recent, the answer of this thread has already been mentioned in the message: Answer Perform the following: Then when you receive a window popup, select punkt under the identifier column which

Printing a file and configure printer settings

I’m trying to code a printer automation using Python on Windows, but can’t get it done. I’m not really understanding the topic and i’m a little surprised – a “simple” way to get this done doesn’t seem to exist..? There are so many APIs that allow to access common things in a nice and easy way, but printing seems to

Python subprocess and user interaction

I’m working on a GUI front end in Python 2.6 and usually it’s fairly simple: you use subprocess.call() or subprocess.Popen() to issue the command and wait for it to finish or react to an error. What do you do if you have a program that stops and waits for user interaction? For example, the program might stop and ask the

Get selected subcommand with argparse

When I use subcommands with python argparse, I can get the selected arguments. So args doesn’t contain ‘foo’. Simply writing sys.argv[1] doesn’t work because of the possible global args. How can I get the subcommand itself? Answer The very bottom of the Python docs on argparse sub-commands explains how to do this: You can also use the set_defaults() method referenced

Read from File, or STDIN

I’ve written a command line utility that uses getopt for parsing arguments given on the command line. I would also like to have a filename be an optional argument, such as it is in other utilities like grep, cut etc. So, I would like it to have the following usage How can I implement the following? if a filename is

Advertisement