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

running example fails on windows (RuntimeError: Unable to open config file C:\Users\user\.ocpvscode) #818

Open
edrihan opened this issue Dec 16, 2024 · 2 comments
Labels
question Further information is requested

Comments

@edrihan
Copy link

edrihan commented Dec 16, 2024

There are two cases I tried. The first was running:

python -m pip install --upgrade pip
python -m pip install git+https://github.com/gumyr/build123d

This seemed to work, but then I had to run pip install ocp_vscode, and it seemed to work, but then I get the state that we are in here. What I mean is that the only difference between installing latest and stable was the missing ocp_vscode. But once you have it installed, the two cases are the same, in that the next stuff happens.

I did pip install build123d
Then I copy pasted the canada flag example into a file and ran it. This is the output:

Lock file C:\Users\user\.ocpvscode.lock already exists
Lock file C:\Users\user\.ocpvscode.lock is stale
Traceback (most recent call last):
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\state.py", line 156, in get_state
    with open(config_file, "r", encoding="utf-8") as fd:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\.ocpvscode'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\user\Desktop\3dcanadaflag.py", line 105, in <module>
    show(Rot(90, 0, 0) * canadian_flag)
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\show.py", line 555, in show
    t, mapping = _convert(
                 ^^^^^^^^^
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\show.py", line 255, in _convert
    instances, shapes, config, count_shapes, mapping = _tessellate(
                                                       ^^^^^^^^^^^^
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\show.py", line 86, in _tessellate
    if workspace_config().get("_splash"):
       ^^^^^^^^^^^^^^^^^^
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\config.py", line 431, in workspace_config
    port = get_port()
           ^^^^^^^^^^
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\comms.py", line 111, in get_port
    find_and_set_port()
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\comms.py", line 302, in find_and_set_port
    port = find_port()
           ^^^^^^^^^^^
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\comms.py", line 266, in find_port
    states = get_state().items()
             ^^^^^^^^^^^
  File "C:\bin\Python\Python311\Lib\site-packages\ocp_vscode\state.py", line 164, in get_state
    raise RuntimeError(f"Unable to open config file {config_file}.") from ex
RuntimeError: Unable to open config file C:\Users\user\.ocpvscode.

This seems like a bug with ocp_vscode not creating a config file. But being that this project uses it.. I can't run the example based on the instructions in the README.

@gumyr gumyr added the question Further information is requested label Dec 17, 2024
@gumyr gumyr added this to the Not Gating Release 1.0.0 milestone Dec 17, 2024
@gumyr
Copy link
Owner

gumyr commented Dec 17, 2024

ocp_vscode is a separate project from build123d - you could raise an issue here: https://github.com/bernhard-42/vscode-ocp-cad-viewer or as for assistance in the CadQuery/build123d Discord.

A couple things to try though:

  1. Open a Folder in vscode (File->Open Folder)
  2. Close vscode entirely and re-open it

@jdegenstein
Copy link
Collaborator

Assuming you are running ocp_vscode in standalone mode, this is a known issue and documented on the appropriate repo bernhard-42/vscode-ocp-cad-viewer#121

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

No branches or pull requests

3 participants