-4

I'm doing for having mqtt python.. I'm beginer

# Create a workspace directory to hold all the SDK files
mkdir sdk-workspace
  File "<ipython-input-12-5c70212e7b48>", line 2
    mkdir sdk-workspace
          ^
SyntaxError: invalid syntax

I don't know what is wrong.

I want to know what is wrong

wjandrea
  • 28,235
  • 9
  • 60
  • 81
  • Welcome to SO! Are you using a Jupyter Notebook to create a new directory? – medium-dimensional Oct 29 '22 at 19:18
  • 4
    That's a command for your operating system's command line - but you're typing it at a Python interactive prompt, instead. – jasonharper Oct 29 '22 at 19:19
  • Related: [Why does "pip install" inside Python raise a SyntaxError?](/q/8548030/4518341), [syntax error when using command line in python](/q/13961140/4518341), [Getting "SyntaxError: invalid syntax"](/q/58937650/4518341) – wjandrea Oct 29 '22 at 19:22

1 Answers1

-1

The mkdir (make directory) is an operating system command, not a command in Python..

If you want use it in python, try in function like this:

import os

os.mkdir(path, mode=0o777, *, dir_fd=None)
Evgen
  • 99
  • 7