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

[doc] Copy file to pyodide gives TypeError: 'module' object is not callable #99

Closed
fcrozatier opened this issue Jul 6, 2023 · 1 comment · Fixed by #100
Closed

[doc] Copy file to pyodide gives TypeError: 'module' object is not callable #99

fcrozatier opened this issue Jul 6, 2023 · 1 comment · Fixed by #100

Comments

@fcrozatier
Copy link
Contributor

fcrozatier commented Jul 6, 2023

The docs suggests using a copy_files_to_pyodide decorator but the suggested (simplified) line throws an error:

from pytest_pyodide import copy_files_to_pyodide, run_in_pyodide

@copy_files_to_pyodide(file_list=["hello.txt"])
@run_in_pyodide
def test_add(selenium):
    assert 1+1 == 2

TypeError: 'module' object is not callable

So there could be a problem with the documentation.

Now if I try to use the copy_files_to_emscripten_fs from the module I get a NameError

from pytest_pyodide import copy_files_to_pyodide, run_in_pyodide

@run_in_pyodide
@copy_files_to_pyodide.copy_files_to_emscripten_fs(file_list=["hello.txt"], selenium=selenium)
def test_add(selenium):
    assert 1+1 == 2

NameError: name 'selenium' is not defined

No matter if I place the decorator before or after run_in_pyodide.

What's the correct way to copy files?

@fcrozatier
Copy link
Contributor Author

It works fine with the decorator module:

from pytest_pyodide import decorator, run_in_pyodide

@decorator.copy_files_to_pyodide(file_list=["hello.txt"])
@run_in_pyodide
def test_add(selenium):
    assert 1+1 == 2

Maybe there's some shadowing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant