Skip to content

[BUG] <freecadcmd> CLI Not Working #2

Open
@ThaL3g3nd27

Description

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Python scripts do not work in the docker container cli.

Traceback (most recent call last):
File "", line 8, in
FileNotFoundError: [Errno 2] No such file or directory: '/lsiopy/bin/activate_this.py'

Expected Behavior

freecadcmd file.py

python function should run without the gui.

Steps To Reproduce

https://github.com/ThaL3g3nd27/issue-FreeCad-freecadcmd.git

LinuxServer/FreeCad – freecadcmd not working in cli

steps previous debugged ending with issue

All Code is available

  1. Add Dockerfile:

image

  1. Add the docker-compose.yaml

image

  1. Build the Docker Image

    docker-compose build

  2. Run the image using docker-compose

    docker-compose up -d

  3. Open Browser to localhost:3000

image

  App works great

  1. Open the boxtest.py within the FreeCad Gui

    File>Open>/app/py_scripts>boxtest.py (Defined in docker compose)

image

  1. Run the Code in the FreeCad Gui

image

  1. Box object is made

image

  And auto exported/downloaded as a box.step file in /py_scripts

image

  Python works Great!

  (If Needed) shutdown container - docker compose down

ISSUE THE CLI doesn't WORK

  1. Delete the box.step file so we know if the python script was ran again.

image

  1. Docker Exec into the running container

docker exec -it freecad bash

image

  1. cd into the py_scripts directory

image

  1. Open the freecadcmd cli to make sure it works

image

  This is due to Python environment variables…

Correct Example Usage:

https://youtu.be/RQW723n3DkU?si=dIt7jef6VmLHqkaF&t=596
image

Purpose of the issue:

The Purpose of doing it from the command line is to automate the creation of the object defined by parameters/database so a backend can parametrically make parts.
The gui will only be used for testing.

Link to linuxServer/FreeCad:

https://github.com/linuxserver/docker-freecad.git
image

Environment

- OS: Ubuntu on WSL
- How docker service was installed: docker compose build

# Use the LinuxServer.io FreeCAD Docker image
FROM lscr.io/linuxserver/freecad:latest

# Set the working directory
WORKDIR /app/

CPU architecture

x86-64

Docker creation

version: '3'

services:
  freecad:
    build:
      context: .
    container_name: freecad
    security_opt:
      - seccomp:unconfined #optional
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - ./config:/app/config
      - ./py_scripts:/app/py_scripts
    ports:
      - "3000:3000"
      - "3001:3001"
    restart: unless-stopped

Container logs

root@a5613fcfb2a4:/app/py_scripts# freecadcmd boxtest.py
Traceback (most recent call last):
  File "<string>", line 8, in <module>
FileNotFoundError: [Errno 2] No such file or directory: '/lsiopy/bin/activate_this.py'
FreeCAD 0.20.2, Libs: 0.20.2R
(c) Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2022
FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.
FreeCAD wouldn't be possible without FreeCAD community.
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

  • Status

    Issues

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions