Flask-Uploads Module - flask-uploads

I am using Python 3.8.2. I am trying to create a project by using the Flask-Uploads module.
When I try to run it, I get error:
"no module named flask.ext.uploads"
I then tried to install this module again with upper case letters like Flask-Uploads, but I still have the same problem.
I was wondering if there's a problem with the latest Python version I am using?

This looks like you have a too old Flask-Uploads version.
Flask-Uploads has not seen an update on PyPi since 2016.
I created a fork of the library, in order to fix some errors and continue development:
https://pypi.org/project/Flask-Reuploaded/
You can use the new library as a drop-in replacement, that means, you do not have to change a single line of code.
Also, you have to import from flask_uploads instead of the obsolete flask.ext.uploads.

Related

Cant use 'fs' in my react-native project.. don't know how to solve

Hi im trying to use the fs.createReadStream() function in 'fs' however i cant seem to use this module as i keep getting this build error.
bundling failed: Error: While trying to resolve module fs from file /Users/bentait/Desktop/memriio/memriio_app/src/datapass.js, the package /Users/bentait/Desktop/memriio/memriio_app/node_modules/fs/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/bentait/Desktop/memriio/memriio_app/node_modules/fs/index.js. Indeed, none of these files exist:
Im almost at my end trying to learn js, react, react-native.. i seem to spend 90% of time trying to solve these sorts of problems and 10% of time writing actual code..
anyway - not really expecting a response on this but cool, if you know how to help..
You're not able to use node's fs because it is part of nodejs environment. As you surely know your application code is not running on nodejs but rather directly on your smartphone (besides debug mode but even there you cannot use node's fs package).
To access and manipulate smartphone's filesystem take a look at react-native-fs or rn-fetch-blob package.

ANDROID: java.util.MissingResourceException: Can't find resource for bundle 'org.eclipse.paho.client.mqttv3.internal.nls.logcat_en_US', key ''

There seems to be countless reports of this bug in Stack Overflow. None of the suggestions worked. In my case it is almost identical to this stack overflow report
SPRING
except this case is in Android being built in Android Studio. It only happens in release mode with proguard. Proguard corrupts it somehow. And yes I have done the following in proguard:
-keep class org.eclipse.paho.client.mqttv3.logging.JSR47Logger { *; }
-keep class org.eclipse.paho.** { *; }
I have also parsed the jars downloaded by gradle. I cannot update to 1.2.1 because that only works with the latest versions of Android ... according to comments made by the developers. If I could get the source code for 1.1.0 maybe I could stop it from calling a resource that does not exist.
Anyone solve this problem or is it a bug in proguard/paho?
Looking at the apks generated by release builds (uses proguard) and debug builds (no proguard) shows that proguard is taking the org.eclipse.... package name of the properties and changing the 'org' to some letter like 'c'. The mqtt paho client is looking for the property file using the full package name and therefore cannot find it, no matter what you include or exclude in proguard. I looked at an apk made a few months ago (I have not done anything with the paho client or that part of the code using the paho client ... it has worked fine and I have had no need to change it). I see in that old release apk that the 'org' is there as it should be.
So the problem is in proguard. All I could do to move forward is take the source files for 1.1.0, create a new java project module, and tediously comment out every 'log' and getLogger in the source code. Its a temporary and unpleasant fix but it works. When proguard (R8) fixes this, then I can go back to what I had.
So I guess the only real fix is to submit a bug to R8. That I have not done.

Why can't I call this C function from my Swift code?

I am trying to call this C library from my Swift code. I dragged the source files into my project and created a module.map file and added the directory containing the module map to Build Settings->Search Paths->Import Paths.
It seems to work. I can import the library and the name even shows up in autocomplete:
And I can access functions from the library and again autocomplete knows they are there:
But when I build, I get this error:
This name, "_mtex2MML_parse", is the same as the name of C function I'm trying to call except prefixed with an underscore.
I've gotten this same error before in similar circumstances trying to get cmark to work, but fixed it there by making sure that the .c file was included in the Target Membership, and then everything was fine. When I fiddled with doing that in this project, I've not had any luck. And in that case, autocomplete didn't even know about the function.
I've tried cleaning, deleting derived data, quitting Xcode, restarting computer, etc. I've tried on Xcode 8.3.3 Swift 3.1 and on Xcode 9b4, Swift 4.0. I'm on macOS 10.12.6. There is no other thing in the project besides this.
Can anyone offer any advice on how to proceed? Thanks.

Can't use Gems in Ruby C Extension unless i use full path

Whenever I try to use a gem using Ruby's C API (with rb_require), I get a "cannot load such file --" error UNLESS i use the full path. Requiring gems work fine in regular ruby scripts. Is these something else I need to do? These gems are installed using Bundler.
When you call rb_require from an extension you are calling the core “built-in” process for requiring files in Ruby. This bypasses the Gem handling code that is added by Rubygems when it replaces the Kernel#require method.
In order to get the proper gem handling you need to call the normal require method and let the usual method dispatch route the call to the Rubygems code. You can do that with:
rb_funcall(rb_cObject, rb_intern("require"), 1, rb_str_new_cstr("the_gem"));
You could call rb_intern once and store the result to avoid calling it multiple times if you wanted.

Integrating Android .aar lib

I'm trying to integrate the cwac-cam2 library with codenameone. The lib is in .aar format but when I build it fails whith the following error:
org.gradle.process.internal.ExecException: Process 'command '/home/ec2-user/android-sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
I can not find out what is wrong. Can you help me please?
Lib reference: https://github.com/commonsguy/cwac-cam2
Its a bit difficult for me to say what exactly wrong is, but you can try some general steps that I would follow like
1) Check your .aar lib is residing at appropriate location. Normally for Android it will be at ..\YourProject\native\android\YourLib.aar
(also do 'Refresh cn1lib files' once, because I did so.. lol)
2) check build hint and make sure you have
android.enableProguard = false
3) If you are using any activity from that .aar lib then make sure you have added those activity/ies in build hint as android.xapplication = <activity android:name="com.XX.YY.MyActivity" />
I would further suggest you look at Chen's post on ARR integration here: http://www.codenameone.com/blog/integrating-android-3rd-party-libraries-jni.html
Also notice that gradle builds are often harder to work with in terms of result readability. I would suggest trying to disable gradle first and getting it to work without it then re-enabling it so you can test with android studio if necessary. You can disable gradle with the build hint android.gradle=false.

Resources