Invalid syntax from ypolk -l - django

I having a lot of trouble to install and config Django and Postgres so I can use them in eclipse.
I try to follow the instructions from this youtube video
but when I typed
ypolk -l
i got:
C:\Users\yaira\Documents\YASMIN\virtual_enviroments>yolk -l
Traceback (most recent call last):
File "C:\Users\yaira\AppData\Local\Programs\Python\Python36-32\Scripts\yolk-script.py", line 11, in <module>
load_entry_point('yolk==0.4.3', 'console_scripts', 'yolk')()
File "c:\users\yaira\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "c:\users\yaira\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point
return ep.load()
File "c:\users\yaira\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
return self.resolve()
File "c:\users\yaira\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "c:\users\yaira\appdata\local\programs\python\python36-32\lib\site-packages\yolk\cli.py", line 262
print " %s %s (%s)" % (project_name, dist.version,
^
SyntaxError: invalid syntax
I have no idea what does it mean, and what to do do with those results.

It would appear as though yolk does not support Python 3 too well according to this bug report.
Their suggested solution is to try using yolk3k and uninstall yolk
Make sure you uninstall yolk before installing yolk3k so you can use the "yolk" commands in yolk3k

Related

Trying to deploy on pythonanywhere and not working

I've downloaded the pythonanywhere installation tool and am trying to deploy with the following line:
pa_autoconfigure_django.py <https://github.com/myusername/myproject.git>
Then, I get this a key error. My project runs on local.
File "/projects/hosproject/venv/lib/python3.7/site-packages/pythonanywhere/project.py", line 16, in __init__
self.virtualenv = Virtualenv(self.domain, self.python_version)
File "/projects/hosproject/venv/lib/python3.7/site-packages/pythonanywhere/virtualenvs.py", line 12, in __init__
self.path = Path(os.environ["WORKON_HOME"]) / domain
File "/projects/hosproject/venv/bin/../lib/python3.7/os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'WORKON_HOME'
Need some help to debug this and try to deploy again. If it helps, I'm new to Django and following this tutorial: https://tutorial.djangogirls.org/en/deploy/.
As noted by Giles:
It looks like you might be running the PythonAnywhere tools from a terminal on your own machine -- you should run it in a bash console on PythonAnywhere -- you can start one from the "Consoles" page. (emphasis mine)
However I only got to this KeyError: WORKON_HOME after running several commands I shouldn't have (at least it'll make clean up easier):
$ pip3 install --user pythonanywhere
$ pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
-bash: pa_autoconfigure_django.py: command not found
$ find / -name "pa_autoconfigure_django.py"
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
Traceback (most recent call last):
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 19, in <module>
from docopt import docopt
ModuleNotFoundError: No module named 'docopt'
$ pip install docopt
...
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
...
ModuleNotFoundError: No module named 'pythonanywhere'
$ pip install pythonanywhere
...
$ /Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py --python=3.7 git#github.com:pzrq/djangogirls-tutorial-blog.git
Traceback (most recent call last):
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 52, in <module>
main(arguments['<git-repo-url>'], arguments['--domain'], arguments['--python'], nuke=arguments.get('--nuke'))
File "/Users/pzrq/Library/Python/3.7/bin/pa_autoconfigure_django.py", line 33, in main
project = DjangoProject(domain, python_version)
File "/Users/pzrq/Projects/djangogirls/myvenv/lib/python3.7/site-packages/pythonanywhere/project.py", line 16, in __init__
self.virtualenv = Virtualenv(self.domain, self.python_version)
File "/Users/pzrq/Projects/djangogirls/myvenv/lib/python3.7/site-packages/pythonanywhere/virtualenvs.py", line 12, in __init__
self.path = Path(os.environ["WORKON_HOME"]) / domain
File "/usr/local/bin/../Cellar/python/3.7.3/bin/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/os.py", line 678, in __getitem__
raise KeyError(key) from None
KeyError: 'WORKON_HOME'

ERAlchemy cannot connect to database

I don't understand the syntax to call the render feature of ERAlchemy (https://pypi.org/project/ERAlchemy see "Usage for Python"). I am using Python 2.7, sqlite3, and PyCharm. I have ERAlchemy, GraphViz, and PyGraphViz installed.
I am trying the following, but it cannot connect to the database:
from eralchemy import render_er
render_er("sqlite:///C:\\Users\\myname\\Documents\\Work\\pythonsqlite.db", 'erd_from_sqlite.png')
And this is the error:
Traceback (most recent call last):
File "C:/Users/myname/Documents/Work/_sql_functions_rev0.py", line 81, in <module>
render_er("sqlite:///C:\\Users\\myname\\Documents\\Work\\pythonsqlite.db", 'erd_from_sqlite.png')
File "C:\Python27\ArcGISx6410.6\lib\site-packages\eralchemy\main.py", line 236, in render_er
intermediary_to_output(tables, relationships, output)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\eralchemy\main.py", line 75, in intermediary_to_schema
graph.draw(path=output, prog='dot', format=extension)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1474, in draw
data = self._run_prog(prog, args)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1308, in _run_prog
runprog = r'"%s"' % self._get_prog(prog)
File "C:\Python27\ArcGISx6410.6\lib\site-packages\pygraphviz\agraph.py", line 1295, in _get_prog
raise ValueError("Program %s not found in path." % prog)
ValueError: Program dot not found in path.
Ah! Found the answer here
had to find the folder with "dot.exe" and add it to the environment variables -> system variables -> path

Python wrapper install gives "Command "python setup.py egg_info" failed with error code 1"

I've been trying to install this Python wrapper for the past two days. I went through all the other questions here on Stack Overflow. Tried literally everything, and nothing seems to work.
Processing /../../../../../wrappers/Python
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-twPZdY-build/setup.py", line 50, in <module>
**cffi_args
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 319, in __init__
_Distribution.__init__(self, attrs)
File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/site-packages/setuptools/dist.py", line 386, in finalize_options
ep.load()(self, ep.name, value)
File "/private/tmp/pip-twPZdY-build/.eggs/cffi-1.10.0-py2.7-macosx-10.11-x86_64.egg/cffi/setuptools_ext.py", line 188, in cffi_modules
add_cffi_module(dist, cffi_module)
File "/private/tmp/pip-twPZdY-build/.eggs/cffi-1.10.0-py2.7-macosx-10.11-x86_64.egg/cffi/setuptools_ext.py", line 49, in add_cffi_module
execfile(build_file_name, mod_vars)
File "/private/tmp/pip-twPZdY-build/.eggs/cffi-1.10.0-py2.7-macosx-10.11-x86_64.egg/cffi/setuptools_ext.py", line 25, in execfile
exec(code, glob, glob)
File "../ffi_build.py", line 34, in <module>
ffi.set_source('../_ffi', None)
File "/private/tmp/pip-twPZdY-build/.eggs/cffi-1.10.0-py2.7-macosx-10.11-x86_64.egg/cffi/api.py", line 612, in set_source
raise ValueError("'module_name' must not contain '/': use a dotted "
ValueError: 'module_name' must not contain '/': use a dotted name to make a 'package.module' location
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-twPZdY-build/
I've reinstalled everything at least twice, updated, tried sudo -H, but nothing seems to work. It seems like a problem with setuptools, but I have no idea how to fix it.
Mac OSX 10.11.6 (El Capitan)
Python 2.7.13
Pip 9.0.1
After carefully reading through the error message, I managed to find the file called ffi_build.py under the Python folder I was trying to bind. As stated in the error message, at line 34 there was a module naming statement that contained a '/'. By replacing that '/' with a '.' I solved the issue and managed to bind the Python wrapper with no issue whatsoever.

Error when starting scrapy project

Any time i try scrapy crawl [name] I get the following error
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2793, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 673, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 576, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: Scrapy==0.24.5
I'm not sure what it is I'm missing, I've tried following suggestions from other similar questions but nothing is working! Any help would be appreciated.
Managed to figure it out. For some reason the pip install Scrapy was not completely installing so I downloaded the tarball from the website and then followed the instructions here and it now works!

portia (scrapy/slybot) errors on windows

i installed portia and got it to work i annotated some websites (looks really good)
but when i try to run the spiders i get some errors and nothing gets crawled
im running python 2.7.6 on win 7
C:\Python27\Scripts>python portiacrawl C:\portia\slyd\data\projects\new_project
Traceback (most recent call last):
File "portiacrawl", line 7, in <module>
execfile(__file__)
File "C:\portia\slybot\bin\portiacrawl", line 56, in <module>
main()
File "C:\portia\slybot\bin\portiacrawl", line 54, in main
subprocess.call(command_spec)
File "C:\Python27\lib\subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "C:\Python27\lib\subprocess.py", line 709, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 957, in _execute_child
startupinfo)
WindowsError: [Error 2] O sistema nÒo conseguiu localizar o ficheiro especificado
I am troubleshooting portia on Windows 8.1 and encountered the same error, exactly.
Try running 'python portiacrawl' by itself to determine if there is a subsequent menu. You should be able to see Help info on 'portiacrawl'. I suspect that you need to name the [spider] & [options] as well as change the terminal directory to see the output from the crawler. I suggest trying the following but rename [spider] to actual name of your spider w/o brackets:
Enter into terminal: C:\portia\slyd\data\projects <------Change to proper directory in cmd
Make sure you are in the terminal directory "C:\portia\slyd\data\projects"
The Cmd propmpt should look like: C:\portia\slyd\data\projects> <----waiting for portia initiation.
Enter into terminal:
python portiacrawl C:\portia\slyd\data\projects\new_project [spider] -t csv -o test.csv; or,
python portiacrawl [spider] -t csv -o test.csv
Report back. I am curious as to the terminal response. Did it initiate portiacrawl & return "access is denied."