Why is this IronPython module path not visible? - module

I am trying to find the location of a IronPython module on my PC. According to this code:
import xml.etree.ElementTree as ET
print(ET.__file__)
...the path to the module is
'C:\Program Files (x86)\IronPython 2.7\Lib\xml\etree\ElementTree.py'
However when I look up this path there is no 'xml' in 'Lib'
Why could this be?

Related

How do I use modules in Lua?

I'm trying to develop a discord bot with lua using discordia.
But it is looking for the module in another directory even though it installed properly.
The same goes for other modules installed with Luarocks.
To solve this, I added the lualox directory to the path, but the same result was output.
How to get this to load the module in the correct directory?
C:\Program Files\Lua\lua-5.4.2_Win64_bin\lua54.exe: C:\Users\---\Downloads\Projects\Lua\Discordbot\main.lua:1: module 'discordia' not found:
no field package.preload['discordia']
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\lua\discordia.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\lua\discordia\init.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\discordia.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\discordia\init.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\..\share\lua\5.4\discordia.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\..\share\lua\5.4\discordia\init.lua'
no file '.\discordia.lua'
no file '.\discordia\init.lua'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\discordia.dll'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\..\lib\lua\5.4\discordia.dll'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\loadall.dll'
no file '.\discordia.dll'
no file 'C:\Program Files\Lua\lua-5.4.2_Win64_bin\discordia54.dll'
no file '.\discordia54.dll'
stack traceback:
[C]: in function 'require'
C:\Users\---\Downloads\Projects\Lua\Discordbot\main.lua:1: in main chunk
[C]: in ?
Instead of require("discordia"), I used require("C:.Users.---.Downloads.Projects.Lua.Discordbot.deps") but it still doesn't load the module (same for Luarocks directory)

Python wheel installed successfully but unable to import modules

I have a myFunction.pyd file which I have tested to make sure that modules defined internally are accessible.
I then created a wheel file myFunction-1.0-py3-none-any.whl
Finally using cmd prompt I installed the wheel file. I can then also see the following location:
C:\Program Files\Python38\Lib\site-packages\myFunction-1.0.dist-info
However, when I do the following import myFunction as mf it gives error ModuleNotFoundError: No module named 'myFunction'
Only thing I can think of is I didn't do anything with the pyd file that I had generated. Do I need to also move that file to some location?

Sphinx cannot find module for autodoc even after including it in sys.path

I have a large directory structure so instead of manually adding the paths, i am searching for all modules using os.walk(). Whenever I am finding a directory containing a __init__.py file I am including that directory in the PYTHONPATH by using the following code in my conf.py file:
import os, sys
top = "/home/userme/Desktop/root"
for dirpaths, dirnames, filenames in os.walk(top):
if "__init__.py" in filenames:
sys.path.insert(0, os.path.abspath(dirpath))
I am also printing the filepaths to see that they are correct. Even then while trying to read the corresponding rst file I am getting an error trying to import the module.

Package org.pdfbox.pdfparser does not exist

There is following portion in my code:
import org.pdfbox.cos.COSDocument;
import org.pdfbox.pdfparser.PDFParser;
import org.pdfbox.pdmodel.PDDocument;
import org.pdfbox.pdmodel.PDDocumentInformation;
import org.pdfbox.util.PDFTextStripper;
When I try to compile, it saws following error:
package org.pdfbox.pdfparser does not exist.
I have installed the default JDK on Ubuntu so how do I solve this issue?
This is not part of the default JDK installation. You need to get hold of the jar file that contains this code and then add it to your compile-time class path.
so, if you were to download the jar file to /tmp/pdfbox.jar, you'd compile it with
javac -cp .:/tmp/pdfbox.jar MyProgram.java
PS - downloading it to /tmp isn't a great idea, but you get the picture ......
you must build path it into your lib folder
go to your package explorer and right click on jar file and after that use build path

How do I set the base source path for Jython code embedded into a Java project?

I'm using Jython code embedded into a Java project. I can import Jython packages from Java just fine if they are in the standard output folder of the Java project (bin/ during development or in the root inside the JAR) like this:
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.exec("import pypkg");
However, I'd like to store them under py/ in the JAR. When I do that, I get a
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named pypkg
How do I tell PythonInterpreter which base path to look for .py files inside the JAR?
If you do not have an __init__.py file in the py directory, that is most likely the problem. I just tried importing a single .py file from a .jar file in a directory one level down from the root and it worked. I was using Jython 2.5.2.