I am trying to bundle an app in my Mac OS X Snow Leopard 10.6.8. I've python2.7, py27-tkinter installed through macports 2.3.4.
My code runs perfect when run as a script as well as in py2app's alias mode. However, when I bundle it doesn't behave properly: meaning, upon every conditional check on the user input integer, the result should be updated in the window. However, the result is updated only for the first input integer and nothing gets updated for the subsequent inputs. When I try to run interactively, I get the following error:
Traceback (most recent call last):
File "setup.py", line 18, in
setup_requires=['py2app'],
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/build_app.py", line 659, in run
self._run()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/build_app.py", line 865, in _run
self.run_normal()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/build_app.py", line 939, in run_normal
mf = self.get_modulefinder()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/py2app/build_app.py", line 814, in get_modulefinder
debug=debug,
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/modulegraph/find_modules.py", line 341, in find_modules
find_needed_modules(mf, scripts, includes, packages)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/modulegraph/find_modules.py", line 266, in find_needed_modules
path = m.packagepath[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
>>>
Could anyone shed some light on what is missing/wrong here and how to troubleshoot and ultimately solve the problem?
Many thanks in advance.
Related
I successfully built a package on the same Ubuntu desktop 2 months ago and am running into an error building the next version of the same package. I've updated the recipe and made sure conda itself was up-to-date before running the build as usual:
(base) pmena#pmena-7080=> cd anaconda_build/
(base) pmena#pmena-7080=> conda build mi-instrument
No numpy version specified in conda_build_config.yaml. Falling back to default numpy value of 1.11
WARNING:conda_build.metadata:No numpy version specified in conda_build_config.yaml. Falling back to default numpy value of 1.11
Adding in variants from internal_defaults
INFO:conda_build.variants:Adding in variants from internal_defaults
Attempting to finalize metadata for mi-instrument
INFO:conda_build.metadata:Attempting to finalize metadata for mi-instrument
Traceback (most recent call last):
File "/home/pmena/miniconda2/bin/conda-build", line 11, in <module>
sys.exit(main())
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/cli/main_build.py", line 474, in main
execute(sys.argv[1:])
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/cli/main_build.py", line 465, in execute
verify=args.verify, variants=args.variants)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/api.py", line 209, in build
notest=notest, need_source_download=need_source_download, variants=variants)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/build.py", line 2863, in build_tree
notest=notest,
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/build.py", line 1837, in build
output_metas = expand_outputs([(m, need_source_download, need_reparse_in_env)])
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/render.py", line 757, in expand_outputs
for (output_dict, m) in _m.copy().get_output_metadata_set(permit_unsatisfiable_variants=False):
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/metadata.py", line 2054, in get_output_metadata_set
bypass_env_check=bypass_env_check)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/metadata.py", line 727, in finalize_outputs_pass
permit_unsatisfiable_variants=permit_unsatisfiable_variants)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/render.py", line 538, in finalize_metadata
exclude_pattern)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/render.py", line 390, in add_upstream_pins
permit_unsatisfiable_variants, exclude_pattern)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/render.py", line 378, in _read_upstream_pin_files
permit_unsatisfiable_variants=permit_unsatisfiable_variants)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/render.py", line 154, in get_env_dependencies
channel_urls=tuple(m.config.channel_urls))
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/environ.py", line 749, in get_install_actions
locking=locking, timeout=timeout)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/index.py", line 172, in get_build_index
update_index(output_folder, verbose=debug)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/index.py", line 273, in update_index
current_index_versions=current_index_versions)
File "/home/pmena/miniconda2/lib/python2.7/site-packages/conda_build/index.py", line 776, in index
with tqdm(total=len(subdirs), disable=(verbose or not progress), leave=False) as t:
AttributeError: __exit__
This has always been a relatively straightforward process, so I'm hoping that it's just a simple oversight. Thanks in advance!
I ended up installing a slightly older version of miniconda2, which I was able to find in the anaconda archives. The build completed successfully after that.
I am in a VM environment (Win 7 VirtualBox) and had gotten the Anaconda 2.7 suite to work.
Being new to Python, I was working on some code that instructed me to install PythonWin to do some connection with Crystal Reports. Seemed to install OK but then started getting some errors about the kernel in Jupyter not starting.
Uninstalled everything and I think got rid of any bad links and such from the previous installs.
Did the fresh install of Anaconda 2.7 and did NOT install PythonWin. Now stuck with a broken/unable to load kernel in Jupyter. Here's the error below. All help much appreciated from this newbie. Thanks!
Traceback (most recent call last):
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\web.py", line 1592, in _execute
result = yield result
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1133, in run
value = future.result()
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
type=mtype))
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1133, in run
value = future.result()
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1133, in run
value = future.result()
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1141, in run
yielded = self.gen.throw(*exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 1133, in run
value = future.result()
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\concurrent.py", line 261, in result
raise_exc_info(self._exc_info)
File "C:\Users\Victor\Anaconda2\lib\site-packages\tornado\gen.py", line 326, in wrapper
yielded = next(result)
File "C:\Users\Victor\Anaconda2\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 160, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "C:\Users\Victor\Anaconda2\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "C:\Users\Victor\Anaconda2\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
**kw)
File "C:\Users\Victor\Anaconda2\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "C:\Users\Victor\Anaconda2\lib\site-packages\jupyter_client\launcher.py", line 138, in launch_kernel
proc = Popen(cmd, **kwargs)
File "C:\Users\Victor\Anaconda2\lib\subprocess.py", line 394, in __init__
errread, errwrite)
File "C:\Users\Victor\Anaconda2\lib\subprocess.py", line 644, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Figure I'll close the loop since I've found a solution - after uninstalling everything related to Anaconda and going through the file system and deleting all Anaconda related folders I re-installed Anaconda 2.7 as admin. Also during the setup I selected the choice to make the program available to all users.
Install finished and Anaconda 2.7 and all the modules worked as expected.
trying to get a Django project started using cookiecutter-django and can't seem to get it to generate anything.
using Python 3.6, Django 2.0.5, cookiecutter 1.6.0 (then created a virtualenv and entered a new, blank directory)
so I enter this command:
cookiecutter https://github.com/pydanny/cookiecutter-django
and get this error traceback:
Traceback (most recent call last):
File "c:\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Python\python36\Scripts\cookiecutter.exe\__main__.py", line 9, in
<module>
File "c:\python\python36\lib\site-packages\click\core.py", line 722, in
__call__
return self.main(*args, **kwargs)
File "c:\python\python36\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "c:\python\python36\lib\site-packages\click\core.py", line 895, in
invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python\python36\lib\site-packages\click\core.py", line 535, in
invoke
return callback(*args, **kwargs)
File "c:\python\python36\lib\site-packages\cookiecutter\cli.py", line 120,
in main
password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
File "c:\python\python36\lib\site-packages\cookiecutter\main.py", line 63,
in cookiecutter
password=password
File "c:\python\python36\lib\site-packages\cookiecutter\repository.py", line
103, in determine_repo_dir
no_input=no_input,
File "c:\python\python36\lib\site-packages\cookiecutter\vcs.py", line 99, in
clone
stderr=subprocess.STDOUT,
File "c:\python\python36\lib\subprocess.py", line 336, in check_output
**kwargs).stdout
File "c:\python\python36\lib\subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'clone',
'https://github.com/pydanny/cookiecutter-django']' returned non-zero exit
status 128.
OK - figured out how to get this to work.
used Github desktop
from cookiecutter-django repository, right click
open it Git Shell
this opens a Powershell window.
CD to directory where project will be placed in.
cookiecutter https://github.com/pydanny/cookiecutter-django
and it works.
not sure exactly why this works when regular CMD and elevated CMD do not, but this was the only way I could get it to work.
This is a permission issue with github due to the need to setup ssh keys. By the way I'm using ubuntu 12.
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/ - create a key first in your machine using the instructions in the link. Once you have your ssh key, proceed to step 2. (Step 2 is indicated in the first link as last step)
https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account - add the generated ssh key to your github account.
Trying to build an executable file using pyinstaller. I keep getting the below error
Traceback (most recent call last):
File "Inventory_Computation\app.py", line 145, in <module>
File "flask\app.py", line 843, in run
File "werkzeug\serving.py", line 692, in run_simple
File "werkzeug\_reloader.py", line 248, in run_with_reloader
File "werkzeug\_reloader.py", line 129, in run
File "werkzeug\_reloader.py", line 22, in _iter_module_files
File "Lib\email\__init__.py", line 79, in __getattr__
ImportError: No module named message
Failed to execute script app
found the solution finally...
Go to "C:\Python27\Lib\email"
And find the "init.py"
Comment out below lines.
'Audio',
'Base',
'Image',
'Message',
'Multipart',
'NonMultipart',
'Text',
Try pyinstaller again
I am trying to run the following Python 2.7.10 code on Win7:
from robot import run
run("Login.robot", variable=['USERNAME:testuser#fakemail.com'])
Login.robot is a very simple robot framework test that opens a browser window, loads our log in page, enters in a username and password, then confirms the user has logged in. I have tested it by running it from the command line with pybot and the test suite runs correctly. But trying to run the test suite from this script generates
Traceback (most recent call last):
File "C:\Users\dmdunn\Desktop\test_user_data.py", line 4, in <module>
run("Login.robot", variable=['USERNAME:testuser#fakemail.com'])
File "C:\Python27\lib\site-packages\robot\run.py", line 471, in run
return RobotFramework().execute(*datasources, **options)
File "C:\Python27\lib\site-packages\robot\utils\application.py", line 83, in execute
return self._execute(list(arguments), options)
File "C:\Python27\lib\site-packages\robot\utils\application.py", line 96, in _execute
details, rc=FRAMEWORK_ERROR)
File "C:\Python27\lib\site-packages\robot\utils\application.py", line 110, in _report_error
self._logger.error(message)
File "C:\Python27\lib\site-packages\robot\output\loggerhelper.py", line 59, in error
self.write(msg, 'ERROR')
File "C:\Python27\lib\site-packages\robot\output\loggerhelper.py", line 62, in write
self.message(Message(message, level, html))
File "C:\Python27\lib\site-packages\robot\output\logger.py", line 109, in message
logger.message(msg)
File "C:\Python27\lib\site-packages\robot\output\monitor.py", line 66, in message
self._writer.error(msg.message, msg.level, clear=self._running_test)
File "C:\Python27\lib\site-packages\robot\output\monitor.py", line 142, in error
self._highlight('[ ', level, ' ] ' + message, error=True)
File "C:\Python27\lib\site-packages\robot\output\monitor.py", line 158, in _highlight
self._write(before, newline=False, error=error)
File "C:\Python27\lib\site-packages\robot\output\monitor.py", line 154, in _write
stream.flush()
IOError: [Errno 9] Bad file descriptor
Any suggestions? I've tried using an absolute path to the robot file, single quotes, double quotes, referencing via an open file object, referencing via a closed file object. Thanks!
I discovered it was due to using IDLE, which prevented robot framework from writing to the console. My script runs when started from the Windows command line.
Open a file handle and call robot.run method inside while handle is open.
I hope this will solve your issue.
mydir = os.path.join('c:/','....')
os.makedirs(mydir)
with open('mydir', 'w') as stdout_file:
k = run("Login.robot",
variable=['USERNAME:testuser#fakemail.com'],
stdout=stdout_file)