jnweiger / inkscape-round-corners

An inkscape 1.0 extension to apply a radius to sharp corners of a path.
GNU General Public License v2.0
10 stars 2 forks source link

name 'os' is not defined #6

Closed Ungoose closed 2 years ago

Ungoose commented 3 years ago

Hello and thank you for the great work. I was eager to try an alternative to the discontinued one by crowhoot. Unfortunately, it doesn't work for me in either 1.0.1 or 1.0.2, returning the following message:

Traceback (most recent call last): File "round_corners.py", line 236, in add_arguments self.tty = open("/dev/tty", 'w') FileNotFoundError: [Errno 2] No such file or directory: '/dev/tty'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "round_corners.py", line 239, in add_arguments self.tty = open("CON:", 'w') # windows. Does this work??? OSError: [WinError 6] Wrong descriptor: 'CON:'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "round_corners.py", line 677, in RoundedCorners().run() File "C:\inkscape\share\inkscape\extensions\inkex\base.py", line 281, in init super(SvgInputMixin, self).init() File "C:\inkscape\share\inkscape\extensions\inkex\base.py", line 73, in init self.add_arguments(self.arg_parser) File "round_corners.py", line 241, in add_arguments self.tty = open(os.devnull, "w") # "/dev/null" for POSIX, "nul" for Windows. NameError: name 'os' is not defined

The same issue has been reported by someone on the forum.

jnweiger commented 2 years ago

The error message includes

self.tty = open("CON:", 'w') # windows. Does this work???
OSError: [WinError 6] Wrong descriptor: 'CON:'

Hmm, this is the first attempt. On my old Win10, this succeeds.Should it be 'CON' without the colon on other windowses?

The fallback is self.tty = open(os.devnull, 'w') Ouch, I forgot to import os -- easy fix.

jnweiger commented 2 years ago

@Ungoose Fixed in version 1.5