How to download the Enthought Tool Suite python script? - python

I have Python downloaded already, but want to contribute code to the Enthought Tool Suite (ETS). According to this site (http://code.enthought.com/source/):
it says to download the following python script: https://raw.github.com/enthought/ets/master/ets.py
I put the ets.py into the python script, save as...and in the Python Shell, I typed in "import ets"
However, nothing happens.
Also, the site says to run the following commands:
$ mkdir ets
$ cd ets # and copy ets.py here
$ python ets.py clone
Typing those lines in Python Shell gives me the message: "SyntaxError: invalid syntax"
As you can see, I'm new to Python, and I don't know what I'm doing. How do I download the ETS script and run the commands??

Those last commands aren't meant to be entered into the Python console, they're meant to be entered at the terminal shell.
localhost-2:tmp $ mkdir ets
localhost-2:tmp $ cd ets
localhost-2:ets $ cp ../ets.py .
This last command assumes that ets.py was in the original directory. Now we can run it [edit: make sure you have git installed, or this won't work]:
localhost-2:ets $ python ets.py clone
Cloning package encore
URL: https://github.com/enthought/encore.git
Cloning into encore...
remote: Counting objects: 1081, done.
remote: Compressing objects: 100% (483/483), done.
remote: Total 1081 (delta 729), reused 942 (delta 592)
Receiving objects: 100% (1081/1081), 981.12 KiB | 1.80 MiB/s, done.
Resolving deltas: 100% (729/729), done.
Cloning package traits
URL: https://github.com/enthought/traits.git
Cloning into traits...
[etc.]
Cloning package etsproxy
URL: https://github.com/enthought/etsproxy.git
Cloning into etsproxy...
remote: Counting objects: 3577, done.
remote: Compressing objects: 100% (2243/2243), done.
remote: Total 3577 (delta 1053), reused 3571 (delta 1047)
Receiving objects: 100% (3577/3577), 369.81 KiB, done.
Resolving deltas: 100% (1053/1053), done.
After this, you need to install everything (this will look different depending on your operating system):
localhost-2:ets $ python ets.py develop
Running command ['/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python', 'setup.py', 'develop'] in package encore
running develop
running egg_info
creating encore.egg-info
writing encore.egg-info/PKG-INFO
[long build process removed]

Related

Which should be the "TARGET PATH" for this command please

If you want to build the code with cmake, you have to clone the GIT repository first, then run the setup and build commands.
git clone https://github.com/CNES/aviso-fes.git
cd aviso-fes
mkdir build
cd build
cmake … -DCMAKE_INSTALL_PREFIX=<TARGET PATH>
when I paste this last command find error {The syntax of the command is incorrect}.
Can anyone help by fixing that what should be TARGET PATH please
(Avisofes) C:\Users\hp>git clone https://github.com/CNES/aviso-fes.git
Cloning into 'aviso-fes'...
remote: Enumerating objects: 1053, done.
remote: Counting objects: 100% (165/165), done.
remote: Compressing objects: 100% (87/87), done.
remote: Total 1053 (delta 92), reused 118 (delta 67), pack-reused 888
Receiving objects: 100% (1053/1053), 4.77 MiB | 557.00 KiB/s, done.
Resolving deltas: 100% (630/630), done.
(Avisofes) C:\Users\hp>cd aviso-fes
(Avisofes) C:\Users\hp\aviso-fes>mkdir build
(Avisofes) C:\Users\hp\aviso-fes>cd build
(Avisofes) C:\Users\hp\aviso-fes\build>cmake … -DCMAKE_INSTALL_PREFIX=<TARGET PATH>
The syntax of the command is incorrect.
in anaconada navigator

problem pushing changes to GitHub because of file that's not really there

I have been trying to push changes to my GitHub repo but been facing this problem:
Uploading LFS objects: 100% (164/164), 153 MB | 0 B/s, done.
Enumerating objects: 25977, done.
Counting objects: 100% (25968/25968), done.
Delta compression using up to 4 threads
Compressing objects: 100% (18133/18133), done.
Writing objects: 100% (25955/25955), 146.83 MiB | 232.00 KiB/s, done.
Total 25955 (delta 6561), reused 25816 (delta 6463)
remote: Resolving deltas: 100% (6561/6561), completed with 4 local objects.
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
remote: error: Trace: 9f797e9b5f7a1c01fca6706ad62e21ba
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so is 225.31 MB; this exceeds GitHub's file size limit of 100.00 MB
To https://github.com/yovelcohen/nba-stats.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/yovelcohen/nba-stats.git'
(base) yovel#the-beastpad:~$ cd venv/lib/python3.6/site-packages/tensorflow_core/python/
bash: cd: venv/lib/python3.6/site-packages/tensorflow_core/python/_pywrap_tensorflow_internal.so: No such file or directory
I imported TensorFlow to the project but then removed it, when trying to delete it from the terminal it's not there (and when looking for it manually).
any help would be appreactied!
Since you should not push any generated binary file anyway, start first by removing them locally, commit and push:
git rm -r '*.so' -f
echo '*.so' >> .gitignore
But if that still fails, it means you are trying to push past commits (not just the latest one) with *.so files, even though the last commit no longer includes any such files.
If that is the case, since git filter-branch is soon deprecated, consider newren/git-filter-repo to remove any large files like those *.so ones, before pushing (or force pushing of that rewrites the content of past commits previously pushed).

GitPython debug logs not available

In case I run a simple git command like
git fetch origin
remote: Counting objects: 26, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 26 (delta 13), reused 12 (delta 12), pack-reused 8
Unpacking objects: 100% (26/26), done.
From https://github.com/edorado93/jocular
* branch master -> FETCH_HEAD
ed17d20..6e70ecd master -> origin/master
I want similar logs while executing this command using GitPython module. So the command goes something like this
git.fetch('origin')
I set the environment variable type(repo.git).GIT_PYTHON_TRACE="full" . Still on executing my script, I don't get any git logs on the console.
What am I missing here ?
You're missing the logging, without which GitPython doesn't seem to want to log anything:
import logging
logging.basicConfig(level=logging.INFO)
An example after this:
from git.cmd import Git
g = Git()
type(g).GIT_PYTHON_TRACE="full"
g.fetch('origin')
which outputs:
INFO:git.cmd:git fetch origin -> 0
''

Fabric show print after executing commands

I have a post-receive hook on my git bare repo that excute this fabfile.py:
def deploy():
print(cyan('Pulling changes to local server'))
with cd('/var/www')
local('git pull')
It executes fine, but it shows the output for the local command before the print, like this:
remote: From /media/projetos/repositorios/test
remote: b057a4b..02d85b3 master -> origin/master
remote: Updating b057a4b..02d85b3
remote: Fast-forward
remote: .../test/template/catalog/product/list.phtml | 98 +++++++++++-----------
remote: 1 file changed, 47 insertions(+), 51 deletions(-)
remote: Pulling changes to local server
If i just ssh on the server and run fab deploy it works normal.
Add a sys.stdout.flush() call after printing, so that even if output is fully buffered (as it is on a pipe, which is the case when running under a git hook), it is sent to the output stream at that point, before running another command.

Deploy pure python to heroku

I "finished" a little python project and I want to deploy it on heroku
GitHub page.
I want to execute: python2 main.py -i json-rpc
in order to have the json-rpc server listening for connections
but I get the following error when pushing to heroku:
$ git push heroku master Counting objects: 153, done. Delta
compression using up to 8 threads. Compressing objects: 100% (87/87),
done. Writing objects: 100% (153/153), 43.42 KiB, done. Total 153
(delta 61), reused 153 (delta 61)
-----> Heroku receiving push ! Heroku push rejected, no Cedar-supported app detected
To git#heroku.com:panager.git ! [remote rejected] master -> master
(pre-receive hook declined) error: failed to push some refs to
'git#heroku.com:panager.git'
What you might want to try doing is creating a Procfile. The full filename is Procfile, no extension, and it goes in the main directory of your project folder.
The content of that file would be:
web: python main.py -i json-rpc
Give that a shot and see if it works.
Alternatively, you may have forgotten to create a virtualenv for your app.
You should follow the instructions in Heroku's guide Getting Started with Python on Heroku
Update:
Having finally tested this myself on a fresh Heroku app, what you're missing is a requirements.txt. Even though you don't have any dependencies, you still need it. Within your virtualenv in the main project folder, run pip freeze > requirements.txt, and then git add . then git commit -m "added requirements.txt", and then push to Heroku and it should work.
Also, make sure that requirements.txt is saved with ANSI encoding, not Unicode or UTF-8! If you're a total n00b like me you can simply open requirements.txt in Notepad, choose SAVE AS and change the "Encoding" from the drop down. I tried all of the recommendations above but my error was due to this simple encoding problem.

Categories

Resources