The epydoc documentation says:
The graphical interface can be invoked with the epydocgui command, or with epydoc.pyw in the Scripts subdirectory of the Python installation directory under Windows.
I've tried running the epydoc.pyw file directly, and calling it from command line i.e. >>> python epydoc.pyw and >>> epydoc.pyw, both from the scripts directory in my python directory.
How am I supposed to run epydoc.pyw?
In order to use the gui of epydoc, click double on the file epydoc.pyw which is often located at C:\Python27\Scripts
Regarding your question in the comments: 1) open a normal console, 2) navigate to your Script folder and 3) then call the following e.g. to generate uml diagramm. See commandline documentation
python epydoc.py --pdf --graph=umlclasstree Path/To/package
Related
I just installed python 2.7 on a windows machine to start SimpleHTTPServer in order to test my d3.js code.
Normally on my linux laptop I would start a terminal window in the folder where my files are (index.html, data.json, etc). However, if I do the same on windows it doesn't work.
The only way to make this works is when I run python -m SimpleHTTPServer 8000in the python installation folder (in my case C:\Python27).
I read here that I need to set the python environment variable. The screen shows what I have done. As you can see I set the variable both locally (for the current user) and system-wide. However, when I try to run a pythoncommand out of the installation folder nothing changes.
The python variable is incorrect - rather you should add the python executable path to the PATH environment variable e.g.
PATH=C:\Python27\;C:\Python27\Scripts;
You should then be able to call python from anywhere.
Indeed any path you include in the PATH will then allow you to call executables in that path without specifying the full path or extension.
i.e.
C:\Python27\python.exe becomes python
C:\WINDOWS\system32\cmd.exe becomes cmd
For more detail see: https://en.wikipedia.org/wiki/PATH_(variable) or my answer to this question: Error in Process.Start() -- The system cannot find the file specified
I've made a simple server based on another thread here on SO: Shutting down python TCPServer by custom handler
I wrapped this up into an .exe using pyinstaller like so:
pyinstaller C:\PATH TO FILE\server.py --distpath=\PATH TO FILE\ --onedir --onefile --noconsole
This works wonderfully on Windows (currently testing on Win 7 x64). I can copy this exe to any folder and get a webserver at that location. I did it this way because I am wrapping this up into a process that would be distributed with another application. The users of this application might not have python installed and they might have a browser that blocks the types of things I would like to serve during the application process.
This should also work on osx, but when I try to wrap the same python script with pyinstaller, instead of serving up the current directory, I get a server at my /Users/Username location and not the directory from where the app was run.
My process to get this to work on both Win and OSX was to begin from the python shell and run the scripts there. This works on both platforms. If I use Terminal, cd to the directory where I want to serve files, and run the python script from there, things work fine. But any attempt I make to wrap the script into something executable leads me back to the same result of serving from /Users/Username, so I'm obviously missing something fundamental of how the wrapping is working. I am assuming it has to do with shell scripting and the script being tied to the current user?
I'd like to continue to use pyinstaller for this process since it would be the same process on Windows and OSX, but I cannot seem to get the resulting app to serve files from the directory from which it is run. Any guidance on what is happening, and how to fix it through pyinstaller (or other method) would be greatly appreciated.
#tallforasmurf on the pyinstaller Github pointed out that I missed something in the pyinstaller docs that is very important:
Adapting to being "frozen"
In some apps it is necessary to learn at run-time whether the app is
running "live" (from source) or "frozen" (part of a bundle). For
example, you might have a configuration file that, when running
"live", is found based on a module's file attribute. That won't
work when the code is bundled.
When your application needs access to a data file, for example a
configuration file or an icon image file, you get the path to the file
with the following code:
import sys
import os
...
if getattr(sys, 'frozen', False):
# we are running in a |PyInstaller| bundle
basedir = sys._MEIPASS
else:
# we are running in a normal Python environment
basedir = os.path.dirname(__file__)
The PyInstaller bootloader adds the attribute frozen to the sys
module. If that attribute exists, your script has been launched by the
bootloader. When that is true, sys._MEIPASS (note the underscore in
the name) contains the path to the folder containing your script and
any other files or folders bundled with it. For one-folder mode this
is the distribution folder. For one-file mode it is the temporary
folder created by the bootloader .
When your program was not started by the bootloader, the standard
Python variable file is the full path to the script now executing,
and os.path.dirname() extracts the path to the folder that contains
it.
I was able to os.chdir(basedir) after going up a few levels past the .app bundle directory and properly serve the files in the same directory as the .app bundle.
Once sphinx-apidoc has been run the command C:\path\to\doc\make html produces an error beginning:
The 'sphinx-build' command was not found [snip]
However the command does exist and the relevant environment variables are set.
More detail:
1 - Trying to run sphinx_apidoc:
'C:\path\to\jython\bin\sphinx-apidoc' is not recognised as an internal or external command
2 - Called using Jython works: jython C:\path\to\jython\bin\sphinx-apidoc with sensible options produces the documentation *.rst files, conf.py, etc files.
3 - make html then produces the following error:
The 'sphinx-build' command was not found [snip]
It then recommends setting the SPHINXBUILD environment variable, and even the PATH. I already have these two environment variables set, proven to myself by calling echo %PATH% and echo %SPHINXBUILD%.
This is where I get stuck. It appears that the files that Sphinx uses (sphinx-apidoc and sphinx-build in this case), which are in the C:\path\to\jython\bin\ directory, do not have any file suffixes. When called directly from Jython they work as expected (see point 2 above), however when called as part of another process (e.g. make html) they are not recognised and the execution fails (see points 1 and 3 above).
Does anyone know the what, why and most importantly 'how to fix' of this problem?
My setup process is on an unnetworked Windows 7 computer. Jython (2.5.2) was installed using the Jython installer. Then each of the following packages (except setuptools) was installed by extracting it locally and then running jython setup.py install in its extracted directory:
setuptools: by calling jython ez_setup.py with setuptools-1.4.2.tar.gz in the same directory (so there is no attempt to download it)
Jinja2 (2.5)
docutils (0.11)
Pygments (1.6)
Sphinx (1.2.1)
numpydoc (0.4) - Only mentioned because it is also isntalled on the machine.
I have managed to get it working. The problem was that the manual installation and the use of Jython meant that certain environment variables that were expected were not in place. Also, the use of Windows 7 (and I believe MS Windows in general) means that Python scripts without an extension cannot be run without calling them explicitly through Jython (Windows doesn't check for shebangs). Finally, file associations had not been set up (as happens automatically with CPython installation, but has not happened with Jython).
For anyone else with similar problems the following setup works for me:
Locations:
Java Runtime: C:\Java\jre7
Jython: C:\Jython\jython2.5.2
User Environment Variables:
JRE_HOME: C:\Java\jre7
JAVA_HOME: %JRE_HOME%
CLASSPATH: .
JYTHON_HOME: C:\Jython\jython2.5.2
PATH: %JRE_HOME%\bin;%JYTHON_HOME%\bin
File Associations:
At the command prompt type assoc .py=Python.File to associate 'Python.File' with the '.py' extension.
At the command prompt type ftype Python.File=C:\Jython\jython2.5.2\jython.bat "%1" %* to associate the Jython command with files of type 'Python.File'.
Append '.py' (;.PY) to the PATHEXT system environment variable. This will make it possible to execute Python files without having to provide their '.py' extension. (N.B. This does not make it possible to run Python files that do not have a '.py' extension.)
File Extensions:
Rename the four Sphinx commands to include '.py' extensions. This is remarkably difficult with vanilla Windows 7 as it does everything it can to distance the user from such 'low level' details as file extensions, however the rename command at the command prompt does the job: type ren sphinx* sphinx*.py when in the Jython bin directory.
It should now be possible to call sphinx-apidoc or similar from anywhere. Once this is complete the command make html, when called from the documentation directory, should work as expected.
I have EPD. I would like to use the ipython shell. I think it's called 'pylab' in your distribution. I would like to be able to append to the system path ($pythonpath) at the moment when the shell loads. Unfortunately, I can not seem to locate the ipy_user_conf.py file that many users on the internet report is where I need to include a line to do that. Please help!!!
I'm going to guess that you're running IPython >= 0.11. (Note the IPython version is displayed when starting up the IPython shell.)
Older versions of IPython (pre-0.11) used ipy_user_conf.py, but IPython's configuration system was overhauled in 0.11. For details, see this overview. If you want to run some code on start up, you can add a python file in your IPython startup directory, which should be here:
~/.ipython/profile_default/startup/
Any python code in that directory gets run on startup, so you can just create a new .py to modify your python path. If the startup directory doesn't exist, you may need to run:
ipython profile create
which creates those directories (plus some other goodies).
Noob question ahead...
I'm trying to install SWIG on Windows. According to the INSTALL document, I have to
cd to the directory containing the package's source code and type ./configure to configure the package for your system.
I tried the command in both the root directory and in the /CCache directory (these are the only ones that have the configure and configure.in files), however, the shell reports back that
C:\swigwin-2.0.4>./configure
'.' is not recognized as an internal or external command,
operable program or batch file.
What am I missing?
no installation is needed. you just have to set the environment variable to point to the "swig" 's executable which is under the root directory of swig
On the SWIG site, you can download for example the swigwin-2.0.7 zip directory for windows's swig. unzip it in a directory of your choice for example on "C:\Program Files" directory if you want. After this, you have the swig executable in the "C:\Program Files\swigwin-2.0.7" directory: "C\Program Files\swigwin-2.0.7\swig"
you have to set now the environment variable "path" to point to this swig exec: add for this the "C:\Program Files\swigwin-2.0.7" path to the "path"variable according to my example; that is all you need to use swig on windows. You can now play with swig so, open a prompt "cmd" and just type "swig --help" on this prompt you can see a list of the differents options you can use with swig.
If you d'ont have visual c++, you can use for example codeblock, that is my case so the link below could be a help for you : http://wiki.codeblocks.org/index.phptitle=Adding_support_for_non_C/C%2B%2B_files_to_the_build_system
The page http://www.swig.org/download.html has a specific download for Windows with a pre-built version of swig.exe. You can download it and avoid the hassle of compiling swig by yourself.
If you really need to, you can consult the file Doc/Manual/Windows.html that contain Windows-specific instructions to build SWIG.
Finally, to answer your specific question, the syntax
./configure
is a UNIX-style command that means 'execute the program named configure in the current directory' (the dot)
On Windows, you would type
.\configure
or even simpler, as all files are executable on Windows, only
configure
... BUT this will not work as the said 'configure' script is a bash script that will not run in a Windows shell.
Download Miniconda.
Then follow this guide and do: conda install -c anaconda swig