I did the Nodebox tutorial on the graph library:
http://nodebox.net/code/index.php/Graph#loading_the_library
I installed the library in Application Support
I pasted the following code:
graph = ximport("graph")
create(iterations=1000, distance=1.0, layout="spring", depth=True)
And I got this error message:
Traceback (most recent call last):
File "nodebox/gui/mac/__init__.pyo", line 358, in _execScript
File "mypath", line 2, in <module>
NameError: name 'create' is not defined
And before that I got this:
NameError: name 'ximport' is not defined
If I close the file and reopen and just say graph = ximport("graph")
Nothing happens (it seems to work).
I think it would be a very cool library to work with.
Any help would be great.
The problem is with your Path, as the tutorial link that you pointed to said:
Put the graph library folder in the same folder as your script so NodeBox can find the library. You can also put it in ~/Library/Application Support/NodeBox/.
Otherwise install content from the graph.zip
and do
import graph
graph.create
Sorry, I don't have MAC to try these. But the error messages are saying that Python is not able to find your modules properly. For python to find it, they should be in the current directory or in the PYTHONPATH.
Related
When I run my py program it works the way I intended it to. If I am on a Linux box and build an executable using Pyinstaller, it builds without issue and executes without issue. I have scoured the Pyinstaller docs, git, etc. none of the posted fixes helped
I am still very new at python and feel like it might be a simple fix and might be over thinking the issue
Why can I no build a functional .exe on a windows based system using pyinstaller?
Windows 10 system
Pyinstaller version 3.2
Python version 3.5.2
This is a GUI program using appJar which is also up to date.
The file does build, but errors "Could not execute script"
EDIT
Not sure if this is best to edit in line like this but...
So studying the output and making adjustments, the issue seems to be appJar.py. For some reason it is missing assets, I am looking into it. The trouble is that I am still not used to looking at this kind of output and am not sure where to start.
C:\Users\_User_>C:\temp\fileCreatorGUI\fileCreatorGUI.exe
Traceback (most recent call last):
File "F:\Users\_User_\python_working\fileCreatorGUI.py", line 73, in <module>
app = gui()
File "C:\Users\_User_\AppData\Local\Programs\Python\Python35\lib\site-packages\appJar\appjar.py", line 509, in __init__
self.topLevel.wm_iconbitmap(self.appJarIcon)
File "C:\Users\_User_\AppData\Local\Programs\Python\Python35\lib\tkinter\__init__.py", line 1716, in wm_iconbitmap
return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
_tkinter.TclError: bitmap "C:\temp\fileCreatorGUI\appJar\resources\icons\favicon.ico" not defined
Failed to execute script fileCreatorGUI
Edit 2
See answer below, but I was barking up the wrong tree on this one,
The Pyinstaller output chokes on the .dll's:
api-ms-win-core-console-l1-1-0.dll
api-ms-win-core-datetime-l1-1-0.dll
(There are like ~40 of these)
I added those .dll's to the python path, I declared them in the bianaries in the .spec file.
here is a truncated log:
2414 WARNING: Can not get binary dependencies for file: C:\Windows\system32\api-
ms-win-crt-stdio-l1-1-0.dll
Traceback (most recent call last):
File "C:\Users\_USER_NAME\AppData\Local\Programs\Python\Python35-32\lib\site-pa
ckages\PyInstaller\depend\bindepend.py", line 695, in getImports
return _getImports_pe(pth)
File "C:\Users\_USER_NAME\AppData\Local\Programs\Python\Python35-32\lib\site-pa
ckages\PyInstaller\depend\bindepend.py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
2423 WARNING: Can not get binary dependencies for file: C:\Windows\system32\api-
ms-win-crt-heap-l1-1-0.dll
I tried the fix listed here:
https://github.com/pyinstaller/pyinstaller/pull/1981
but it did not seem to make a difference.
Someone recommended adding the sys.path.insert() route but it did not make a difference either way
I also tried this in a VM with windows 7, clean install, no change. My next step is to try to use Wine in Debian, but I don't really want to go that route. Any help would be appreciated. Thank you
Turns out this was an appJar/packaging issue, the pyinstaller was not looking in the correct directory for the assets. per the dev of appJar, I commented out two lines of code in the appJar.py, lines 508-509:
if self.platform == self.WINDOWS:
self.topLevel.wm_iconbitmap(self.appJarIcon)
More on the specifics here: https://github.com/jarvisteach/appJar/issues/84
I probably can fix this by using the --path argument with pyinstaller but for the moment, the issue is fully resolved
I am trying to import the spherical harmonic toolbox (SHTOOLS) in python. I have the files downloaded and unzipped and am using RedHat.
I added the package's path to my python system path and when I go to import the package, I get this error:
>>import pyshtools
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pyshtools/__init__.py", line 49, in <module>
load_documentation()
File "pyshtools/__init__.py", line 27, in load_documentation
from . import _SHTOOLS
ImportError: cannot import name _SHTOOLS
I can not seem to figure out what the issue is. I checked that the path to this folder was actually added to the system path and it was.
Is this an issue on my end? Or is it possible that I have something downloaded incorrectly? If so, how would I go about fixing this issue?
The SHTOOLS package needs to be built with make first to compile the Fortran libraries. The wiki on Github gives directions on which libraries are required - libblas-dev, liblapack-dev, g++, gfortran, and libfftw3-dev (these are the Ubuntu packages, they may have slightly different names on Redhat). Once these are installed, you need to run make, then sudo make all to install the Fortran and Python components. The Makefile has a lot of good comments in it, I'd recommend reading through it before running make.
I installed this library called Polygon, in Python 2.7.3. But, each time I import it I get the next error message :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Polygon/__init__.py", line 5, in <module>
from Polygon.cPolygon import *
ImportError: No module named cPolygon
I have no idea about what could be going wrong. And also, I have already tried to contact the original author of this on his personal webpage.
but he hasn't replied though :( I wonder if someone can help me with this issue please.
It sounds like you didn't in fact install it, but instead just copied it to your working directory. As always, run setup.py with the appropriate arguments to install.
This error can happen if you try to run python from inside the directory you used to install Polygon. Move to a different directory and try again.
I had a file called baseFunctions.py which I changed to elementFunctions.py. Importing elementFunctions with parsePeaksMzML.py gave me weird print statements, especially because I did not have any print statements in elementFunctions.py. Stepping through the code with Eclipses debugger showed instead of doing
import elementFunctions
as it said in the parsePeaksMzML.py, it actually did
import baseFunctions
I thought there was some weird mix-up with the renaming, so I copied all the code from elementFunctions.py, deleted the file, made a new file and pasted in all the code in the new file. Still I got the same weird errors. Looking in the folder I still had the baseFunctions.pyc, so I deleted that. Rerunning the code gave me:
Traceback (most recent call last):
File "/homes/ndeklein/workspace/MS/Trunk/PyMS_dev/pyMS/test/test_parsePeaksMzML.py", line 25, in <module>
import parsePeaksMzML
File "/homes/ndeklein/workspace/MS/Trunk/PyMS_dev/pyMS/test/parsePeaksMzML.py", line 12, in <module>
import elementFunctions
ImportError: No module named baseFunctions
Somehow import elementFunctions points to import baseFunctions (I have no clue why) and deleting and remaking elementFunctions.py has no effect. I can't find anything like this searching on google or stack overflow, so I'm kind of stumped here.
I suspect it to be a problem with eclipse, but I'm not sure.
edit:
What makes it even stranger, I get the error when I import parsePeaksMzML.py from
test_parsePeaksMzML.py, but not when I run parsePeaksMzML.py directly.
edit2:
Running from the commandline gives the same error:
-bash-3.2$ python test_parsePeaksMzML.py
Traceback (most recent call last):
File "test_parsePeaksMzML.py", line 26, in <module>
import parsePeaksMzML
File "/homes/ndeklein/workspace/MS/Trunk/PyMS_dev/pyMS/test/parsePeaksMzML.py", line 12, in <module>
ImportError: No module named baseFunctions
-bash-3.2$
If you changed the name of a file, probably you have some old .pyc lingering in your workspace. I'm assuming you're using the PyDev plug-in in Eclipse; I haven't used it in a while, but you should be able to do a Project -> Clean. If that doesn't help, try manually clearing all of the .pyc files in your workspace.
The symptoms you describe are very strange, so I'm not 100% sure what the problem is. Regardless, trying cleaning your workspace and let us know how things progress from there.
Do try a blanket delete of all .pyc files and see if that clears it up. If not, here are a few possibilities:
Your $PYTHONPATH points to different source than you expect. (Though this would likely not be the entire explanation.)
Code within elementFunctions/__init__.py is trying to import baseFunctions.
Code somewhere is using an exec statement to do imports, or using the built-in __import__ function to dynamically import baseFunctions (which might make the source of the directive difficult to hunt down).
This is the error i get:
Traceback (most recent call last):
File "dwload.py", line 9, in <module>
File "Pmw\__init__.pyc", line 28, in <module>
WindowsError: [Error 3] The system cannot find the path specified: "C:\\Users\\P
'sao\\Desktop\\dist\\library.zip\\Pmw/*.*"
I get the error after compiling the python file into the executable with py2exe.
Does anybody know why i get this error?
Found the solution: http://billyjin.kodingen.com/punbb-1.3.4/viewtopic.php?id=310
Well, the error message says that the path was not found, and if you look at the path, you appear to have mixed up backslashes and slashes as path separators. How are you constructing the path you're using?
I had the same problem when using pyinstaller and tkinter table (py 2.7). The problem was solved by removing the Pwm dependency in the tkintertable lib metadata. Its will help you, if pwm dont used in program
Finally, I found the solution:
First, you need to run the bundlepmw.py in the C:\Python27\Lib\site-packages\Pmw\build\lib\Pmw\Pmw_1_3\bin folder following this command: python bundlepmw.py C:\Python27\Lib\site-packages\Pmw\Pmw_1_3\lib to create the Pmw.py.
Read this page: folk.uio.no/hpl/scripting/doc/python/Pmw/dynamicloader.html, after fixing the bundlepmw.py based on this link sourceforge.net/p/pmw/discussion/33675/thread/f0bd7f34.
You should be able to generate the Pmw.py file.
Then copy the Pmw.py plus PmwBlt.py and PmwColor.py into the main script directory and run your setup.py. Sweet