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

Not execute script in Python3 ou JavaScript #295

Open
mtibes opened this issue Sep 27, 2024 · 1 comment
Open

Not execute script in Python3 ou JavaScript #295

mtibes opened this issue Sep 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mtibes
Copy link

mtibes commented Sep 27, 2024

import datetime

def main() -> dict:
now = datetime.datetime.now()
diaAtual = now.strftime('%d/%m/%Y %H:%M:%S')
dia_semana_num = now.weekday()
dias_semana = ['segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado', 'domingo']
diaSemana = dias_semana[dia_semana_num]
return {
"diaAtual": diaAtual,
"diaSemana": diaSemana
}

Traceback (most recent call last): File "/tmp/code/520547f5_5acc_4911_b3dc_6dfbb6fc4f87.py", line 26, in ModuleNotFoundError: No module named 'datetime' error: exit status 255

Copy link

dosubot bot commented Sep 27, 2024

Hello, @mtibes! I'm here to help you with any coding issues or questions you may have. Let's tackle this together!

The error you're encountering, ModuleNotFoundError: No module named 'datetime', suggests that the datetime module is not available in your Python environment. However, datetime is a standard library module in Python and should be available by default.

Here are a few steps to troubleshoot and resolve this issue:

  1. Ensure Correct Python Version: Make sure you are using Python 3.10.x, as the codebase is designed to work with this version [1].

  2. Check Python Environment: Verify that your Python environment is correctly set up. If you are using pyenv, you can switch to the correct version with:

    pyenv global 3.10
  3. Verify Module Availability: Open a Python shell and try importing the datetime module directly to see if it works:

    import datetime
    print(datetime.datetime.now())
  4. Reinstall Python: If the module is still not found, consider reinstalling Python 3.10.x using pyenv:

    pyenv install 3.10
    pyenv global 3.10
  5. Check Virtual Environment: If you are using a virtual environment, ensure it is activated and correctly set up. You can create and activate a virtual environment using venv:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  6. Dependency Management: If you are using Poetry for dependency management, ensure that the environment is using the correct Python version:

    poetry env use 3.10
    poetry install

Following these steps should help resolve the ModuleNotFoundError for the datetime module.

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the bug Something isn't working label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant