X Tutup
Skip to content

Change the output directory of the parser #2690

@Smallgiil

Description

@Smallgiil

Hello,

I ran into an issue when importing clr. In the end, it was caused by my current directory being protected against write operations. I fixed it by changing the current directory, with os.chdir before loading pythonnet but it feels like a dirty workaround. In my opinion, it would be best if pythonnet does not rely on the current directory as all. At least, it should be configurable.

Pythonnet uses pycparser which uses PLY. PLY wants to create a lextab.py file for optimization purposes. You can specify the directory where it is created through the outputdir argument (see dabeaz/ply#96). In pycparser, there is an argument called taboutputdir (see https://github.com/eliben/pycparser/blob/9cd0027f874fcceacca87fdfb163a387bf4d56b6/pycparser/c_parser.py#L70). I guess it can be used to control the outputdir but I'm not sure because I didn't investigate in the code.

In pythonnet, no argument can be passed to c_parser so we cannot control this directory:

parser = c_parser.CParser()

Could we make this output directory configurable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup