pyramid project created with pycharm raises a ValueError: Variable assignment - python

I'm a newbie to python and I'm trying to work on a web project with the pyramid framework. I use pycharm 4.0.4.
After creating a new pyramid project with pycharm and running setup.py develop, the project generates a ValueError when I try to run it as shown below:
C:\Users\Ovurevu\vir1\Scripts\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pycharm\pycharm_load_entry_point.py" C:\Users\Ovurevu\Desktop\Python Scripts\Pyramid_one\development.ini
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.4\helpers\pycharm\pycharm_load_entry_point.py", line 8, in <module>
load_entry_point(dist, "console_scripts", name)()
File "C:\Users\Ovurevu\vir1\lib\site-packages\pyramid\scripts\pserve.py", line 58, in main
return command.run()
File "C:\Users\Ovurevu\vir1\lib\site-packages\pyramid\scripts\pserve.py", line 257, in run
vars = self.get_options()
File "C:\Users\Ovurevu\vir1\lib\site-packages\pyramid\scripts\pserve.py", line 197, in get_options
return parse_vars(restvars)
File "C:\Users\Ovurevu\vir1\lib\site-packages\pyramid\scripts\common.py", line 15, in parse_vars
% arg)
ValueError: Variable assignment 'Scripts\\Pyramid_one\\development.ini' invalid (no "=")
I have spent a lot of time trying to debug this issue.
What I'm I doing wrong?

I know this is an old question, but I just had this same error. I figured it out though. There shouldn't be anything wrong with the development.ini file.
Tested functionality via command line.
I believe it is because anything with a space is not parsed correctly. If you add " (quotes) around the path it will work.
Tested on

Related

Tensorflow download_and_convert_mnist_m.py No such file or directory: '~/dsn_data/mnist_m/mnist_m_train'

I have a weird error message using the download_and_convert_mnist_m.py script from github https://github.com/tensorflow/models/tree/master/research/domain_adaptation/datasets.
The command I am using from the models/research/ folder is
python domain_adaptation/datasets/download_and_convert_mnist_m.py --dataset_dir=~/dsn_data/
The error message is
Traceback (most recent call last):
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 237, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 233, in main
run(FLAGS.dataset_dir)
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 201, in run
os.path.join(dataset_dir, 'mnist_m', 'mnist_m_train'))
File "domain_adaptation/datasets/download_and_convert_mnist_m.py", line 177, in _get_filenames
for filename in os.listdir(dataset_dir):
OSError: [Errno 2] No such file or directory: '~/dsn_data/mnist_m/mnist_m_train'
I tried several ways:
without creating the path before and without having the data before
create the path before and let it empty
download and unpack data from https://drive.google.com/drive/folders/0B_tExHiYS-0vR2dNZEU4NGlSSW8 at the specified path as described here https://github.com/tensorflow/models/tree/master/research/domain_adaptation
I use
Ubuntu 16.04
Python 2.7
tensorflow 1.4.1
What else can I do.. looks like an pretty simple error but I have no more ideas.
I solved it. The correct command is without the equal sign.
python domain_adaptation/datasets/download_and_convert_mnist_m.py --dataset_dir=~/dsn_data/

Pycharm Debug mode syntax error

all of a sudden when running PyCharm Community edition i've started to get this syntax error when running debug mode. I tried reinstalling PyCharm but had no luck with the error. Anyone see this before?
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 26, in <module>
from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info.py", line 19, in <module>
from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo # #UnusedImport
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_additional_thread_info_regular.py", line 5, in <module>
from _pydevd_bundle.pydevd_frame import PyDBFrame
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_frame.py", line 10, in <module>
from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_breakpoints.py", line 15, in <module>
from _pydevd_bundle.pydevd_comm import get_global_debugger
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 75, in <module>
import pydevconsole
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 10, in <module>
from _pydevd_bundle.pydevconsole_code_for_ironpython import InteractiveConsole
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevconsole_code_for_ironpython.py", line 105
except SyntaxError, err:
^
SyntaxError: invalid syntax
If you don't care about any project specific configurations or run configurations:
quit pycharm
delete .idea folder in your project folder
start pycharm
I've used this method as a quick fix solution when I encountered this issue late last night. But, the very nature of this solution indicates that this issue is caused by some corruption in the .idea folder. Were I to encounter this problem again, I would suggest a different approach:
first, try to search for the error text in the files in the .idea folder
if the previous step fails:
quit pycharm
move the .idea folder inside the project folder to a safe location
start pycharm to create a fresh .idea folder and quit it again
preform a 3-way merge between the old and the new .idea folders
start pycharm
If you have __init__.py in your current path, delete it.
Or if your file name is code.py, rename to something else.

Cannot start a console in newly installed Pycharm in Windows

On Windows 7 machine, Pycharm (community or professional) and Python 3.4 (tried Anaconda 3 as well) were installed newly. There were not problems running Python scripts interactively in main editor. However, when I tried to select View > Tool Windows > Python Console, it generates the following error messages and more. Basically, I couldn't bring up a console window in Pycharm.
C:\Users\user\Anaconda3\python.exe -u C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevconsole.py 56743 56744
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydev_imports.py", line 21, in <module>
from SimpleXMLRPCServer import SimpleXMLRPCServer
ImportError: No module named 'SimpleXMLRPCServer'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevconsole.py", line 20, in <module>
import pydevd_vars
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevd_vars.py", line 9, in <module>
from pydevd_xml import *
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevd_xml.py", line 7, in <module>
from pydev_imports import quote
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydev_imports.py", line 23, in <module>
from xmlrpc.server import SimpleXMLRPCServer
File "C:\Users\user\Anaconda3\lib\xmlrpc\server.py", line 108, in <module>
from http.server import BaseHTTPRequestHandler
File "C:\Users\user\Anaconda3\lib\http\server.py", line 660, in <module>
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
File "C:\Users\user\Anaconda3\lib\http\server.py", line 851, in SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
File "C:\Users\user\Anaconda3\lib\mimetypes.py", line 348, in init
db.read_windows_registry()
File "C:\Users\user\Anaconda3\lib\mimetypes.py", line 255, in read_windows_registry
with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: OpenKey() argument 2 must be str without null characters or None, not str
Process finished with exit code 1
Couldn't connect to console process.
-----------------these messages were showed up in "Python Console"-------------
You need to change your working directory. Go to File->Settings->Build, Execution, Deployment->Console->Python Console and then change or provide a directory where you have read and write access in the Working directory box.
The configuring of pycharm in the presence of various development configurations is a bit of a black art IMHO.
The most effective mechanism I've found for pinning this down is put random strings into the various settings dialogs, Interpreters, consoles, tests , servers and observe the command lines submitted to the interpreter VERY carefully.
Hardly a satisfactory approach but it will sort out what is going where and to a certain degree what effects what.
The other think that helps me are screenshots of the settings and testing dialogs of working installations.
Again, a bit rough and ready but it has got me up and running again after a long period of successful debugging followed by pycharm amnesia.
I had same problem. I reinstalled python and default directories have changed.
Then I just refreshed interpreter here File->Settings->Build, Execution, Deployment->Console->Python Console and here File->Settings->Project: <YOUR_PROJECT>->Project Interpreter.
If you will open new projects interpreter will need choose again (?)
I got it resolved by setting the interpreter in Preferences and project interpreter.

python error trying to start IDLE on windows: cannot import name InteractiveInterpreter

After installing and playing around with web.py this morning, plus installing (unnecessarily) pysqlite on a Python26 install (Windows) the Idle interface will no longer start.
Error code I receive:
C:\Python26>python -m idlelib.idle
Traceback (most recent call last):
File "C:\Python26\lib\runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python26\lib\runpy.py", line 34, in _run_code
exec code in run_globals
File "C:\Python26\lib\idlelib\idle.py", line 6, in <module>
import PyShell
File "C:\Python26\lib\idlelib\PyShell.py", line 16, in <module>
from code import InteractiveInterpreter
ImportError: cannot import name InteractiveInterpreter
I've tried a few things, including a reinstall of Python 2.6.6. Nothing has restored Idle's ability to run yet.
Anyone have any ideas on what's wrong/how I can fix it?
Sigh...never mind.
The starter walk-through code for web.py suggested you call your file "code.py". Even though I had this file in my own directory outside of the C:\Python26 folder, it was interfering with the code.py that Python expects (which contains the InteractiveInterpreter code.)
Unless this is a cruel joke by the web.py people, I'd suggest that they change what they suggest that you call the example test code name!

py2exe and sqlalchemy-migrate

I'm using python 2.6, sqlalchemy 0.6 for a tiny desktop application. Also i'm using py2exe and sqlalchemy-migrate and i'm trying to integrate migrate inside the exe. In this way when the user starts the application the database gets automatically upgraded.
If i try to use migrate in my eclipse project it works well but i want to release the project itself in an exe using py2exe. Unfortunately when i start the exe i got the error:
Traceback (most recent call last):
File "sagra.py", line 7, in <module>
File "guiutil.pyc", line 3, in <module>
File "bo.pyc", line 4, in <module>
File "database.pyc", line 26, in <module>
File "<string>", line 2, in version_control
File "migrate\versioning\util\__init__.pyc", line 160, in with_engine
File "migrate\versioning\api.pyc", line 248, in version_control
File "migrate\versioning\schema.pyc", line 128, in create
File "migrate\versioning\repository.pyc", line 76, in __init__
File "migrate\versioning\repository.pyc", line 97, in verify
migrate.versioning.exceptions.InvalidRepositoryError: db_repository
but the directory db_repository and the migration scripts are correctly inside the "library.zip" used by py2exe to incorporate all the python resources used by my software.
It seems sqlalchemy-migrate doesn't search inside the zip for the directory of the repository.
Here the problem (repository.py):
def verify(cls, path):
"""
Ensure the target path is a valid repository.
:raises: :exc:`InvalidRepositoryError <migrate.versioning.exceptions.InvalidRepositoryError>`
"""
# Ensure the existence of required files
try:
cls.require_found(path)
cls.require_found(os.path.join(path, cls._config))
cls.require_found(os.path.join(path, cls._versions))
except exceptions.PathNotFoundError, e:
raise exceptions.InvalidRepositoryError(path)
How to read the repository from a zip ?
Is there anyone who have tried (and succeded) to use sqlalchemy-migrate inside the exe generated by py2exe ?
Thanks for any help

Categories