Python error with init.tcl after Inno Setup Compiler - python-2.7

I have a program which I converted with py2exe to an exe. After that I tried to make an installer with Inno Setup. I included all necessary files like .dll, .pyd, .gif, .wav, the tlc folder (tcl8.5, tk8.5) etc. But after installing the program it gives me this error:
C:\Program Files (x86)\test>test.exe
Traceback (most recent call last):
File "test.py", line 9359, in <module>
File "test.py", line 11, in __init__
File "Tkinter.pyc", line 1745, in __init__
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
{C:/Program Files (x86)/lib/tcl8.5} {C:/Program Files (x86)/lib/tcl8.5} C:/l
ib/tcl8.5 {C:/Program Files (x86)/library} C:/library C:/tcl8.5.2/library C:/tcl
8.5.2/library
This probably means that Tcl wasn't installed properly.
How can I fix this? Thanks in advance.

This solved the problem I had. I've created my Inno Setup (v5.5.5) outside the py2exe output dir named dest (v0.6.9 win32).
Py2exe output dest contains one dir named tcl which contains files and subfolders. So in your Inno Setup script add the following entry to the [Files] section:
Source: dest\tcl\*; DestDir: "{app}\tcl"; Flags: createallsubdirs recursesubdirs
In my case currentWorkingdir\ is added to dest\tcl\*. This gets everything and sends it to DestDir: "(app)\tcl\" which gets the files and folders.
Flags createallsubdirs and recursesubdirs does all the work. This is an excerpt from help:
createallsubdirs
By default the compiler skips empty directories when it recurses
subdirectories searching for the Source filename/wildcard. This flag
causes these directories to be created at install time (just like if
you created [Dirs] entries for them).
Must be combined with recursesubdirs.

Related

Cannot open include file even when given the right path

I've been testing some stuff in Visual Studio after some time not working with VS, And I ran into a problem where I include a file and I get this error:
Cannot open include file 'spdlog/spdlog.h': No such file or directory
but I have the right path, in Project settings I have the right path set as an additional Include directory and the file is there. but the Thing is, when I take the file and move it one directory up and change the include path so that it now points one directory up (where the file is now) it suddenly works. Example:
File Path: Project/lib/spdlog/spdlog.h
Include directory: Project/lib
this Works
File Path: Project/lib/spdlog/spdlog/spdlog.h
Include directory: Project/lib/spdlog
This doesn't work
I don't want to include the lib directory since I have more libraries in it and it would just mess some stuff up, so I want to include every library (like spdlog for instance) separately. Does anyone know what might be causing the issue ? Also the error isn't shown when writing the code only when I try to build the Project.
Maybe you are missing spdlog library.
I suggest you check out this issue.
For debian-like distros you should be able to download it via apt-get: apt-get install libspdlog-dev.

Protoc Output Directory Issue - No Such File or Directory

I recently finished the basic tutorial for C++ here and wanted to set up a project based on the proto files from here. I followed a similar directory structure as the tutorial and changed up the CMakeLists.txt file to accommodate the new files.
I'm currently trying to just compile the manager.proto file. I was able to compile the file and get my server/client files, however the files are being outputted within cmake/build/minknow_api rather than the expected cmake/build folder. This meant the make command would return the error:
clang: error: no such file or directory: '/Users/name/Documents/grpc/examples/cpp/minknow_api/cmake/build/manager.grpc.pb.cc'
clang: error: no input files
I read that it was because protoc outputs based on the imports of the proto file, i.e the file comes with import minknow_api/device.proto for instance. I copied the files from within the cmake/build/minknow_api into cmake/build/ and reran make and it seemed to work, however, the C++ file imports as expected are searching within a minknow_api directory, meaning I'd have to manually edit these imports to look within the current directory instead of to then compile successfully.
I've tried experimenting with trying to get rid of the minknow_api from the proto imports, however had no luck and only got more import issues during compilation. It seems some files have the same names for messages etc, which means I had to keep the minknow.somename as the package so I can thus distinguish in the files which imported values I wanted to access. I've also tried moving files into their own directories like instance.proto which has package minknow.instance would go inside of instance directory, but still no luck.
I was wondering if anyone could figure out how to get rid of the minknow_api out of my proto imports properly so that I won't get these import and output directory issues down the track?

UHD import fails

I build uhd in windows (msvc 14.2, boost 1.72.0). Build works fine. I can run all of the command line utilities (eg rx_samples_from_file) without error.
But in python I cannot import uhd:
>>> import sys
>>> sys.path.append('C:\\Program Files (x86)\\UHD\\bin')
>>> sys.path.append('C:\\Program Files (x86)\\UHD\\lib')
>>> sys.path.append('C:\\Program Files (x86)\\UHD\\lib\\site-packages')
>>> sys.path.append('C:\\local\\boost_1_72_0\\lib64-msvc-14.2')
>>> sys.path.append('C:\\lib\\libusb-1.0.22\\MS64\\dll')
>>> import uhd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files (x86)\UHD\lib\site-packages\uhd\__init__.py", line 10, in <module>
from . import types
File "C:\Program Files (x86)\UHD\lib\site-packages\uhd\types.py", line 10, in <module>
from . import libpyuhd as lib
ImportError: DLL load failed while importing libpyuhd: The specified module could not be found.
Is there anyway to tell which DLL is not loading? I tried using dependency walker on libpyuhd but it did not show anything missing.
I had a similar issue, in that I could access the hardware via command line utilities or through GnuRadio Companion, but not directly through python (even though GRC is only launching the python files using the same python interpreter). I kept having these DLL issues.
Turns out that the location in sys.path are used by python to look for modules, but if the modules themselves are relying on .dll files, then they use the locations in the environmental variable path. I guess that the fetching of DLLS is handled directly by the OS and not by Python.
You can see the location in Python with os.environ['PATH'] . It should be the same list as by typing PATH the windows command line.
I solved the problem by crating a batch file that added the directories to the path before running python. In your case, you could try adding the directories to it (you would have to see which ones are missing):
#ECHO off
SET PATH=%PATH%;C:\\Program Files (x86)\\UHD\\bin;C:\\Program Files (x86)\\UHD\\lib;C:\\lib\\libusb-1.0.22\\MS64\\dll
python your_python_script.py
the path will be temporarily changed, (don't forget the %PATH% so that it appends the new folders to it) and once you exit the batch file, it will restore back to the default value.
You could also permanently change the path, by going to System Properties → Advanced → Environment variables.

Cannot open include file: 'occi.h': No such file or directory

I am trying to compile an existing C++ project but get this error:
fatal error C1083: Cannot open include file: 'occi.h': No such file or directory
What I did is I went to this link:
http://www.oracle.com/technetwork/topics/winsoft-085727.html
and downloaded the first (basic) package.
Then unzipped the folder and modified PATH variable like this:
C:\Program Files\Atmel\sam-ba_2.12\drv\;C:\Program Files\Atmel\sam-ba_2.12;C:\Program Files\ATMEL Corporation\AT91-ISP v1.4\Library;C:\MSYS\1.0\bin;C:\MSYS\1.0\local\bin;C:\cygnus\cygwin-b20\H-i586-cygwin32\bin;D:\instantclient_12_1
last being path to oracle.
But I still get the error, can someone help?
PS I noticed in my project there are lines like:
#include "occi.h"
Maybe it is because of this?
The basic package isn't enough. Its description says "All files required to run OCI, OCCI, and JDBC-OCI application" (emphasis added); with just that you can run an OCI program, but you can't compile one. You need to download other instant client components. Specifically for the occi.h header you need the fifth file listed:
*Instant Client Package - SDK: Additional header files and an example makefile for developing Oracle applications with Instant Client
If you download and unzip that in the same place you unzipped the basic package, your instant client directory will gain an sdk folder, which includes all the OCI header files.
You'll then need to compile with -I D:\instantclient_12_1\sdk\include so your compiler knows where to look for the occi.h and other header files. You may also need -L to tell it where to find the Oracle libraries; presumably you already have -lclntsh and/or -locci, which refer to libraries you should have already from the basic package.

Xcode 4 file input/output, command line tool C++

I'm trying to figure out where to save multiple .txt files so that i can have a command line tool project in Xcode read directly in from them while running it.
I understand that Xcode compiles everything to a folder, DerivedData, which i have saved in the same location as my source code for each project respectively.
can i save multiple .txt files anywhere in the DerivedData folder or include it in the build settings and phases so that when i run the command line tool i can type the name of a file, it will read in from that file.
By default the compiled/linked binary will look into its own directory for files.
For example, my binaries are at ProjectName/Build/Products/Debug/ and therefore it will look for files from that dir.
You can use relative path from that folder to the outside.
Or, you can create a symbolic link to another directory (on Terminal):
ln -s source_dir target_file
target_file must be located in the same directory as your binary. And you can reference the other files like "target_file/file1.txt", etc.