Code Monkey home page Code Monkey logo

Comments (15)

Krammy avatar Krammy commented on July 29, 2024 1

The same issue arises while trying to build the example project.

from django-bakery.

fsecada01 avatar fsecada01 commented on July 29, 2024

Can confirm that I am also running into this.

python manage.py build
Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    main()
  File "manage.py", line 20, in main
    execute_from_command_line(sys.argv)
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\django\core\management\__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\django\core\management\base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\bakery\management\commands\build.py", line 97, in handle
    self.set_options(*args, **options)
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\bakery\management\commands\build.py", line 143, in set_options
    if not self.fs.exists(self.build_dir):
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\fs\base.py", line 491, in exists
    self.getinfo(path)
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\fs\osfs.py", line 273, in getinfo
    _path = self.validatepath(path)
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\fs\osfs.py", line 661, in validatepath
    return super(OSFS, self).validatepath(path)
  File "C:\dev\Django Projects\FJS_Services_Site\lib\site-packages\fs\base.py", line 1477, in validatepath
    raise errors.InvalidCharsInPath(path)
fs.errors.InvalidCharsInPath: path 'C:\dev\Django Projects\FJS_Services_Site\src\storage/private/static_build/site/build/' contains invalid characters

settings file (inherits from base settings file)

from .base import *
import os

INSTALLED_APPS += [
    'bakery',
]

BUILD_DIR = os.path.join(BASE_DIR, 'storage/private/static_build/site/build/')

BAKERY_VIEWS = [
    'app_views.views.HomeView',
    'app_views.views.HomeToBeginView',
    'app_views.views.ServicesView',
    'app_views.views.UseCasesView',
    'app_views.views.AboutMeView',
    'app_views.views.ContactView',
    'app_views.views.SuccessView',
]

from django-bakery.

palewire avatar palewire commented on July 29, 2024

Is there a unicode or special character in your file name?

from django-bakery.

fsecada01 avatar fsecada01 commented on July 29, 2024

There is not.

from django-bakery.

fsecada01 avatar fsecada01 commented on July 29, 2024

Even if there was, there should be some code to filter that out. Something like:

file_path_str = [insert string code here]
file_path = file_path_str.encode('ascii', 'ignore').decode('unicode_escape')

from django-bakery.

palewire avatar palewire commented on July 29, 2024

Hmm. Any idea what's causing it? Can you give me some more information about your config or data inputs that might help us sleuth this out?

from django-bakery.

fsecada01 avatar fsecada01 commented on July 29, 2024

I believe this is a coding error on part of the module. My configurations are fairly standard for a Django project. In the base setting file, I define the base directory as follows:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(
    os.path.abspath(__file__))))

This allows me to refer to file and folder locations using relative paths, freeing me to develop within Windows and Linux environments.

from django-bakery.

palewire avatar palewire commented on July 29, 2024

I don't doubt there's a bug, I'm just struggling to find it so we can craft a patch. All of my tests are currently passing. So I suspect there is something I'm missing.

What is the path that is failing?

from django-bakery.

palewire avatar palewire commented on July 29, 2024

Are all of you guys on Windows?

from django-bakery.

fsecada01 avatar fsecada01 commented on July 29, 2024

I am on Windows 10. But my system should be OS-agnostic.

from django-bakery.

Krammy avatar Krammy commented on July 29, 2024

I'm on Windows 10. Maybe it's got something to do with my storage drive being F instead of C? That's the only reason I can think of why it's complaining of invalid characters in the path. I have two drives, one for my Windows installation which is an SSD, and one for general storage which is an HDD.

from django-bakery.

jaycle avatar jaycle commented on July 29, 2024

Just to throw my voice into the mix. I'm experiencing this issue, too. Python 3.7 in virtual environment on, windows 10.

I also can't seem to get a relative path off the project to write where I want. Specifying ./build not only tries to write to C:\build it also tries to find the static files at /static when they're in <PROJECTDIR>/static.

EDIT:
I don't know enough about osfs but just playing around a bit I noticed that changing the string osfs:/// (triple slash) to osfs:// got it at least using relative instead of off the root (C:\ in my case). I'll dig a bit more.

EDIT 2:
Okay so it looks like PyFilesystem doesn't accept any non-forward slash delimited paths, by design. Since django-bakery wants to support multiple filesystems (through BAKERY_FILESYSTEM) we would need to map all Windows paths into the unix styled ones before use. I could take a stab at a PR if this is expected to affect many people and would be useful. If not, I'll probably just run things from within a Docker container.

from django-bakery.

danizen avatar danizen commented on July 29, 2024

@jaycle, in my government workplace, most developers are expected to work on Windows, and Docker is not permitted nor is WSL (Windows sub-system for Linux). A pull request would enable me to use django-bakery for a number of projects rather than django-distill. I prefer to user interface of django-bakery because a lot less boilerplate will be needed.

from django-bakery.

danizen avatar danizen commented on July 29, 2024

This line, https://github.com/datadesk/django-bakery/blob/2c9c495e4e8faca7b81fa57635d1631933f14171/bakery/views/base.py#L150, is problematic. If PyFilesystem will not allow backslash, then paths must be concatenated without using os.path.separator.

from django-bakery.

weilingwei avatar weilingwei commented on July 29, 2024

fs.errors.InvalidCharsInPath: path 'F:\workplace\scrapysite\wlwcms\builds' contains invalid characters
good product~

from django-bakery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.