Skip to content

Issues importing FileUtils #16

@Trouler

Description

@Trouler

I've been running into issues ever since you updated to start using classes, so for about 3 weeks now. As I was kind of busy atm, I simply decided to use the old version to keep my automated tests running. But I would obviously like to run the latest version.
I'm kinda new to programming, so bare with me.

The problem I'm getting is importing FileUtils, as the import of NSV can't seem to find utils for me.
I've been having some issues lately and decided to reinstall Python to have a clean go at it, but I still end up with the same problem of cannot import name 'FileUtils' from 'utils'.

This seems to be a problem of where my utils package is installed, hence the reinstall of Python in hopes of fixing it. I managed to solve the problem by going 1 directory up in the import. As such, I changed line 3 of naughty_string_validator.py to from .utils import FileUtils.

This solves my problem locally. I asked a colleague to try this out as well, and he ended up having the exact same problem, with the same solution to fix it.

As I'm quite the noob when it comes to this, I have no idea if the problem is on our end, and how we've both, in that case, have managed to screw up our filepaths for utils.

As I'm running my automated test suite in Codebuild in AWS, I figured I'd try there as well, and I run into the same exact issue on a machine that runs on a clean python:3.7-alpine image.

ImportError while loading conftest '/app/tests/conftest.py'.
tests/conftest.py:10: in
import connect
connect.py:12: in
from tests.fixtures import _is_subset
tests/fixtures/init.py:13: in
import naughty_string_validator as nsv
/usr/local/lib/python3.7/site-packages/naughty_string_validator/init.py:6: in
from .naughty_string_validator import Naughty
/usr/local/lib/python3.7/site-packages/naughty_string_validator/naughty_string_validator.py:3: in
from utils import FileUtils
E ModuleNotFoundError: No module named 'utils'

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions