About 782,000 results
Open links in new tab
  1. python - import sys error in pycharm 2.5.1 - Stack Overflow

    Jul 17, 2012 · You have imported sys correctly. The error occurs when tying to access sys.argv[1], which is an argument you pass to the python executable. If you just run python scriptname.py, without any other arguments, there is no sys.argv[1].

  2. python: sys is not defined - Stack Overflow

    Jul 20, 2013 · If any of the imports before the import sys line fails, the rest of the block is not executed, and sys is never imported. Instead, execution jumps to the exception handling block, where you then try to access a non-existing name.

  3. python - why does it give me error while importing sys module

    Jan 4, 2022 · It looks like you're trying to run the file inside a python shell, not the windows command line? Just run this in your cmd: The system cannot find the path specified. Search for "python.exe" or "python3.exe" in your windows search bar. Get the full path of the executable and replace it in the cmd call.

  4. NameError: name 'sys' is not defined in Python [Solved]

    Apr 8, 2024 · The Python "NameError: name 'sys' is not defined" occurs when we use the sys module without importing it first. To solve the error, import the sys module before using it - import sys. Here is an example of how the error occurs.

  5. Fix Python NameError: Name 'sys' Not Defined - PyTutorial

    Mar 3, 2025 · The NameError: Name 'sys' Not Defined is a common error in Python. It occurs when you try to use the sys module without importing it. To fix this error, simply import the sys module at the beginning of your script.

  6. Python Tutorial: What to Do If Python import sys Fails?

    Oct 2, 2024 · When you attempt to import the sys module and encounter an error, it can be due to several reasons: 1. Typographical Errors. The most straightforward reason for an import failure is a typographical error. Ensure that you are using the correct syntax: import sys. Check for any misspellings or incorrect casing, as Python is case-sensitive. 2 ...

  7. sysSystem-specific parameters and functions — Python 3.13.3 ...

    21 hours ago · On Unix, command line arguments are passed by bytes from OS. Python decodes them with filesystem encoding and “surrogateescape” error handler. When you need original bytes, you can get it by [os.fsencode(arg) for arg in sys.argv].

  8. Why can’t you import the module you just installed in Python?

    Dec 7, 2024 · Python uses a module cache (sys.modules) to store already loaded modules. If a module is imported multiple times, Python doesn’t reload it from scratch. However, this cache can sometimes...

  9. Debugging with sys.path / ImportError issues - PythonAnywhere …

    Try doing the import manually at the command line. Then, check whether they really are coming from where you think they are: from foo.bar import baz import foo print(foo.__file__) # this should show the path to the module. Is it what you expect? import sys print('\n'.join(sys.path)) # does this show the files and folders you need?

  10. python - Can't import sys or io - Stack Overflow

    Try configuring `entry` in your webpack config relative to the current working directory, or setting `context = __dirname` in your webpack config.

  11. Some results have been removed
Refresh