Importing Docstrings from Python modules using Sphinx and autodoc [duplicate] - documentation

I have faced a problem with Sphinx in Python. Even if I have followed the instructions from https://groups.google.com/forum/#!topic/sphinx-users/lO4CeNJQWjg I was not able to solve it.
I have Docs/source folder which contains:
conf.py
index.rst
RstFiles (the folder which contains .rst files for each module).
In conf.py I specify the abs path in the following way:
sys.path.insert(0, os.path.abspath('..'))
In index.rst I call all the modules from RstFiles folder in the following way:
.. toctree::
:maxdepth: 2
:caption: Contents:
BatchDataContainer.rst
BatchDefaultValues.rst
BatchTypes.rst
And finally, the content of each .rst file is in the following way:
BatchDataContainer
==================
.. automodule:: RstFiles.BatchDataContainer
:members:
When I run sphinx-build I get 2 main errors:
D:\hfTools\Projects\Validation-Source\Docs\source\RstFiles\BatchDataContainer.rst:
WARNING: document isn't included in any toctree
and
WARNING: autodoc: failed to import module 'BatchDataContainer' from
module 'RstFiles'; the following exception was raised: No module named
'RstFiles'
Any ideas what might be wrong cause I have tried different things already and nothing has helped?

If conf.py is located in this directory,
D:\hfTools\Projects\Validation-Source\Docs\source,
and the project's Python modules (including BatchDataContainer.py) are in
D:\hfTools\Projects\Validation-Source\Products,
then you need sys.path.insert(0, os.path.abspath('../..')) in conf.py.
The automodule directive needs to be updated as well:
.. automodule:: Products.BatchDataContainer
:members:

Related

pyinstaller-ModuleNotFoundError, How to incl module which added manually by __init__.py in pyinstaller

I have my_ui.py and resources_rc.py are automatically generated from a QT GUI designer.
I can run my_ui.py using python my_ui.py.
This is my-module structure
\my-module
\__init__.py
\my_ui.py
\resouces_rc.py
Content of init.py. resource_rc will be imported and later used inside my_ui.py
from my-module import resources_rc
sys.modules['resource_rc'] = resources_rc
pyinstaller command:
pyinstaller --paths=resources_rc.py myui.py --onefile
I got an error message when running ./dist/my_ui
ModuleNotFoundError: No module named 'resources_rc'
I have tried to run pyinstalled outside my-module directory and still i get this error message.
Any idea how to solve this problem? Many thanks.

PixiJS for Haxe won't import - Type Not Found error in IntelliJ

I'm trying to run the most basic PixiJS for Haxe sample program, but IntelliJ gives a Type Not Found error.
The failing code:
package ;
import pixi.core.Application;
The error message:
Main.hx:3: characters 7-28 : Type not found : pixi.core.Application
I think the issue is PixiJS-specific, as when I follow the same install-and-import steps for other Haxe modules (eg flambe, flixel) they behave as expected. I've tried with both 4.7.1 and 4.5.5, and as both global and project-specific libraries (separately).
(I hybridized several screenshots to save space)
When running from the console, using:
> haxe -main Main -lib pixijs -js output.js
Everything seems to compile (running the compiled code results in a PIXI is not defined error which is a seperate issue).
UPDATE 1, how I'm adding the dependency:
After executing haxelib install pixijs, I follow these steps:
UDPATE 2, the config being run:
If you can't get it working in the dependencies section you could try adding the haxelibs pixijs externs src/ folder as an additional sources root in Project Structure -> Modules -> (module name) -> Sources. That's how it worked for me:

Windows 10 pyinstaller tensorflow missing modules

I try to deploy a model with pyinstaller and when i run it i get the following error.
ModuleNotFoundError: No module named
'tensorflow.python._pywrap_tensorflow_internal'
Tensorflow 1.7.0
cudnn64_7
CUDA 9.0
Python 3.6
You can resolve this issue by simply renaming the file _pywrap_tensorflow_internal.pyd contained in the dist folder to tensorflow.python._pywrap_tensorflow_internal.pyd.
I still have to figure out how to tell pyinstaller the "correct" module name.
( Workaround for Python 3.5 only )
Building off of Jascha's solution, a work around is to manually fetch the file __python._pywrap_tensorflow_internal.pyd from
PathToAnaconda3/env//Lib/site-packages/tensorflow/python/__python._pywrap_tensorflow_internal.pyd
and rename it into tensorflow.python.__python._pywrap_tensorflow_internal.pyd
Then this renamed file can be moved into the exe file by :
pyinstaller -F <name of python file> --add-data "pathToFile/tensorflow.python.__python._pywrap_tensorflow_internal.pyd";.
The flag --add-data takes two arguments separated by semi colon
--add-data source_path;destination_path_inside_exe

No module named lstm_predictor

When I am trying to import the following module,
>>> from lstm_predictor import lstm_model
The error says no module named lstm_predictor.
How can I solve the problem?
It seems like you are utilizing the lstm_predictor package present in https://github.com/tgjeon/TensorFlow-Tutorials-for-Time-Series.
Since this is not a standard module, make sure you have cloned this project and you have the lstm_predictor.py file in the same folder as your python terminal.

Kivy: PyInstaller not including Kivy modules upon compiling spec file

I've been following Creating Packages for Mac OS from Kivy.org in order to try and create a .app for my Kivy .py file.
However, despite following the guide through, my App never works, it crashes instantly upon opening. Pyinstaller's warning's concerning the build were dumped in a .txt that contained the following:
W: no module named kivy.graphics.ClearBuffers (top-level import by kivy.uix.screenmanager)
W: no module named kivy.core.spelling.SpellingBase (top-level import by kivy.core.spelling.spelling_enchant)
W: no module named kivy.core.image.ImageLoader (top-level import by kivy.core.image.img_gif)
W: no module named multiprocessing.RLock (top-level import by multiprocessing.sharedctypes)
and so on . . . (Full file is very long, but can be viewed here)
It seems like no kivy modules at all could be found, so they must have not been included for some reason. This is what I want to ask how to fix.
As of right now, I have been using the commands:
kivy pyinstaller.py myapp.py
kivy pyinstaller.py myapp.spec
respectively to create both the spec file and the App.
The spec file doesn't seem to have anything missing. (I've included the hooks and checked with a working spec file I used to create an .exe in the past)
# -*- mode: python -*-
# -*- coding: utf-8 -*-
from kivy.tools.packaging.pyinstaller_hooks import install_hooks
install_hooks(globals())
a = Analysis(['Meep/Meep.py'],
pathex=['/Users/Owatch/Documents/pyinstaller/Meep'],
hiddenimports=[],
runtime_hooks=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='Meep',
debug=False,
strip=None,
upx=True,
console=False , icon='Meep/icon.icns')
coll = COLLECT(exe,Tree('/Users/Owatch/Desktop/examples/demo/touchtracer/'),
a.binaries,
a.zipfiles,
a.datas,
strip=None,
upx=True,
name='Meep')
Anyways, I'm not sure why this is occuring. My suspicions are mostly around the following:
1: I downloaded pyinstaller as a .zip since I could not find the .py file on my system. This is despite having it installed via pip on what I believe to be a separate python installation (I have 2.7 separately)
2: My reference to touchtracer is somehow wrong, it is linked to the touchtracer directory that came bundled in the dmg for Kivy. (A folder named Examples, which I dragged to my desktop)
Other than that, I'm afraid I'm pretty clueless. Thanks for helping (If you can!)
It appears that the error was associated with a flawed spec file. Nothing else to report.