Comments (3)
never use os.cwd
for finding paths! this depends on where you started the script. instead, you can find the folder including the script like this:
src_folder = os.path.dirname(__file__)
And then use os.path.join(...)
to create the paths. You can add relative paths using the ..
special folders to indicate "parent-directory".
from hive.
Thanks for your reply Daren! I decided to put it in the grasshopper Libraries folder, which is where some other components put their .dll files. This should avoid the need to move the .dll file to the working directory. Your thoughts?
clipper_path = os.getenv('APPDATA')+'\Grasshopper\Libraries\clipper_library.dll'
from hive.
It's a bug:
- don't concatenate strings to create paths. Use
os.path.join
.- actually, I mentioned that above...
- don't use backslashes (without escaping them) in string literals
- unless you're using the "raw" strings:
r'\Grasshopper\Libraries\clipper_library.dll'
. Note ther
at the beginning of the string? This tells python not to view the backslash as an escaping character. You just got lucky here. If any of the characters following the backslash had been one of those used in an escape sequence, you would not have gotten the result you expected.
- unless you're using the "raw" strings:
- why didn't you keep the dll relative to the script? now it's harder to install your software, as you can't just "copy paste". also, you now have to figure out how to package it when publishing for
pip install
. - your code is now hardcoded to look for the dll in the user's APPDATA folder - that means, it is now not possible to install the software for all users. This is a mistake I have made too with my RPS software.
The line should read:
clipper_path = os.path.join(os.getenv('APPDATA'), 'Grasshopper', 'Libraries', 'clipper_library.dll')
from hive.
Related Issues (20)
- Tree generator component
- Trees in Hive HOT 1
- implement tree database into Hive built
- Tree profile generator component
- Parametric Input Uvalue Opaque Split HOT 2
- Hive Conflict with non-installed Conduit HOT 1
- Energy Systems Lifetime HOT 1
- Building Lifetime HOT 1
- Results Object Read-only HOT 3
- Populate Construction Database based on KBOB/Bombyx
- English in Hive Building Form
- icons for tree components
- Add lifetime parameter for energy systems
- solar irradiation overestimated for southern hemisphere
- Building Lifetime
- update hive to rhino 7
- Window Frame Reduction | Clarification HOT 1
- PV Parametric Input Meshes
- Adiabatic Surface Selector HOT 1
- change wording in visualizer: "building" to "construction"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hive.