#🔒 Syntax error

14 messages · Page 1 of 1 (latest)

thick lion
#

Code:

    try:
        new_results = Parallel(n_jobs=2)(
            delayed(analyze_subject)(subj) 
            for subj in tqdm(subjects, desc="Processing Subjects")
    except Exception as e:
        print(f"Parallel processing failed: {str(e)}")
        new_results = []

Error:

6.3s    1    Traceback (most recent call last):
6.3s    2      File "<string>", line 1, in <module>
6.3s    3      File "/usr/local/lib/python3.10/dist-packages/papermill/execute.py", line 131, in execute_notebook
6.3s    4        raise_for_execution_errors(nb, output_path)
6.3s    5      File "/usr/local/lib/python3.10/dist-packages/papermill/execute.py", line 251, in raise_for_execution_errors
6.3s    6        raise error
6.3s    7    papermill.exceptions.PapermillExecutionError: 
6.3s    8    ---------------------------------------------------------------------------
6.3s    9    Exception encountered at "In [1]":
6.3s    10      File "<ipython-input-1-5e1cca89f882>", line 277
6.3s    11        new_results = Parallel(n_jobs=2)(
6.3s    12                                        ^
6.3s    13    SyntaxError: '(' was never closed
trail perchBOT
#

@thick lion

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

haughty locust
#

Do you see the message about '(' never closed?

thick lion
#

not working

#

can you check if its closed

haughty locust
#

how did you try to fix it?

#

and where did you get this code from?

thick lion
haughty locust
#

tbh, i don't understand the structure here, or where the paren should go

wise narwhal
#

Count your bracket

thick lion
#

ok i fixed it

trail perchBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.